CTest: Check failed fixture dependencies before test command and args

This commit is contained in:
Craig Scott 2017-11-27 22:06:14 +11:00
parent b1d3fb7fba
commit fbe91dba6a
2 changed files with 11 additions and 3 deletions

View File

@ -432,8 +432,6 @@ bool cmCTestRunTest::StartTest(size_t total)
return false;
}
this->ComputeArguments();
std::vector<std::string>& args = this->TestProperties->Args;
this->TestResult.Properties = this->TestProperties;
this->TestResult.ExecutionTime = 0;
this->TestResult.CompressOutput = false;
@ -444,6 +442,10 @@ bool cmCTestRunTest::StartTest(size_t total)
this->TestResult.Name = this->TestProperties->Name;
this->TestResult.Path = this->TestProperties->Directory;
// Check for failed fixture dependencies before we even look at the command
// arguments because if we are not going to run the test, the command and
// its arguments are irrelevant. This matters for the case where a fixture
// dependency might be creating the executable we want to run.
if (!this->FailedDependencies.empty()) {
this->TestProcess = new cmProcess;
std::string msg = "Failed test dependencies:";
@ -459,6 +461,8 @@ bool cmCTestRunTest::StartTest(size_t total)
return false;
}
this->ComputeArguments();
std::vector<std::string>& args = this->TestProperties->Args;
if (args.size() >= 2 && args[1] == "NOT_AVAILABLE") {
this->TestProcess = new cmProcess;
std::string msg;

View File

@ -27,7 +27,11 @@ passTest(two) # 6
passTest(cleanupBar) # 7
passTest(three) # 8
failTest(setupFails) # 9
passTest(wontRun) # 10
# Special case, test executable always missing to verify fixture dependencies
# are checked before existence of test executable to be run
add_test(NAME wontRun COMMAND iDoNotExist) # 10
passTest(cyclicSetup) # 11
passTest(cyclicCleanup) # 12
passTest(cleanupUnused) # 13