Loading tests/integration/harness/gkfs.io/syscall_coverage.cpp +18 −4 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { return; } // lssek external // lseek external rv = ::lseek(fdext, 0, SEEK_SET); if(rv < 0) { output("lseek", rv, opts); Loading Loading @@ -381,12 +381,26 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { return; } rv = ::renameat(AT_FDCWD, path1.c_str(), AT_FDCWD, path2.c_str()); rv = ::renameat(AT_FDCWD, path1.c_str(), AT_FDCWD, path2.c_str()); if(rv < 0) { output("renameat_ext_to_ext", rv, opts); return; } // open with O_APPEND std::string path_append = "/tmp/" + pid + "test_append"; auto fd_append = ::open(path1.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); if(fd_append < 0) { output("open with O_APPEND", fd_append, opts); return; } rv = ::write(fd_append, "testappend", 10); if(rv < 0) { output("open with O_APPEND", rv, opts); return; } ::close(fd_append); // sys_open rv = ::syscall(SYS_open, opts.pathname.c_str(), O_RDONLY, 0); if(rv < 0) { Loading tests/integration/harness/gkfs.io/write.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct write_options { std::string pathname; std::string data; ::size_t count; bool append{false}; REFL_DECL_STRUCT(write_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname), Loading @@ -71,8 +72,10 @@ to_json(json& record, const write_output& out) { void write_exec(const write_options& opts) { auto fd = ::open(opts.pathname.c_str(), O_WRONLY); auto flags = O_WRONLY; if(opts.append) flags |= O_APPEND; auto fd = ::open(opts.pathname.c_str(), flags); if(fd == -1) { if(opts.verbose) { Loading Loading @@ -125,5 +128,9 @@ write_init(CLI::App& app) { ->required() ->type_name(""); cmd->add_option("append", opts->append, "Append file") ->default_val(false) ->type_name(""); cmd->callback([opts]() { write_exec(*opts); }); } tests/integration/harness/gkfs.py +7 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ gkfs_daemon_log_file = 'gkfs_daemon.log' gkfs_daemon_log_level = '100' gkfs_client_log_file = 'gkfs_client.log' gkfs_client_log_level = 'all' gkfs_client_log_syscall_filter = 'epoll_wait,epoll_create' gkfs_daemon_active_log_pattern = r'Startup successful. Daemon is ready.' gkfwd_daemon_cmd = 'gkfwd_daemon' Loading Loading @@ -418,7 +419,8 @@ class Client: 'LD_PRELOAD': self._preload_library, 'LIBGKFS_HOSTS_FILE': self.cwd / gkfs_hosts_file, 'LIBGKFS_LOG': gkfs_client_log_level, 'LIBGKFS_LOG_OUTPUT' : self._workspace.logdir / gkfs_client_log_file 'LIBGKFS_LOG_OUTPUT': self._workspace.logdir / gkfs_client_log_file, 'LIBGKFS_LOG_SYSCALL_FILTER': gkfs_client_log_syscall_filter } self._env.update(self._patched_env) Loading tests/integration/operations/test_write_operations.py +37 −7 Original line number Diff line number Diff line Loading @@ -55,8 +55,38 @@ def test_write(gkfs_daemon, gkfs_client): assert ret.retval == len(buf) # Return the number of written bytes def test_pwrite(gkfs_daemon, gkfs_client): file_append = gkfs_daemon.mountdir / "file_append" ret = gkfs_client.open(file_append, os.O_CREAT | os.O_WRONLY | os.O_APPEND, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 str1 = b'Hello' str2 = b', World!' str3 = b' This is a test.\n' ret = gkfs_client.write(file_append, str1, len(str1), True) assert ret.retval == len(str1) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == len(str1) ret = gkfs_client.write(file_append, str2, len(str2), True) assert ret.retval == len(str2) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == (len(str1) + len(str2)) ret = gkfs_client.write(file_append, str3, len(str3), True) assert ret.retval == len(str3) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == (len(str1) + len(str2) + len(str3)) def test_pwrite(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading @@ -71,8 +101,8 @@ def test_pwrite(gkfs_daemon, gkfs_client): assert ret.retval == len(buf) # Return the number of written bytes def test_writev(gkfs_daemon, gkfs_client): def test_writev(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading @@ -87,8 +117,8 @@ def test_writev(gkfs_daemon, gkfs_client): assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes def test_pwritev(gkfs_daemon, gkfs_client): def test_pwritev(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading tests/integration/syscalls/test_error_operations.py +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ def test_open_error(gkfs_daemon, gkfs_client): file2 = gkfs_daemon.mountdir / "file2" file3 = gkfs_daemon.mountdir / "file3" flags = [os.O_PATH, os.O_APPEND, os.O_CREAT | os.O_DIRECTORY] flags = [os.O_PATH, os.O_CREAT | os.O_DIRECTORY] # create a file in gekkofs for flag in flags: Loading Loading
tests/integration/harness/gkfs.io/syscall_coverage.cpp +18 −4 Original line number Diff line number Diff line Loading @@ -150,7 +150,7 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { return; } // lssek external // lseek external rv = ::lseek(fdext, 0, SEEK_SET); if(rv < 0) { output("lseek", rv, opts); Loading Loading @@ -381,12 +381,26 @@ syscall_coverage_exec(const syscall_coverage_options& opts) { return; } rv = ::renameat(AT_FDCWD, path1.c_str(), AT_FDCWD, path2.c_str()); rv = ::renameat(AT_FDCWD, path1.c_str(), AT_FDCWD, path2.c_str()); if(rv < 0) { output("renameat_ext_to_ext", rv, opts); return; } // open with O_APPEND std::string path_append = "/tmp/" + pid + "test_append"; auto fd_append = ::open(path1.c_str(), O_CREAT | O_WRONLY | O_APPEND, 0644); if(fd_append < 0) { output("open with O_APPEND", fd_append, opts); return; } rv = ::write(fd_append, "testappend", 10); if(rv < 0) { output("open with O_APPEND", rv, opts); return; } ::close(fd_append); // sys_open rv = ::syscall(SYS_open, opts.pathname.c_str(), O_RDONLY, 0); if(rv < 0) { Loading
tests/integration/harness/gkfs.io/write.cpp +9 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct write_options { std::string pathname; std::string data; ::size_t count; bool append{false}; REFL_DECL_STRUCT(write_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname), Loading @@ -71,8 +72,10 @@ to_json(json& record, const write_output& out) { void write_exec(const write_options& opts) { auto fd = ::open(opts.pathname.c_str(), O_WRONLY); auto flags = O_WRONLY; if(opts.append) flags |= O_APPEND; auto fd = ::open(opts.pathname.c_str(), flags); if(fd == -1) { if(opts.verbose) { Loading Loading @@ -125,5 +128,9 @@ write_init(CLI::App& app) { ->required() ->type_name(""); cmd->add_option("append", opts->append, "Append file") ->default_val(false) ->type_name(""); cmd->callback([opts]() { write_exec(*opts); }); }
tests/integration/harness/gkfs.py +7 −5 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ gkfs_daemon_log_file = 'gkfs_daemon.log' gkfs_daemon_log_level = '100' gkfs_client_log_file = 'gkfs_client.log' gkfs_client_log_level = 'all' gkfs_client_log_syscall_filter = 'epoll_wait,epoll_create' gkfs_daemon_active_log_pattern = r'Startup successful. Daemon is ready.' gkfwd_daemon_cmd = 'gkfwd_daemon' Loading Loading @@ -418,7 +419,8 @@ class Client: 'LD_PRELOAD': self._preload_library, 'LIBGKFS_HOSTS_FILE': self.cwd / gkfs_hosts_file, 'LIBGKFS_LOG': gkfs_client_log_level, 'LIBGKFS_LOG_OUTPUT' : self._workspace.logdir / gkfs_client_log_file 'LIBGKFS_LOG_OUTPUT': self._workspace.logdir / gkfs_client_log_file, 'LIBGKFS_LOG_SYSCALL_FILTER': gkfs_client_log_syscall_filter } self._env.update(self._patched_env) Loading
tests/integration/operations/test_write_operations.py +37 −7 Original line number Diff line number Diff line Loading @@ -55,8 +55,38 @@ def test_write(gkfs_daemon, gkfs_client): assert ret.retval == len(buf) # Return the number of written bytes def test_pwrite(gkfs_daemon, gkfs_client): file_append = gkfs_daemon.mountdir / "file_append" ret = gkfs_client.open(file_append, os.O_CREAT | os.O_WRONLY | os.O_APPEND, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) assert ret.retval == 10000 str1 = b'Hello' str2 = b', World!' str3 = b' This is a test.\n' ret = gkfs_client.write(file_append, str1, len(str1), True) assert ret.retval == len(str1) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == len(str1) ret = gkfs_client.write(file_append, str2, len(str2), True) assert ret.retval == len(str2) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == (len(str1) + len(str2)) ret = gkfs_client.write(file_append, str3, len(str3), True) assert ret.retval == len(str3) ret = gkfs_client.stat(file_append) assert ret.retval == 0 assert ret.statbuf.st_size == (len(str1) + len(str2) + len(str3)) def test_pwrite(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading @@ -71,8 +101,8 @@ def test_pwrite(gkfs_daemon, gkfs_client): assert ret.retval == len(buf) # Return the number of written bytes def test_writev(gkfs_daemon, gkfs_client): def test_writev(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading @@ -87,8 +117,8 @@ def test_writev(gkfs_daemon, gkfs_client): assert ret.retval == len(buf_0) + len(buf_1) # Return the number of written bytes def test_pwritev(gkfs_daemon, gkfs_client): def test_pwritev(gkfs_daemon, gkfs_client): file = gkfs_daemon.mountdir / "file" ret = gkfs_client.open(file, Loading
tests/integration/syscalls/test_error_operations.py +1 −1 Original line number Diff line number Diff line Loading @@ -47,7 +47,7 @@ def test_open_error(gkfs_daemon, gkfs_client): file2 = gkfs_daemon.mountdir / "file2" file3 = gkfs_daemon.mountdir / "file3" flags = [os.O_PATH, os.O_APPEND, os.O_CREAT | os.O_DIRECTORY] flags = [os.O_PATH, os.O_CREAT | os.O_DIRECTORY] # create a file in gekkofs for flag in flags: Loading