From 420e0cd6e05f68bff71347e1c634de8fb951a695 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Tue, 6 Aug 2019 19:24:48 -0400 Subject: [PATCH] Poll devices in parallel (#586) --- test_runner/src/main/kotlin/ftl/run/RunningDevices.kt | 2 ++ test_runner/src/main/kotlin/ftl/run/TestRunner.kt | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test_runner/src/main/kotlin/ftl/run/RunningDevices.kt b/test_runner/src/main/kotlin/ftl/run/RunningDevices.kt index b73ebb5a5e..5dd3642c3d 100644 --- a/test_runner/src/main/kotlin/ftl/run/RunningDevices.kt +++ b/test_runner/src/main/kotlin/ftl/run/RunningDevices.kt @@ -70,5 +70,7 @@ class RunningDevices(stopwatch: StopWatch, testExecutions: List) fun next(): RunningDevice? = devices.firstOrNull { it.complete.not() } + fun allRunning(): List = devices.filter { it.complete.not() } + fun allComplete(): Boolean = devices.all { it.complete } } diff --git a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt index 01bb1eab48..9edd717b4a 100644 --- a/test_runner/src/main/kotlin/ftl/run/TestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/TestRunner.kt @@ -289,8 +289,9 @@ object TestRunner { while (true) { if (matrices.map[matrixId]?.update(refreshedMatrix) == true) updateMatrixFile(matrices, args) - val nextDevice = runningDevices.next() ?: return - nextDevice.poll(refreshedMatrix) + runningDevices.allRunning().forEach { nextDevice -> + nextDevice.poll(refreshedMatrix) + } // Matrix has 0 or more devices (test executions) if (runningDevices.allComplete()) {