aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralexv-smirnov <alex@ydb.tech>2023-05-02 17:56:38 +0300
committeralexv-smirnov <alex@ydb.tech>2023-05-02 17:56:38 +0300
commit4e8ead9a9a16fed820ecd8030e67dc878e03bc74 (patch)
tree8447f1481148c072f9ba051b09c0ed406941fc92
parente583f3c1e371f444e1c51008ed193b116256078f (diff)
downloadydb-4e8ead9a9a16fed820ecd8030e67dc878e03bc74.tar.gz
Push down TMPDIR env var to a subprocess
-rw-r--r--library/cpp/testing/unittest/utmain.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp
index 99245c8052..40766bf137 100644
--- a/library/cpp/testing/unittest/utmain.cpp
+++ b/library/cpp/testing/unittest/utmain.cpp
@@ -506,6 +506,12 @@ private:
return EnabledTests_.find(name) != EnabledTests_.end();
}
+ void PushDownEnvVar(TShellCommandOptions* options, const TString& var) {
+ if (TString value = GetEnv(var)) {
+ options->Environment[var] = std::move(value);
+ }
+ }
+
void Run(std::function<void()> f, const TString& suite, const char* name, const bool forceFork) override {
if (!(GetForkTests() || forceFork) || GetIsForked()) {
return f();
@@ -522,9 +528,8 @@ private:
.SetAsync(false)
.SetLatency(1);
- if (TString output = GetEnv(Y_UNITTEST_OUTPUT_CMDLINE_OPTION)) {
- options.Environment[Y_UNITTEST_OUTPUT_CMDLINE_OPTION] = output;
- }
+ PushDownEnvVar(&options, Y_UNITTEST_OUTPUT_CMDLINE_OPTION);
+ PushDownEnvVar(&options, "TMPDIR");
TShellCommand cmd(AppName, args, options);
cmd.Run();