From b4fa9e23f6e073990623191dde1fcec962cb278a Mon Sep 17 00:00:00 2001 From: Vaidas Gasiunas Date: Thu, 21 Apr 2022 19:25:43 +0200 Subject: [PATCH] Upgrade Tests: Use build local tmp directory for temp client library copies --- bindings/c/test/apitester/TesterOptions.h | 2 ++ bindings/c/test/apitester/fdb_c_api_tester.cpp | 10 ++++++++++ tests/TestRunner/upgrade_test.py | 1 + 3 files changed, 13 insertions(+) diff --git a/bindings/c/test/apitester/TesterOptions.h b/bindings/c/test/apitester/TesterOptions.h index 4e448f1222..09a9ccc13a 100644 --- a/bindings/c/test/apitester/TesterOptions.h +++ b/bindings/c/test/apitester/TesterOptions.h @@ -38,6 +38,8 @@ public: std::string logGroup; std::string externalClientLibrary; std::string externalClientDir; + std::string tmpDir; + std::string clientTmpDir; bool disableLocalClient = false; std::string testFile; std::string inputPipeName; diff --git a/bindings/c/test/apitester/fdb_c_api_tester.cpp b/bindings/c/test/apitester/fdb_c_api_tester.cpp index a3de942226..0313031cfd 100644 --- a/bindings/c/test/apitester/fdb_c_api_tester.cpp +++ b/bindings/c/test/apitester/fdb_c_api_tester.cpp @@ -46,6 +46,7 @@ enum TesterOptionId { OPT_KNOB, OPT_EXTERNAL_CLIENT_LIBRARY, OPT_EXTERNAL_CLIENT_DIRECTORY, + OPT_TMP_DIR, OPT_DISABLE_LOCAL_CLIENT, OPT_TEST_FILE, OPT_INPUT_PIPE, @@ -66,6 +67,7 @@ CSimpleOpt::SOption TesterOptionDefs[] = // { OPT_KNOB, "--knob-", SO_REQ_SEP }, { OPT_EXTERNAL_CLIENT_LIBRARY, "--external-client-library", SO_REQ_SEP }, { OPT_EXTERNAL_CLIENT_DIRECTORY, "--external-client-dir", SO_REQ_SEP }, + { OPT_TMP_DIR, "--tmp-dir", SO_REQ_SEP }, { OPT_DISABLE_LOCAL_CLIENT, "--disable-local-client", SO_NONE }, { OPT_TEST_FILE, "-f", SO_REQ_SEP }, { OPT_TEST_FILE, "--test-file", SO_REQ_SEP }, @@ -98,6 +100,8 @@ void printProgramUsage(const char* execName) { " Path to the external client library.\n" " --external-client-dir DIR\n" " Directory containing external client libraries.\n" + " --tmp-dir DIR\n" + " Directory for temporary files of the client.\n" " --disable-local-client DIR\n" " Disable the local client, i.e. use only external client libraries.\n" " --input-pipe NAME\n" @@ -180,6 +184,9 @@ bool processArg(TesterOptions& options, const CSimpleOpt& args) { case OPT_EXTERNAL_CLIENT_DIRECTORY: options.externalClientDir = args.OptionArg(); break; + case OPT_TMP_DIR: + options.tmpDir = args.OptionArg(); + break; case OPT_DISABLE_LOCAL_CLIENT: options.disableLocalClient = true; break; @@ -236,6 +243,9 @@ void fdb_check(fdb_error_t e) { } void applyNetworkOptions(TesterOptions& options) { + if (!options.tmpDir.empty()) { + fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_CLIENT_TMP_DIR, options.tmpDir)); + } if (!options.externalClientLibrary.empty()) { fdb_check(FdbApi::setOption(FDBNetworkOption::FDB_NET_OPTION_DISABLE_LOCAL_CLIENT)); fdb_check( diff --git a/tests/TestRunner/upgrade_test.py b/tests/TestRunner/upgrade_test.py index 2f63fb8a51..3981b2d991 100755 --- a/tests/TestRunner/upgrade_test.py +++ b/tests/TestRunner/upgrade_test.py @@ -246,6 +246,7 @@ class UpgradeTest: '--api-version', str(self.api_version), '--log', '--log-dir', self.log, + '--tmp-dir', self.tmp_dir, '--transaction-retry-limit', str(TRANSACTION_RETRY_LIMIT)] if (RUN_WITH_GDB): cmd_args = ['gdb', '-ex', 'run', '--args'] + cmd_args