From e00992671c41dedc7a92c8ccc72787caed041746 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Fri, 18 Sep 2020 17:15:22 +0200 Subject: [PATCH 1/3] Stop leaking internal errno during client init This was previously causing an errno of 115 during tests. While an errno of 0 is not guaranteed on success, all errno's within GKFS should be kept internal. --- src/client/gkfs_functions.cpp | 2 -- src/client/hooks.cpp | 1 + src/client/preload.cpp | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/gkfs_functions.cpp b/src/client/gkfs_functions.cpp index 3156d8f61..8749e9044 100644 --- a/src/client/gkfs_functions.cpp +++ b/src/client/gkfs_functions.cpp @@ -1017,7 +1017,6 @@ int gkfs_getdents64(unsigned int fd, * @return 0 on success or -1 on error */ int gkfs_mk_symlink(const std::string& path, const std::string& target_path) { - gkfs::preload::init_ld_env_if_needed(); /* The following check is not POSIX compliant. * In POSIX the target is not checked at all. * Here if the target is a directory we raise a NOTSUP error. @@ -1064,7 +1063,6 @@ int gkfs_mk_symlink(const std::string& path, const std::string& target_path) { * @return 0 on success or -1 on error */ int gkfs_readlink(const std::string& path, char* buf, int bufsize) { - gkfs::preload::init_ld_env_if_needed(); auto md = gkfs::util::get_metadata(path, false); if (md == nullptr) { LOG(DEBUG, "Named link doesn't exist"); diff --git a/src/client/hooks.cpp b/src/client/hooks.cpp index 788076d39..a4571035f 100644 --- a/src/client/hooks.cpp +++ b/src/client/hooks.cpp @@ -32,6 +32,7 @@ extern "C" { namespace { +// TODO replace all internal gkfs errno variable usage with LEAF inline int with_errno(int ret) { return (ret < 0) ? -errno : ret; } diff --git a/src/client/preload.cpp b/src/client/preload.cpp index cf2e5b48f..33043ce78 100644 --- a/src/client/preload.cpp +++ b/src/client/preload.cpp @@ -220,6 +220,8 @@ void init_ld_env_if_needed() { * Called initially ONCE when preload library is used with the LD_PRELOAD environment variable */ void init_preload() { + // The original errno value will be restored after initialization to not leak internal error codes + auto oerrno = errno; CTX->enable_interception(); gkfs::preload::start_self_interception(); @@ -252,6 +254,7 @@ void init_preload() { #endif gkfs::preload::start_interception(); + errno = oerrno; } /** -- GitLab From ee2a94b4f71a5e03dbd1d526340ccb6187f7a411 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Fri, 18 Sep 2020 17:25:09 +0200 Subject: [PATCH 2/3] lseek() fix: Do not allow negative offsets for whence `SEEK_SET` --- src/client/gkfs_functions.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client/gkfs_functions.cpp b/src/client/gkfs_functions.cpp index 8749e9044..bcda83769 100644 --- a/src/client/gkfs_functions.cpp +++ b/src/client/gkfs_functions.cpp @@ -418,6 +418,10 @@ off_t gkfs_lseek(unsigned int fd, off_t offset, unsigned int whence) { off_t gkfs_lseek(shared_ptr gkfs_fd, off_t offset, unsigned int whence) { switch (whence) { case SEEK_SET: + if (offset < 0) { + errno = EINVAL; + return -1; + } gkfs_fd->pos(offset); break; case SEEK_CUR: -- GitLab From 9608ff14984effda4a2e7914e053c16ea3364d49 Mon Sep 17 00:00:00 2001 From: Marc Vef Date: Fri, 18 Sep 2020 17:28:40 +0200 Subject: [PATCH 3/3] Testing: Removing errno 115 FIXME TODOs Testing on an error code in the successful case has an undefined value and was therefore removed. --- tests/integration/data/test_data_integrity.py | 1 - tests/integration/data/test_truncate.py | 12 ---------- .../directories/test_directories.py | 15 ------------- tests/integration/forwarding/test_map.py | 22 ------------------- .../operations/test_read_operations.py | 18 +-------------- .../operations/test_write_operations.py | 8 ------- tests/integration/position/test_lseek.py | 7 +----- tests/integration/status/test_status.py | 2 -- 8 files changed, 2 insertions(+), 83 deletions(-) diff --git a/tests/integration/data/test_data_integrity.py b/tests/integration/data/test_data_integrity.py index 0a166bc3c..32f2df095 100644 --- a/tests/integration/data/test_data_integrity.py +++ b/tests/integration/data/test_data_integrity.py @@ -47,7 +47,6 @@ def test_data_integrity(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! # test stat on existing dir ret = gkfs_client.stat(topdir) diff --git a/tests/integration/data/test_truncate.py b/tests/integration/data/test_truncate.py index 743832a9e..199af554d 100644 --- a/tests/integration/data/test_truncate.py +++ b/tests/integration/data/test_truncate.py @@ -37,11 +37,9 @@ def test_truncate(gkfs_daemon, gkfs_client): ret = gkfs_client.write_random(truncfile, buf_length) assert ret.retval == buf_length - assert ret.errno == 115 # FIXME: Should be 0! ret = gkfs_client.stat(truncfile) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.statbuf.st_size == buf_length # truncate it @@ -49,12 +47,10 @@ def test_truncate(gkfs_daemon, gkfs_client): trunc_size = buf_length // 2 ret = gkfs_client.truncate(truncfile, trunc_size) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.retval == 0 # check file length ret = gkfs_client.stat(truncfile) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.statbuf.st_size == trunc_size # verify contents by writing a new file (random content is seeded) and checksum both @@ -69,30 +65,25 @@ def test_truncate(gkfs_daemon, gkfs_client): ret = gkfs_client.write_random(truncfile_verify, trunc_size) assert ret.retval == trunc_size - assert ret.errno == 115 # FIXME: Should be 0! ret = gkfs_client.stat(truncfile_verify) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.statbuf.st_size == trunc_size ret = gkfs_client.file_compare(truncfile, truncfile_verify, trunc_size) assert ret.retval == 0 - assert ret.errno == 115 # FIXME: Should be 0! # trunc at byte 712345 (middle of chunk) # TODO feed chunksize into test to make sure it is always in the middle of the chunk trunc_size = 712345 ret = gkfs_client.truncate(truncfile, trunc_size) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.retval == 0 # check file length ret = gkfs_client.stat(truncfile) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.statbuf.st_size == trunc_size # verify contents by writing a new file (random content is seeded) and checksum both @@ -107,14 +98,11 @@ def test_truncate(gkfs_daemon, gkfs_client): ret = gkfs_client.write_random(truncfile_verify_2, trunc_size) assert ret.retval == trunc_size - assert ret.errno == 115 # FIXME: Should be 0! ret = gkfs_client.stat(truncfile_verify_2) - assert ret.errno == 115 # FIXME: Should be 0! assert ret.statbuf.st_size == trunc_size ret = gkfs_client.file_compare(truncfile, truncfile_verify_2, trunc_size) assert ret.retval == 0 - assert ret.errno == 115 # FIXME: Should be 0! diff --git a/tests/integration/directories/test_directories.py b/tests/integration/directories/test_directories.py index fc342f4d0..13ad035a2 100644 --- a/tests/integration/directories/test_directories.py +++ b/tests/integration/directories/test_directories.py @@ -42,19 +42,16 @@ def test_mkdir(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! # test stat on existing dir ret = gkfs_client.stat(topdir) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! assert stat.S_ISDIR(ret.statbuf.st_mode) # open topdir ret = gkfs_client.open(topdir, os.O_DIRECTORY) assert ret.retval != -1 - assert ret.errno == 115 #FIXME: Should be 0! # read and write should be impossible on directories @@ -77,19 +74,16 @@ def test_mkdir(gkfs_daemon, gkfs_client): ret = gkfs_client.opendir(topdir) assert ret.dirp is not None - assert ret.errno == 115 #FIXME: Should be 0! ret = gkfs_client.readdir(topdir) # XXX: This might change in the future if we add '.' and '..' assert len(ret.dirents) == 0 - assert ret.errno == 115 #FIXME: Should be 0! # close directory # TODO: disabled for now because we have no way to keep DIR* alive # between gkfs.io executions # ret = gkfs_client.opendir(XXX) - # assert ret.errno == 115 #FIXME: Should be 0! # populate top directory @@ -99,14 +93,12 @@ def test_mkdir(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! ret = gkfs_client.open(file_a, os.O_CREAT, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval != -1 - assert ret.errno == 115 #FIXME: Should be 0! ret = gkfs_client.readdir(gkfs_daemon.mountdir) @@ -114,7 +106,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): assert len(ret.dirents) == 1 assert ret.dirents[0].d_name == 'top' assert ret.dirents[0].d_type == 4 # DT_DIR - assert ret.errno == 115 #FIXME: Should be 0! expected = [ ( dir_a.name, 4 ), # DT_DIR @@ -124,7 +115,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): ret = gkfs_client.readdir(topdir) assert len(ret.dirents) == len(expected) - assert ret.errno == 115 #FIXME: Should be 0! for d,e in zip(ret.dirents, expected): assert d.d_name == e[0] @@ -141,7 +131,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! expected = [ ( topdir.name, 4 ), # DT_DIR @@ -150,7 +139,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): ret = gkfs_client.readdir(gkfs_daemon.mountdir) assert len(ret.dirents) == len(expected) - assert ret.errno == 115 #FIXME: Should be 0! for d,e in zip(ret.dirents, expected): assert d.d_name == e[0] @@ -162,7 +150,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! expected = [ ( topdir.name, 4 ), # DT_DIR @@ -171,7 +158,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): ret = gkfs_client.readdir(gkfs_daemon.mountdir) assert len(ret.dirents) == len(expected) - assert ret.errno == 115 #FIXME: Should be 0! for d,e in zip(ret.dirents, expected): assert d.d_name == e[0] @@ -184,7 +170,6 @@ def test_mkdir(gkfs_daemon, gkfs_client): ret = gkfs_client.readdir(dir_a) assert len(ret.dirents) == len(expected) - assert ret.errno == 115 #FIXME: Should be 0! for d,e in zip(ret.dirents, expected): assert d.d_name == e[0] diff --git a/tests/integration/forwarding/test_map.py b/tests/integration/forwarding/test_map.py index 5a2d33a0b..86c412bb0 100644 --- a/tests/integration/forwarding/test_map.py +++ b/tests/integration/forwarding/test_map.py @@ -44,14 +44,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = c00.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = c00.open(file, @@ -59,14 +57,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = c00.read(file, len(buf)) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! file = d01.mountdir / "file-c01" @@ -77,14 +73,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = c01.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = c01.open(file, @@ -92,14 +86,12 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = c01.read(file, len(buf)) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! # both files should be there and accessible by the two clients ret = c00.readdir(d00.mountdir) @@ -108,11 +100,9 @@ def test_two_io_nodes(gkfwd_daemon_factory, gkfwd_client_factory): assert ret.dirents[0].d_name == 'file-c00' assert ret.dirents[0].d_type == 8 # DT_REG - assert ret.errno == 115 #FIXME: Should be 0! assert ret.dirents[1].d_name == 'file-c01' assert ret.dirents[1].d_type == 8 # DT_REG - assert ret.errno == 115 #FIXME: Should be 0! with open(c00.log) as f: lines = f.readlines() @@ -149,14 +139,12 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = c00.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! with open(c00.log) as f: lines = f.readlines() @@ -181,14 +169,12 @@ def test_two_io_nodes_remap(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file buf = b'24' ret = c00.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! with open(c00.log) as f: lines = f.readlines() @@ -216,14 +202,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = c00.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = c00.open(file, @@ -231,14 +215,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = c00.read(file, len(buf)) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = c01.open(file, @@ -246,14 +228,12 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = c01.read(file, len(buf)) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! # the file should be there and accessible by the two clients ret = c00.readdir(d00.mountdir) @@ -262,7 +242,6 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory): assert ret.dirents[0].d_name == 'file-c00' assert ret.dirents[0].d_type == 8 # DT_REG - assert ret.errno == 115 #FIXME: Should be 0! # the file should be there and accessible by the two clients ret = c01.readdir(d01.mountdir) @@ -271,7 +250,6 @@ def test_two_io_nodes_operations(gkfwd_daemon_factory, gkfwd_client_factory): assert ret.dirents[0].d_name == 'file-c00' assert ret.dirents[0].d_type == 8 # DT_REG - assert ret.errno == 115 #FIXME: Should be 0! with open(c00.log) as f: lines = f.readlines() diff --git a/tests/integration/operations/test_read_operations.py b/tests/integration/operations/test_read_operations.py index 22e65ff95..3099b0c2c 100644 --- a/tests/integration/operations/test_read_operations.py +++ b/tests/integration/operations/test_read_operations.py @@ -35,14 +35,12 @@ def test_read(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = gkfs_client.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = gkfs_client.open(file, @@ -50,14 +48,12 @@ def test_read(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = gkfs_client.read(file, len(buf)) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_pread(gkfs_daemon, gkfs_client): @@ -69,14 +65,12 @@ def test_pread(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf = b'42' ret = gkfs_client.pwrite(file, buf, len(buf), 1024) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = gkfs_client.open(file, @@ -84,14 +78,12 @@ def test_pread(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file at offset 1024 ret = gkfs_client.pread(file, len(buf), 1024) assert ret.buf == buf assert ret.retval == len(buf) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_readv(gkfs_daemon, gkfs_client): @@ -103,7 +95,6 @@ def test_readv(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf_0 = b'42' @@ -111,7 +102,6 @@ def test_readv(gkfs_daemon, gkfs_client): ret = gkfs_client.writev(file, buf_0, buf_1, 2) assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = gkfs_client.open(file, @@ -119,7 +109,6 @@ def test_readv(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = gkfs_client.readv(file, len(buf_0), len(buf_1)) @@ -127,7 +116,6 @@ def test_readv(gkfs_daemon, gkfs_client): assert ret.buf_0 == buf_0 assert ret.buf_1 == buf_1 assert ret.retval == len(buf_0) + len(buf_1) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_preadv(gkfs_daemon, gkfs_client): @@ -139,7 +127,6 @@ def test_preadv(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # write a buffer we know buf_0 = b'42' @@ -147,7 +134,6 @@ def test_preadv(gkfs_daemon, gkfs_client): ret = gkfs_client.pwritev(file, buf_0, buf_1, 2, 1024) assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! # open the file to read ret = gkfs_client.open(file, @@ -155,12 +141,10 @@ def test_preadv(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! # read the file ret = gkfs_client.preadv(file, len(buf_0), len(buf_1), 1024) assert ret.buf_0 == buf_0 assert ret.buf_1 == buf_1 - assert ret.retval == len(buf_0) + len(buf_1) # Return the number of read bytes - assert ret.errno == 115 #FIXME: Should be 0! \ No newline at end of file + assert ret.retval == len(buf_0) + len(buf_1) # Return the number of read bytes \ No newline at end of file diff --git a/tests/integration/operations/test_write_operations.py b/tests/integration/operations/test_write_operations.py index c18987592..95a204c88 100644 --- a/tests/integration/operations/test_write_operations.py +++ b/tests/integration/operations/test_write_operations.py @@ -34,13 +34,11 @@ def test_write(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! buf = b'42' ret = gkfs_client.write(file, buf, len(buf)) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_pwrite(gkfs_daemon, gkfs_client): @@ -51,14 +49,12 @@ def test_pwrite(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! buf = b'42' # write at the offset 1024 ret = gkfs_client.pwrite(file, buf, len(buf), 1024) assert ret.retval == len(buf) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_writev(gkfs_daemon, gkfs_client): @@ -69,14 +65,12 @@ def test_writev(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! buf_0 = b'42' buf_1 = b'24' ret = gkfs_client.writev(file, buf_0, buf_1, 2) assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! def test_pwritev(gkfs_daemon, gkfs_client): @@ -87,11 +81,9 @@ def test_pwritev(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 - assert ret.errno == 115 #FIXME: Should be 0! buf_0 = b'42' buf_1 = b'24' ret = gkfs_client.pwritev(file, buf_0, buf_1, 2, 1024) assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes - assert ret.errno == 115 #FIXME: Should be 0! diff --git a/tests/integration/position/test_lseek.py b/tests/integration/position/test_lseek.py index daf357c7a..356f34a64 100644 --- a/tests/integration/position/test_lseek.py +++ b/tests/integration/position/test_lseek.py @@ -51,13 +51,11 @@ def test_lseek(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! # test stat on existing dir ret = gkfs_client.stat(topdir) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! assert stat.S_ISDIR(ret.statbuf.st_mode) ret = gkfs_client.open(file_a, @@ -74,13 +72,12 @@ def test_lseek(gkfs_daemon, gkfs_client): ret = gkfs_client.lseek(file_a, -1, os.SEEK_SET) assert ret.retval == -1 - assert ret.errno == 115 #FIXME: Should be 22 + assert ret.errno == 22 # We can go further an empty file ret = gkfs_client.lseek(file_a, 5, os.SEEK_SET) assert ret.retval == 5 - assert ret.errno == 115 #FIXME: Should be 0 # Size needs to be 0 ret = gkfs_client.stat(file_a) @@ -106,11 +103,9 @@ def test_lseek(gkfs_daemon, gkfs_client): ret = gkfs_client.lseek(file_a, 0, os.SEEK_END) assert ret.retval == 2 #FAILS - assert ret.errno == 115 #FIXME: Should be 0 ret = gkfs_client.lseek(file_a, -2, os.SEEK_END) assert ret.retval == 0 #FAILS - assert ret.errno == 115 #FIXME: Should be 0 ret = gkfs_client.lseek(file_a, -3, os.SEEK_END) assert ret.retval == -1 #FAILS diff --git a/tests/integration/status/test_status.py b/tests/integration/status/test_status.py index d3684a241..aaa883fd1 100644 --- a/tests/integration/status/test_status.py +++ b/tests/integration/status/test_status.py @@ -43,13 +43,11 @@ def test_statx(gkfs_daemon, gkfs_client): stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! # test statx on existing dir ret = gkfs_client.statx(0, topdir, 0, 0) assert ret.retval == 0 - assert ret.errno == 115 #FIXME: Should be 0! assert stat.S_ISDIR(ret.statbuf.stx_mode) ret = gkfs_client.open(file_a, -- GitLab