From 79bb80fc1c96cc89dc46276b3e132a9fa8a8c459 Mon Sep 17 00:00:00 2001 From: Maksim Pelevin Date: Fri, 22 Jul 2022 10:08:56 +0300 Subject: [PATCH] Fuzzing is not stopped on timeout when symbolic execution is excluded #570 --- .../src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt | 2 +- .../src/main/kotlin/org/utbot/framework/plugin/api/TestFlow.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt index 9ff7cc09a7..c5b76a69b7 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt @@ -435,7 +435,7 @@ class UtBotSymbolicEngine( }) } fuzzedValues.forEach { values -> - if (System.currentTimeMillis() >= until) { + if (controller.job?.isActive == false || System.currentTimeMillis() >= until) { logger.info { "Fuzzing overtime: $methodUnderTest" } return@flow } diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestFlow.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestFlow.kt index ee12fd5893..2407407acd 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestFlow.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/plugin/api/TestFlow.kt @@ -62,7 +62,7 @@ class TestFlow internal constructor(block: TestFlow.() -> Unit) { isFuzzingEnabled -> { when (val value = if (isSymbolicEngineEnabled) (fuzzingValue * generationTimeout).toLong() else generationTimeout) { 0L -> engine.traverse() - generationTimeout -> engine.fuzzing() + generationTimeout -> engine.fuzzing(System.currentTimeMillis() + value) else -> flowOf( engine.fuzzing(System.currentTimeMillis() + value), engine.traverse()