MCPcopy Create free account
hub / github.com/Kitware/CMake / ProcessOptions

Method ProcessOptions

Source/CTest/cmCTestTestHandler.cxx:466–529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466bool cmCTestTestHandler::ProcessOptions()
467{
468 // Update internal data structure from generic one
469 this->SetTestsToRunInformation(this->TestOptions.TestsToRunInformation);
470 if (this->TestOptions.ScheduleRandom) {
471 this->CTest->SetScheduleType("Random");
472 }
473 if (auto repeat = this->Repeat) {
474 cmsys::RegularExpression repeatRegex(
475 "^(UNTIL_FAIL|UNTIL_PASS|AFTER_TIMEOUT):([0-9]+)$");
476 if (repeatRegex.find(*repeat)) {
477 std::string const& count = repeatRegex.match(2);
478 unsigned long n = 1;
479 cmStrToULong(count, &n); // regex guarantees success
480 this->RepeatCount = static_cast<int>(n);
481 if (this->RepeatCount > 1) {
482 std::string const& mode = repeatRegex.match(1);
483 if (mode == "UNTIL_FAIL") {
484 this->RepeatMode = cmCTest::Repeat::UntilFail;
485 } else if (mode == "UNTIL_PASS") {
486 this->RepeatMode = cmCTest::Repeat::UntilPass;
487 } else if (mode == "AFTER_TIMEOUT") {
488 this->RepeatMode = cmCTest::Repeat::AfterTimeout;
489 }
490 }
491 } else {
492 cmCTestLog(this->CTest, ERROR_MESSAGE,
493 "Repeat option invalid value: " << *repeat << std::endl);
494 return false;
495 }
496 }
497 if (auto parallelLevel = this->ParallelLevel) {
498 if (parallelLevel->empty()) {
499 // An empty value tells ctest to choose a default.
500 this->CTest->SetParallelLevel(cm::nullopt);
501 } else {
502 // A non-empty value must be a non-negative integer.
503 unsigned long plevel = 0;
504 if (!cmStrToULong(*parallelLevel, &plevel)) {
505 cmCTestLog(this->CTest, ERROR_MESSAGE,
506 "ParallelLevel invalid value: " << *parallelLevel
507 << std::endl);
508 return false;
509 }
510 this->CTest->SetParallelLevel(plevel);
511 }
512 }
513
514 if (this->TestOptions.StopOnFailure) {
515 this->CTest->SetStopOnFailure(true);
516 }
517
518 BuildLabelRE(this->TestOptions.LabelRegularExpression,
519 this->IncludeLabelRegularExpressions);
520 BuildLabelRE(this->TestOptions.ExcludeLabelRegularExpression,
521 this->ExcludeLabelRegularExpressions);
522 if (!this->TestOptions.IncludeRegularExpression.empty()) {
523 this->UseIncludeRegExp();

Callers 1

ProcessHandlerMethod · 0.95

Calls 11

UseIncludeRegExpMethod · 0.95
UseExcludeRegExpMethod · 0.95
cmStrToULongFunction · 0.85
BuildLabelREFunction · 0.85
SetScheduleTypeMethod · 0.80
SetStopOnFailureMethod · 0.80
findMethod · 0.45
matchMethod · 0.45
emptyMethod · 0.45
SetParallelLevelMethod · 0.45

Tested by

no test coverage detected