@@ -11,7 +11,6 @@ import org.utbot.api.exception.UtMockAssumptionViolatedException
11
11
import org.utbot.common.bracket
12
12
import org.utbot.common.debug
13
13
import org.utbot.engine.MockStrategy.NO_MOCKS
14
- import org.utbot.engine.greyboxfuzzer.GreyBoxFuzzer
15
14
import org.utbot.engine.pc.*
16
15
import org.utbot.engine.selectors.*
17
16
import org.utbot.engine.selectors.nurs.NonUniformRandomSearch
@@ -33,9 +32,8 @@ import org.utbot.framework.UtSettings.pathSelectorStepsLimit
33
32
import org.utbot.framework.UtSettings.pathSelectorType
34
33
import org.utbot.framework.UtSettings.processUnknownStatesDuringConcreteExecution
35
34
import org.utbot.framework.UtSettings.useDebugVisualization
36
- import org.utbot.framework.concrete.UtConcreteExecutionData
37
- import org.utbot.framework.concrete.UtConcreteExecutionResult
38
- import org.utbot.framework.concrete.UtExecutionInstrumentation
35
+ import org.utbot.framework.concrete.*
36
+ import org.utbot.framework.concrete.constructors.UtModelConstructor
39
37
import org.utbot.framework.plugin.api.*
40
38
import org.utbot.framework.plugin.api.Step
41
39
import org.utbot.framework.plugin.api.util.*
@@ -44,11 +42,14 @@ import org.utbot.framework.util.sootMethod
44
42
import org.utbot.fuzzer.*
45
43
import org.utbot.fuzzing.*
46
44
import org.utbot.fuzzing.utils.Trie
45
+ import org.utbot.greyboxfuzzer.GreyBoxFuzzer
46
+ import org.utbot.greyboxfuzzer.util.FuzzerUtModelConstructor
47
47
import org.utbot.instrumentation.ConcreteExecutor
48
48
import ru.vyarus.java.generics.resolver.context.GenericsInfoFactory
49
49
import soot.jimple.Stmt
50
50
import soot.tagkit.ParamNamesTag
51
51
import java.lang.reflect.Method
52
+ import java.util.*
52
53
import kotlin.system.measureTimeMillis
53
54
54
55
val logger = KotlinLogging .logger {}
@@ -330,7 +331,7 @@ class UtBotSymbolicEngine(
330
331
fun fuzzing (until : Long = Long .MAX_VALUE , transform : (JavaValueProvider ) -> JavaValueProvider = { it }) = flow {
331
332
val isFuzzable = methodUnderTest.parameters.all { classId ->
332
333
classId != Method ::class .java.id && // causes the instrumented process crash at invocation
333
- classId != Class ::class .java.id // causes java.lang.IllegalAccessException: java.lang.Class at sun.misc.Unsafe.allocateInstance(Native Method)
334
+ classId != Class ::class .java.id // causes java.lang.IllegalAccessException: java.lang.Class at sun.misc.Unsafe.allocateInstance(Native Method)
334
335
}
335
336
val hasMethodUnderTestParametersToFuzz = methodUnderTest.parameters.isNotEmpty()
336
337
if (! isFuzzable || ! hasMethodUnderTestParametersToFuzz && methodUnderTest.isStatic) {
@@ -422,13 +423,22 @@ class UtBotSymbolicEngine(
422
423
if (! isFuzzable) {
423
424
return @flow
424
425
}
426
+ val utModelConstructor = UtModelConstructor (IdentityHashMap ())
427
+ val fuzzerUtModelConstructor = FuzzerUtModelConstructor (
428
+ utModelConstructor::construct,
429
+ utModelConstructor::computeUnusedIdAndUpdate
430
+ )
425
431
426
432
try {
427
433
emitAll(
428
434
GreyBoxFuzzer (
429
- concreteExecutor.pathsToUserClasses,
430
- concreteExecutor.pathsToDependencyClasses,
431
435
methodUnderTest,
436
+ collectConstantsForGreyBoxFuzzer(methodUnderTest.sootMethod, utModelConstructor),
437
+ fuzzerUtModelConstructor,
438
+ FuzzerConcreteExecutor (
439
+ concreteExecutor.pathsToUserClasses,
440
+ concreteExecutor.pathsToDependencyClasses
441
+ )::execute,
432
442
timeBudget
433
443
).fuzz()
434
444
)
@@ -567,7 +577,7 @@ private fun ResolvedModels.constructStateForMethod(methodUnderTest: ExecutableId
567
577
return EnvironmentModels (thisInstanceBefore, paramsBefore, statics)
568
578
}
569
579
570
- private suspend fun ConcreteExecutor <UtConcreteExecutionResult , UtExecutionInstrumentation >.executeConcretely (
580
+ internal suspend fun ConcreteExecutor <UtConcreteExecutionResult , UtExecutionInstrumentation >.executeConcretely (
571
581
methodUnderTest : ExecutableId ,
572
582
stateBefore : EnvironmentModels ,
573
583
instrumentation : List <UtInstrumentation >
0 commit comments