Verified Commit 5a0a4393 authored by Ramon Nou's avatar Ramon Nou Committed by Marc Vef
Browse files

Updated tests and dirents for rename

parent ce9e7bd4
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -415,6 +415,15 @@ ParallaxBackend::get_dirents_impl(const std::string& dir) const {
        assert(!name.empty());

        Metadata md(v);
#ifdef HAS_RENAME
        // Remove entries with negative blocks (rename)
        if(md.blocks() == -1) {
            if(par_get_next(S) && !par_is_valid(S))
                break;
            else
                continue;
        }
#endif // HAS_RENAME
        auto is_dir = S_ISDIR(md.mode());

        entries.emplace_back(std::move(name), is_dir);
@@ -489,6 +498,15 @@ ParallaxBackend::get_dirents_extended_impl(const std::string& dir) const {
        assert(!name.empty());

        Metadata md(v);
#ifdef HAS_RENAME
        // Remove entries with negative blocks (rename)
        if(md.blocks() == -1) {
            if(par_get_next(S) && !par_is_valid(S))
                break;
            else
                continue;
        }
#endif // HAS_RENAME
        auto is_dir = S_ISDIR(md.mode());

        entries.emplace_back(std::forward_as_tuple(std::move(name), is_dir,
+12 −0
Original line number Diff line number Diff line
@@ -265,6 +265,12 @@ RocksDBBackend::get_dirents_impl(const std::string& dir) const {
        assert(!name.empty());

        Metadata md(it->value().ToString());
#ifdef HAS_RENAME
        // Remove entries with negative blocks (rename)
        if(md.blocks() == -1) {
            continue;
        }
#endif // HAS_RENAME
        auto is_dir = S_ISDIR(md.mode());

        entries.emplace_back(std::move(name), is_dir);
@@ -309,6 +315,12 @@ RocksDBBackend::get_dirents_extended_impl(const std::string& dir) const {
        assert(!name.empty());

        Metadata md(it->value().ToString());
#ifdef HAS_RENAME
        // Remove entries with negative blocks (rename)
        if(md.blocks() == -1) {
            continue;
        }
#endif // HAS_RENAME
        auto is_dir = S_ISDIR(md.mode());

        entries.emplace_back(std::forward_as_tuple(std::move(name), is_dir,
+6 −0
Original line number Diff line number Diff line
@@ -378,6 +378,9 @@ def test_rename_delete(gkfs_daemon, gkfs_client):
    assert ret.retval != -1
    assert ret.statbuf.st_size == len(buf)

    ret = gkfs_client.readdir(gkfs_daemon.mountdir)
    assert len(ret.dirents) == 1

    ret = gkfs_client.unlink(fileold) # Remove original file (error)
    assert ret.retval != 0

@@ -387,5 +390,8 @@ def test_rename_delete(gkfs_daemon, gkfs_client):
    ret = gkfs_client.stat(filenew)
    assert ret.retval == -1

    ret = gkfs_client.readdir(gkfs_daemon.mountdir)
    assert len(ret.dirents) == 0