diff options
author | Brad King <brad.king@kitware.com> | 2020-04-22 12:38:24 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-04-22 12:38:33 (GMT) |
commit | f9fbc78cd638c1bb874ffd24531f98c095ca1377 (patch) | |
tree | 75df921366553c93063bbec443fe207a48767ae6 /Source/CTest | |
parent | 370def7b3e3205ba47c0634ab99f8cdf28ff4dae (diff) | |
parent | e89aeba5c4733964db15e0d147e063af34205d54 (diff) | |
download | CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.zip CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.tar.gz CMake-f9fbc78cd638c1bb874ffd24531f98c095ca1377.tar.bz2 |
Merge topic 'ctest_stop_on_failure_16628'
e89aeba5c4 ctest: add option --stop-on-failure
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4630
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.cxx | 4 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestCommand.h | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 4 |
5 files changed, 21 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 3fc417a..5c37f97 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -137,7 +137,7 @@ void cmCTestMultiProcessHandler::RunTests() uv_run(&this->Loop, UV_RUN_DEFAULT); uv_loop_close(&this->Loop); - if (!this->StopTimePassed) { + if (!this->StopTimePassed && !this->CheckStopOnFailure()) { assert(this->Completed == this->Total); assert(this->Tests.empty()); } @@ -367,6 +367,11 @@ void cmCTestMultiProcessHandler::CheckResourcesAvailable() } } +bool cmCTestMultiProcessHandler::CheckStopOnFailure() +{ + return this->CTest->GetStopOnFailure(); +} + bool cmCTestMultiProcessHandler::CheckStopTimePassed() { if (!this->StopTimePassed) { @@ -483,6 +488,10 @@ void cmCTestMultiProcessHandler::StartNextTests() return; } + if (this->CheckStopOnFailure() && !this->Failed->empty()) { + return; + } + size_t numToStart = 0; if (this->RunningCount < this->ParallelLevel) { diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index c3686bc..6e999f9 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -138,6 +138,8 @@ protected: inline size_t GetProcessorsUsed(int index); std::string GetName(int index); + bool CheckStopOnFailure(); + bool CheckStopTimePassed(); void SetStopTimePassed(); diff --git a/Source/CTest/cmCTestTestCommand.cxx b/Source/CTest/cmCTestTestCommand.cxx index c5f683d..6b317cb 100644 --- a/Source/CTest/cmCTestTestCommand.cxx +++ b/Source/CTest/cmCTestTestCommand.cxx @@ -34,6 +34,7 @@ void cmCTestTestCommand::BindArguments() this->Bind("STOP_TIME"_s, this->StopTime); this->Bind("TEST_LOAD"_s, this->TestLoad); this->Bind("RESOURCE_SPEC_FILE"_s, this->ResourceSpecFile); + this->Bind("STOP_ON_FAILURE"_s, this->StopOnFailure); } cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() @@ -90,6 +91,9 @@ cmCTestGenericHandler* cmCTestTestCommand::InitializeHandler() handler->SetOption("ExcludeFixtureCleanupRegularExpression", this->ExcludeFixtureCleanup.c_str()); } + if (this->StopOnFailure) { + handler->SetOption("StopOnFailure", "ON"); + } if (!this->ParallelLevel.empty()) { handler->SetOption("ParallelLevel", this->ParallelLevel.c_str()); } diff --git a/Source/CTest/cmCTestTestCommand.h b/Source/CTest/cmCTestTestCommand.h index 2345afb..7925586 100644 --- a/Source/CTest/cmCTestTestCommand.h +++ b/Source/CTest/cmCTestTestCommand.h @@ -60,6 +60,7 @@ protected: std::string StopTime; std::string TestLoad; std::string ResourceSpecFile; + bool StopOnFailure = false; }; #endif diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 7f21633..2408d57 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -514,6 +514,10 @@ bool cmCTestTestHandler::ProcessOptions() this->CTest->SetParallelLevel(atoi(this->GetOption("ParallelLevel"))); } + if (this->GetOption("StopOnFailure")) { + this->CTest->SetStopOnFailure(true); + } + const char* val; val = this->GetOption("LabelRegularExpression"); if (val) { |