diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2019-07-19 16:14:14 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-07-19 16:14:27 (GMT) |
commit | 16bb46eaf3261a2991e35e22116fd8a51d031b15 (patch) | |
tree | 8a63dfff76a0b2edab7571a4e2b631af633d0701 /Source/CTest | |
parent | 573f1fc19b39f0aaea6c17c1c11c1f5bbde227d3 (diff) | |
parent | 5dbd9c8583f44d0d9abe2ec95b2ddfd4ac65dc0d (diff) | |
download | CMake-16bb46eaf3261a2991e35e22116fd8a51d031b15.zip CMake-16bb46eaf3261a2991e35e22116fd8a51d031b15.tar.gz CMake-16bb46eaf3261a2991e35e22116fd8a51d031b15.tar.bz2 |
Merge topic 'skip_regular_expression'
5dbd9c8583 Vim: Add SKIP_REGULAR_EXPRESSION test property to vim syntax file
407dd1a910 Help: Add documentation for SKIP_REGULAR_EXPRESSION test property
d7955d4e5d Tests: Create test for SKIP_REGULAR_EXPRESSION test property
4f1dec86a5 CTest: Add SKIP_REGULAR_EXPRESSION test property
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3570
Diffstat (limited to 'Source/CTest')
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 5 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 25 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 11 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.h | 2 |
4 files changed, 38 insertions, 5 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 37a8abf..42534f7 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -823,6 +823,11 @@ static Json::Value DumpCTestProperties( "FAIL_REGULAR_EXPRESSION", DumpRegExToJsonArray(testProperties.ErrorRegularExpressions))); } + if (!testProperties.SkipRegularExpressions.empty()) { + properties.append(DumpCTestProperty( + "SKIP_REGULAR_EXPRESSION", + DumpRegExToJsonArray(testProperties.SkipRegularExpressions))); + } if (!testProperties.FixturesCleanup.empty()) { properties.append(DumpCTestProperty( "FIXTURES_CLEANUP", DumpToJsonArray(testProperties.FixturesCleanup))); diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index f9ac1eb..65cf646 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -77,6 +77,7 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } std::int64_t retVal = this->TestProcess->GetExitValue(); bool forceFail = false; + bool forceSkip = false; bool skipped = false; bool outputTestErrorsToConsole = false; if (!this->TestProperties->RequiredRegularExpressions.empty() && @@ -116,16 +117,34 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started) } } } + if (!this->TestProperties->SkipRegularExpressions.empty() && + this->FailedDependencies.empty()) { + for (auto& skip : this->TestProperties->SkipRegularExpressions) { + if (skip.first.find(this->ProcessOutput)) { + reason = "Skip regular expression found in output."; + reason += " Regex=["; + reason += skip.second; + reason += "]"; + forceSkip = true; + break; + } + } + } std::ostringstream outputStream; if (res == cmProcess::State::Exited) { bool success = !forceFail && (retVal == 0 || !this->TestProperties->RequiredRegularExpressions.empty()); - if (this->TestProperties->SkipReturnCode >= 0 && - this->TestProperties->SkipReturnCode == retVal) { + if ((this->TestProperties->SkipReturnCode >= 0 && + this->TestProperties->SkipReturnCode == retVal) || + forceSkip) { this->TestResult.Status = cmCTestTestHandler::NOT_RUN; std::ostringstream s; - s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode; + if (forceSkip) { + s << "SKIP_REGULAR_EXPRESSION_MATCHED"; + } else { + s << "SKIP_RETURN_CODE=" << this->TestProperties->SkipReturnCode; + } this->TestResult.CompletionStatus = s.str(); cmCTestLog(this->CTest, HANDLER_OUTPUT, "***Skipped "); skipped = true; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 9916ca3..c2748e1 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -526,7 +526,7 @@ int cmCTestTestHandler::ProcessHandler() std::vector<cmCTestTestHandler::cmCTestTestResult> disabledTests; for (cmCTestTestResult const& ft : resultsSet) { - if (cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") || + if (cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_") || ft.CompletionStatus == "Disabled") { disabledTests.push_back(ft); } @@ -599,7 +599,7 @@ int cmCTestTestHandler::ProcessHandler() for (cmCTestTestResult const& ft : resultsSet) { if (ft.Status != cmCTestTestHandler::COMPLETED && - !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_RETURN_CODE=") && + !cmHasLiteralPrefix(ft.CompletionStatus, "SKIP_") && ft.CompletionStatus != "Disabled") { ofs << ft.TestCount << ":" << ft.Name << std::endl; auto testColor = cmCTest::Color::RED; @@ -2229,6 +2229,13 @@ bool cmCTestTestHandler::SetTestsProperties( rt.ErrorRegularExpressions.emplace_back(cr, cr); } } + if (key == "SKIP_REGULAR_EXPRESSION") { + std::vector<std::string> lval; + cmSystemTools::ExpandListArgument(val, lval); + for (std::string const& cr : lval) { + rt.SkipRegularExpressions.emplace_back(cr, cr); + } + } if (key == "PROCESSORS") { rt.Processors = atoi(val.c_str()); if (rt.Processors < 1) { diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 7f3f5e4..5bbc68e 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -118,6 +118,8 @@ public: std::vector<std::pair<cmsys::RegularExpression, std::string>> RequiredRegularExpressions; std::vector<std::pair<cmsys::RegularExpression, std::string>> + SkipRegularExpressions; + std::vector<std::pair<cmsys::RegularExpression, std::string>> TimeoutRegularExpressions; std::map<std::string, std::string> Measurements; bool IsInBasedOnREOptions; |