summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-01-17 14:17:52 +0000
committerKitware Robot <kwrobot@kitware.com>2023-01-17 09:18:04 -0500
commitdd18be5ebf6486486a272f47df3318d1db3a03cc (patch)
treeabb3a3469eba5704c5a458c30f1485731f91028d /Source
parent99c6e032d65b74281ca80079f71c28e171579e01 (diff)
parent0661de58d845f537d070979f9b49dd05800a141e (diff)
downloadcmake-dd18be5ebf6486486a272f47df3318d1db3a03cc.tar.gz
Merge topic 'ctest-no-tests-action-env-var'
0661de58d8 ctest(1): Add CTEST_NO_TESTS_ACTION env var Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8044
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCTest.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index b00fa73299..72cd8cd7e3 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -217,6 +217,7 @@ struct cmCTest::Private
std::map<std::string, std::string> Definitions;
cmCTest::NoTests NoTestsMode = cmCTest::NoTests::Legacy;
+ bool NoTestsModeSetInCli = false;
};
struct tm* cmCTest::GetNightlyTime(std::string const& str, bool tomorrowtag)
@@ -2132,6 +2133,7 @@ bool cmCTest::HandleCommandLineArguments(size_t& i,
} else {
this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
}
+ this->Impl->NoTestsModeSetInCli = true;
}
// options that control what tests are run
@@ -2774,6 +2776,24 @@ int cmCTest::Run(std::vector<std::string>& args, std::string* output)
}
}
+ // handle CTEST_NO_TESTS_ACTION environment variable
+ if (!this->Impl->NoTestsModeSetInCli) {
+ std::string action;
+ if (cmSystemTools::GetEnv("CTEST_NO_TESTS_ACTION", action) &&
+ !action.empty()) {
+ if (action == "error"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Error;
+ } else if (action == "ignore"_s) {
+ this->Impl->NoTestsMode = cmCTest::NoTests::Ignore;
+ } else {
+ cmCTestLog(this, ERROR_MESSAGE,
+ "Unknown value for CTEST_NO_TESTS_ACTION: '" << action
+ << '\'');
+ return 1;
+ }
+ }
+ }
+
// TestProgressOutput only supported if console supports it and not logging
// to a file
this->Impl->TestProgressOutput = this->Impl->TestProgressOutput &&