CTest: Fix regression in handling of a RUN_SERIAL test that fails

Refactoring in commit v3.4.0-rc1~390^2~1 (cmCTestMultiProcessHandler:
Refactor RUN_SERIAL implementation, 2015-06-01) forgot to update a code
path for cleaning up after a failed RUN_SERIAL test.  This causes an
infinite loop after a RUN_SERIAL test fails.  Fix it and add a test.
This commit is contained in:
Brad King 2015-10-23 09:25:25 -04:00
parent 498db9b9bc
commit e61973e1ab
5 changed files with 31 additions and 5 deletions

View File

@ -198,6 +198,10 @@ void cmCTestMultiProcessHandler::UnlockResources(int index)
{ {
this->LockedResources.erase(*i); this->LockedResources.erase(*i);
} }
if (this->Properties[index]->RunSerial)
{
this->SerialTestRunning = false;
}
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -451,11 +455,6 @@ bool cmCTestMultiProcessHandler::CheckOutput()
this->WriteCheckpoint(test); this->WriteCheckpoint(test);
this->UnlockResources(test); this->UnlockResources(test);
this->RunningCount -= GetProcessorsUsed(test); this->RunningCount -= GetProcessorsUsed(test);
if (this->Properties[test]->RunSerial)
{
this->SerialTestRunning = false;
}
delete p; delete p;
} }
return true; return true;

View File

@ -78,6 +78,21 @@ endfunction()
run_LabelCount() run_LabelCount()
function(run_SerialFailed)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/SerialFailed)
set(RunCMake_TEST_NO_CLEAN 1)
file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" "
add_test(NoSuchCommand no_such_command)
set_tests_properties(NoSuchCommand PROPERTIES RUN_SERIAL ON)
add_test(Echo \"${CMAKE_COMMAND}\" -E echo \"EchoTest\")
")
run_cmake_command(SerialFailed ${CMAKE_CTEST_COMMAND} -V)
endfunction()
run_SerialFailed()
function(run_TestLoad name load) function(run_TestLoad name load)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad) set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestLoad)
set(RunCMake_TEST_NO_CLEAN 1) set(RunCMake_TEST_NO_CLEAN 1)

View File

@ -0,0 +1 @@
8

View File

@ -0,0 +1 @@
Unable to find executable: no_such_command

View File

@ -0,0 +1,10 @@
Could not find executable no_such_command
.*
2/2 Test #2: Echo ............................. Passed +[0-9.]+ sec
+
50% tests passed, 1 tests failed out of 2
+
Total Test time \(real\) = +[0-9.]+ sec
+
The following tests FAILED:
[ ]+1 - NoSuchCommand \(Not Run\)$