summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestMultiProcessHandler.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-09-09 15:11:38 (GMT)
committerBrad King <brad.king@kitware.com>2018-09-10 11:32:16 (GMT)
commit292ec157b67b5570d5bc2e00bba554cc157d9dae (patch)
tree47976098727357d9d9117ae3f320940ec8edd670 /Source/CTest/cmCTestMultiProcessHandler.h
parentf478fa633daeb1432805821adddc40730ffd283d (diff)
downloadCMake-292ec157b67b5570d5bc2e00bba554cc157d9dae.zip
CMake-292ec157b67b5570d5bc2e00bba554cc157d9dae.tar.gz
CMake-292ec157b67b5570d5bc2e00bba554cc157d9dae.tar.bz2
CTest: Fix --test-load regression
The `ctest --test-load` option is implemented in `StartNextTests` by not starting any tests when the load is too high and instead sleeping and then returning. Prior to commit v3.11.0-rc1~117^2 (CTest: Re-implement test process handling using libuv, 2017-12-10) our outer loop in `RunTests` would immediately call `StartNextTests` again. However, now the `uv_run` loop may simply terminate if there are no tests running because no events are left pending. Fix this by converting the sleep in `StartNextTests` into a libuv timer that it starts instead. This avoids leaving `uv_run` with no pending events. In the case that there are other running tests this also allows CTest to detect when they finish even if it during the wait period where we previously slept. This regression was not caught by the test suite because it only verified that we do not start new tests when the load was too high and not that we proceed to start tests when the load drops. Revise the test suite to cover both. Fixes: #18338
Diffstat (limited to 'Source/CTest/cmCTestMultiProcessHandler.h')
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h
index 203170e..07a5fe7 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.h
+++ b/Source/CTest/cmCTestMultiProcessHandler.h
@@ -12,6 +12,7 @@
#include <string>
#include <vector>
+#include "cmUVHandlePtr.h"
#include "cm_uv.h"
class cmCTest;
@@ -101,6 +102,8 @@ protected:
void EraseTest(int index);
void FinishTestProcess(cmCTestRunTest* runner, bool started);
+ static void OnTestLoadRetryCB(uv_timer_t* timer);
+
void RemoveTest(int index);
// Check if we need to resume an interrupted test set
void CheckResume();
@@ -135,7 +138,9 @@ protected:
std::vector<cmCTestTestHandler::cmCTestTestResult>* TestResults;
size_t ParallelLevel; // max number of process that can be run at once
unsigned long TestLoad;
+ unsigned long FakeLoadForTesting;
uv_loop_t Loop;
+ cm::uv_timer_ptr TestLoadRetryTimer;
cmCTestTestHandler* TestHandler;
cmCTest* CTest;
bool HasCycles;