Loading tests/integration/harness/gkfs.io/binary_buffer.hpp +5 −8 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace io { struct buffer { buffer(::size_t size = 0) : m_data(size) { } buffer(::size_t size = 0) : m_data(size) {} buffer(nullptr_t p) {} Loading Loading @@ -63,13 +62,11 @@ struct buffer { }; inline void to_json(nlohmann::json& record, const buffer& out) { to_json(nlohmann::json& record, const buffer& out) { if(out == nullptr) { record = nullptr; } else { } else { // record = fmt::format("x{:2x}", fmt::join(out, "x")); record = out.storage(); Loading tests/integration/harness/gkfs.io/chdir.cpp +14 −30 Original line number Diff line number Diff line Loading @@ -29,25 +29,20 @@ struct chdir_options { bool verbose{}; std::string pathname; REFL_DECL_STRUCT(chdir_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname) ); REFL_DECL_STRUCT(chdir_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname)); }; struct chdir_output { int retval; int errnum; REFL_DECL_STRUCT(chdir_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_STRUCT(chdir_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const chdir_output& out) { to_json(json& record, const chdir_output& out) { record = serialize(out); } Loading @@ -71,26 +66,15 @@ chdir_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<chdir_options>(); auto* cmd = app.add_subcommand( "chdir", "Execute the chdir() system call"); auto* cmd = app.add_subcommand("chdir", "Execute the chdir() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human readable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human readable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->callback([opts]() { chdir_exec(*opts); }); cmd->callback([opts]() { chdir_exec(*opts); }); } tests/integration/harness/gkfs.io/commands.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ #define IO_COMMANDS_HPP // forward declare CLI::App namespace CLI { struct App; } namespace CLI { struct App; } void mkdir_init(CLI::App& app); Loading tests/integration/harness/gkfs.io/getcwd_validate.cpp +26 −41 Original line number Diff line number Diff line Loading @@ -29,10 +29,8 @@ struct getcwd_validate_options { bool verbose{}; std::string pathname; REFL_DECL_STRUCT(getcwd_validate_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname) ); REFL_DECL_STRUCT(getcwd_validate_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname)); }; struct getcwd_validate_output { Loading @@ -40,16 +38,13 @@ struct getcwd_validate_output { std::string path; int errnum; REFL_DECL_STRUCT(getcwd_validate_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_STRUCT(getcwd_validate_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(std::string, path), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const getcwd_validate_output& out) { to_json(json& record, const getcwd_validate_output& out) { record = serialize(out); } Loading @@ -57,7 +52,6 @@ void getcwd_validate_exec(const getcwd_validate_options& opts) { char path[1024]; auto rv = ::chdir(opts.pathname.c_str()); if(rv == 0) { Loading @@ -70,7 +64,8 @@ getcwd_validate_exec(const getcwd_validate_options& opts) { if(path == opts.pathname) if(opts.verbose) { fmt::print("getcwd_validate(pathname=\"{}\") = {}, errno: {} [{}]\n", fmt::print( "getcwd_validate(pathname=\"{}\") = {}, errno: {} [{}]\n", opts.pathname, cwd, errno, ::strerror(errno)); return; } Loading @@ -85,26 +80,16 @@ getcwd_validate_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<getcwd_validate_options>(); auto* cmd = app.add_subcommand( "getcwd_validate", auto* cmd = app.add_subcommand("getcwd_validate", "Execute the getcwd_validate() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human readable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human readable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->callback([opts]() { getcwd_validate_exec(*opts); }); cmd->callback([opts]() { getcwd_validate_exec(*opts); }); } tests/integration/harness/gkfs.io/lseek.cpp +42 −62 Original line number Diff line number Diff line Loading @@ -30,42 +30,41 @@ using json = nlohmann::json; struct lseek_options { bool verbose; bool verbose{}; std::string pathname; ::off_t offset; int whence; REFL_DECL_STRUCT(lseek_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_STRUCT(lseek_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname), REFL_DECL_MEMBER(::off_t, offset), REFL_DECL_MEMBER(int, whence) ); REFL_DECL_MEMBER(int, whence)); }; struct lseek_output { ::off_t retval; int errnum; REFL_DECL_STRUCT(lseek_output, REFL_DECL_MEMBER(::off_t, retval), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_STRUCT(lseek_output, REFL_DECL_MEMBER(::off_t, retval), REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const lseek_output& out) { to_json(json& record, const lseek_output& out) { record = serialize(out); } std::string whence2str(int whence) { switch(whence) { case SEEK_SET : return "SEEK_SET"; case SEEK_CUR : return "SEEK_CUR"; case SEEK_END : return "SEEK_END"; default : return "UNKNOWN"; case SEEK_SET: return "SEEK_SET"; case SEEK_CUR: return "SEEK_CUR"; case SEEK_END: return "SEEK_END"; default: return "UNKNOWN"; } return "UNKNOWN"; } Loading @@ -91,8 +90,10 @@ lseek_exec(const lseek_options& opts) { int rv = ::lseek(fd, opts.offset, opts.whence); if(opts.verbose) { fmt::print("lseek(pathname=\"{}\", offset='{}', whence='{}') = {}, errno: {} [{}]\n", opts.pathname, opts.offset, whence2str(opts.whence), rv, errno, ::strerror(errno)); fmt::print( "lseek(pathname=\"{}\", offset='{}', whence='{}') = {}, errno: {} [{}]\n", opts.pathname, opts.offset, whence2str(opts.whence), rv, errno, ::strerror(errno)); return; } Loading @@ -105,44 +106,23 @@ lseek_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<lseek_options>(); auto* cmd = app.add_subcommand( "lseek", "Execute the lseek() system call"); auto* cmd = app.add_subcommand("lseek", "Execute the lseek() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human writeable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human writeable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->add_option( "offset", opts->offset, "offset used" ) cmd->add_option("offset", opts->offset, "offset used") ->required() ->type_name(""); cmd->add_option( "whence", opts->whence, "Whence the action is done" ) cmd->add_option("whence", opts->whence, "Whence the action is done") ->required() ->type_name(""); cmd->callback([opts]() { lseek_exec(*opts); }); cmd->callback([opts]() { lseek_exec(*opts); }); } Loading
tests/integration/harness/gkfs.io/binary_buffer.hpp +5 −8 Original line number Diff line number Diff line Loading @@ -22,8 +22,7 @@ namespace io { struct buffer { buffer(::size_t size = 0) : m_data(size) { } buffer(::size_t size = 0) : m_data(size) {} buffer(nullptr_t p) {} Loading Loading @@ -63,13 +62,11 @@ struct buffer { }; inline void to_json(nlohmann::json& record, const buffer& out) { to_json(nlohmann::json& record, const buffer& out) { if(out == nullptr) { record = nullptr; } else { } else { // record = fmt::format("x{:2x}", fmt::join(out, "x")); record = out.storage(); Loading
tests/integration/harness/gkfs.io/chdir.cpp +14 −30 Original line number Diff line number Diff line Loading @@ -29,25 +29,20 @@ struct chdir_options { bool verbose{}; std::string pathname; REFL_DECL_STRUCT(chdir_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname) ); REFL_DECL_STRUCT(chdir_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname)); }; struct chdir_output { int retval; int errnum; REFL_DECL_STRUCT(chdir_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_STRUCT(chdir_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const chdir_output& out) { to_json(json& record, const chdir_output& out) { record = serialize(out); } Loading @@ -71,26 +66,15 @@ chdir_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<chdir_options>(); auto* cmd = app.add_subcommand( "chdir", "Execute the chdir() system call"); auto* cmd = app.add_subcommand("chdir", "Execute the chdir() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human readable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human readable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->callback([opts]() { chdir_exec(*opts); }); cmd->callback([opts]() { chdir_exec(*opts); }); }
tests/integration/harness/gkfs.io/commands.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,9 @@ #define IO_COMMANDS_HPP // forward declare CLI::App namespace CLI { struct App; } namespace CLI { struct App; } void mkdir_init(CLI::App& app); Loading
tests/integration/harness/gkfs.io/getcwd_validate.cpp +26 −41 Original line number Diff line number Diff line Loading @@ -29,10 +29,8 @@ struct getcwd_validate_options { bool verbose{}; std::string pathname; REFL_DECL_STRUCT(getcwd_validate_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname) ); REFL_DECL_STRUCT(getcwd_validate_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname)); }; struct getcwd_validate_output { Loading @@ -40,16 +38,13 @@ struct getcwd_validate_output { std::string path; int errnum; REFL_DECL_STRUCT(getcwd_validate_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_STRUCT(getcwd_validate_output, REFL_DECL_MEMBER(int, retval), REFL_DECL_MEMBER(std::string, path), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const getcwd_validate_output& out) { to_json(json& record, const getcwd_validate_output& out) { record = serialize(out); } Loading @@ -57,7 +52,6 @@ void getcwd_validate_exec(const getcwd_validate_options& opts) { char path[1024]; auto rv = ::chdir(opts.pathname.c_str()); if(rv == 0) { Loading @@ -70,7 +64,8 @@ getcwd_validate_exec(const getcwd_validate_options& opts) { if(path == opts.pathname) if(opts.verbose) { fmt::print("getcwd_validate(pathname=\"{}\") = {}, errno: {} [{}]\n", fmt::print( "getcwd_validate(pathname=\"{}\") = {}, errno: {} [{}]\n", opts.pathname, cwd, errno, ::strerror(errno)); return; } Loading @@ -85,26 +80,16 @@ getcwd_validate_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<getcwd_validate_options>(); auto* cmd = app.add_subcommand( "getcwd_validate", auto* cmd = app.add_subcommand("getcwd_validate", "Execute the getcwd_validate() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human readable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human readable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->callback([opts]() { getcwd_validate_exec(*opts); }); cmd->callback([opts]() { getcwd_validate_exec(*opts); }); }
tests/integration/harness/gkfs.io/lseek.cpp +42 −62 Original line number Diff line number Diff line Loading @@ -30,42 +30,41 @@ using json = nlohmann::json; struct lseek_options { bool verbose; bool verbose{}; std::string pathname; ::off_t offset; int whence; REFL_DECL_STRUCT(lseek_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_STRUCT(lseek_options, REFL_DECL_MEMBER(bool, verbose), REFL_DECL_MEMBER(std::string, pathname), REFL_DECL_MEMBER(::off_t, offset), REFL_DECL_MEMBER(int, whence) ); REFL_DECL_MEMBER(int, whence)); }; struct lseek_output { ::off_t retval; int errnum; REFL_DECL_STRUCT(lseek_output, REFL_DECL_MEMBER(::off_t, retval), REFL_DECL_MEMBER(int, errnum) ); REFL_DECL_STRUCT(lseek_output, REFL_DECL_MEMBER(::off_t, retval), REFL_DECL_MEMBER(int, errnum)); }; void to_json(json& record, const lseek_output& out) { to_json(json& record, const lseek_output& out) { record = serialize(out); } std::string whence2str(int whence) { switch(whence) { case SEEK_SET : return "SEEK_SET"; case SEEK_CUR : return "SEEK_CUR"; case SEEK_END : return "SEEK_END"; default : return "UNKNOWN"; case SEEK_SET: return "SEEK_SET"; case SEEK_CUR: return "SEEK_CUR"; case SEEK_END: return "SEEK_END"; default: return "UNKNOWN"; } return "UNKNOWN"; } Loading @@ -91,8 +90,10 @@ lseek_exec(const lseek_options& opts) { int rv = ::lseek(fd, opts.offset, opts.whence); if(opts.verbose) { fmt::print("lseek(pathname=\"{}\", offset='{}', whence='{}') = {}, errno: {} [{}]\n", opts.pathname, opts.offset, whence2str(opts.whence), rv, errno, ::strerror(errno)); fmt::print( "lseek(pathname=\"{}\", offset='{}', whence='{}') = {}, errno: {} [{}]\n", opts.pathname, opts.offset, whence2str(opts.whence), rv, errno, ::strerror(errno)); return; } Loading @@ -105,44 +106,23 @@ lseek_init(CLI::App& app) { // Create the option and subcommand objects auto opts = std::make_shared<lseek_options>(); auto* cmd = app.add_subcommand( "lseek", "Execute the lseek() system call"); auto* cmd = app.add_subcommand("lseek", "Execute the lseek() system call"); // Add options to cmd, binding them to opts cmd->add_flag( "-v,--verbose", opts->verbose, "Produce human writeable output" ); cmd->add_option( "pathname", opts->pathname, "Directory name" ) cmd->add_flag("-v,--verbose", opts->verbose, "Produce human writeable output"); cmd->add_option("pathname", opts->pathname, "Directory name") ->required() ->type_name(""); cmd->add_option( "offset", opts->offset, "offset used" ) cmd->add_option("offset", opts->offset, "offset used") ->required() ->type_name(""); cmd->add_option( "whence", opts->whence, "Whence the action is done" ) cmd->add_option("whence", opts->whence, "Whence the action is done") ->required() ->type_name(""); cmd->callback([opts]() { lseek_exec(*opts); }); cmd->callback([opts]() { lseek_exec(*opts); }); }