summaryrefslogtreecommitdiffstats
path: root/Source/cmCTest.cxx
diff options
context:
space:
mode:
authorfriendlyanon <friendlyanon_@hotmail.com>2022-12-30 14:11:17 (GMT)
committerfriendlyanon <friendlyanon_@hotmail.com>2023-01-13 12:33:39 (GMT)
commit0661de58d845f537d070979f9b49dd05800a141e (patch)
tree84c9440a94d8755584c32c18b57cf51e5430d391 /Source/cmCTest.cxx
parentbb52a1781a6eb29bce3c4847b9fc882dd198467a (diff)
downloadCMake-0661de58d845f537d070979f9b49dd05800a141e.zip
CMake-0661de58d845f537d070979f9b49dd05800a141e.tar.gz
CMake-0661de58d845f537d070979f9b49dd05800a141e.tar.bz2
ctest(1): Add CTEST_NO_TESTS_ACTION env var
This environment variable provides a default value for the --no-tests=<action> command line argument.
Diffstat (limited to 'Source/cmCTest.cxx')
-rw-r--r--Source/cmCTest.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index f60a1e9..41c05e2 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 &&