| 464 | } |
| 465 | |
| 466 | bool 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(); |
no test coverage detected