From a30b1de3b599b35ccdc44fad89079ce3f5b09111 Mon Sep 17 00:00:00 2001 From: Maksim Pelevin Date: Tue, 11 Oct 2022 13:11:46 +0300 Subject: [PATCH] Many similar sandboxed tests on sockets generated by Fuzzing and not minimized #1129 --- .../main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt | 9 +++++++++ 1 file changed, 9 insertions(+) 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 86083c30b3..f05479ff1d 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt @@ -103,6 +103,7 @@ import kotlinx.coroutines.job import kotlinx.coroutines.yield import org.utbot.framework.plugin.api.UtExecutionSuccess import org.utbot.framework.plugin.api.UtLambdaModel +import org.utbot.framework.plugin.api.UtSandboxFailure import org.utbot.framework.plugin.api.util.executable import org.utbot.fuzzer.toFuzzerType @@ -430,6 +431,7 @@ class UtBotSymbolicEngine( parameterNameMap = { index -> names?.getOrNull(index) } fuzzerType = { try { toFuzzerType(methodUnderTest.executable.genericParameterTypes[it]) } catch (_: Throwable) { null } } } + val errorStackTraceTracker = Trie(StackTraceElement::toString) val coveredInstructionTracker = Trie(Instruction::id) val coveredInstructionValues = linkedMapOf, List>() var attempts = 0 @@ -488,6 +490,13 @@ class UtBotSymbolicEngine( coveredInstructionValues[coverageKey] = values } else { logger.error { "Coverage is empty for $methodUnderTest with ${values.map { it.model }}" } + val result = concreteExecutionResult.result + if (result is UtSandboxFailure) { + val stackTraceElements = result.exception.stackTrace.reversed() + if (errorStackTraceTracker.add(stackTraceElements).count > 1) { + return@forEach + } + } } emit(