From b9726de57858bcc29a58e0d4f0437a8936f048dc Mon Sep 17 00:00:00 2001 From: Egor Kulikov Date: Wed, 13 Dec 2023 17:14:33 +0300 Subject: [PATCH] Introduce utbot-usvm module and use it in contest (#2715) --- gradle.properties | 3 + settings.gradle.kts | 2 + .../utbot/framework}/fuzzer/IdGenerator.kt | 5 +- .../org/utbot/framework/plugin/api/Api.kt | 13 + .../utbot/framework/plugin/api/util/IdUtil.kt | 17 ++ .../framework/utils/UtilMethodProvider.kt | 258 ++++++++++++++++++ .../assemble/AssembleModelGeneratorTests.kt | 2 +- .../org/utbot/engine/UtBotSymbolicEngine.kt | 1 + .../utbot/framework/codegen/domain/Domain.kt | 2 +- .../domain/builtin/UtilMethodBuiltins.kt | 241 +--------------- .../codegen/domain/context/CgContext.kt | 2 +- .../codegen/domain/models/CgElement.kt | 16 +- .../codegen/renderer/CgRendererContext.kt | 2 +- .../codegen/renderer/UtilMethodRenderer.kt | 2 +- .../codegen/tree/CgMethodConstructor.kt | 14 +- .../codegen/tree/ConstructorUtils.kt | 41 +-- .../utbot/framework/codegen/util/DslUtil.kt | 6 - .../context/ConcreteExecutionContext.kt | 2 +- .../framework/context/JavaFuzzingContext.kt | 2 +- .../simple/SimpleJavaFuzzingContext.kt | 2 +- .../kotlin/org/utbot/fuzzer/FuzzedType.kt | 2 +- .../kotlin/org/utbot/fuzzer/FuzzedValue.kt | 4 +- .../kotlin/org/utbot/fuzzing/JavaLanguage.kt | 1 + .../org/utbot/fuzzing/providers/Arrays.kt | 2 +- .../utbot/fuzzing/providers/Collections.kt | 2 +- .../org/utbot/fuzzing/providers/Enums.kt | 2 +- .../org/utbot/fuzzing/providers/Objects.kt | 4 +- .../org/utbot/fuzzing/providers/Others.kt | 2 +- .../utbot/fuzzing/spring/GeneratedField.kt | 2 +- .../fuzzing/spring/SpringBeanValueProvider.kt | 2 +- .../utbot/fuzzing/spring/unit/InjectMocks.kt | 2 +- .../org/utbot/fuzzing/spring/unit/Mocks.kt | 2 +- .../utbot/fuzzing/spring/valid/ValidEntity.kt | 2 +- .../org/utbot/fuzzing/IdGeneratorTest.kt | 2 +- .../org/utbot/fuzzing/JavaFuzzingTest.kt | 20 +- utbot-junit-contest/build.gradle | 3 +- .../main/kotlin/org/utbot/contest/Contest.kt | 3 +- .../org/utbot/contest/ContestEstimator.kt | 9 +- .../org/utbot/contest/usvm/ContestUsvm.kt | 17 +- ...SpringIntegrationTestJavaFuzzingContext.kt | 2 +- utbot-usvm/build.gradle.kts | 37 +++ .../utbot}/usvm/converter/ConverterUtils.kt | 2 +- .../usvm/converter/InstructionIdProvider.kt | 2 +- .../converter/JcToUtExecutionConverter.kt | 18 +- .../usvm/converter/JcToUtModelConverter.kt | 5 +- .../converter/UTestInstToUtModelConverter.kt | 6 +- .../converter/UTestValueDescriptorUtils.kt | 2 +- .../utbot}/usvm/converter/UtUsvmExecution.kt | 2 +- .../kotlin/org/utbot}/usvm/jc/JcContainer.kt | 6 +- .../kotlin/org/utbot}/usvm/jc/JcExecution.kt | 2 +- .../org/utbot}/usvm/jc/JcTestExecutor.kt | 6 +- .../usvm/jc/JcTestExecutorDecoderApi.kt | 2 +- 52 files changed, 424 insertions(+), 384 deletions(-) rename {utbot-java-fuzzing/src/main/kotlin/org/utbot => utbot-framework-api/src/main/kotlin/org/utbot/framework}/fuzzer/IdGenerator.kt (94%) create mode 100644 utbot-framework-api/src/main/kotlin/org/utbot/framework/utils/UtilMethodProvider.kt create mode 100644 utbot-usvm/build.gradle.kts rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/ConverterUtils.kt (99%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/InstructionIdProvider.kt (91%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/JcToUtExecutionConverter.kt (97%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/JcToUtModelConverter.kt (98%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/UTestInstToUtModelConverter.kt (99%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/UTestValueDescriptorUtils.kt (97%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/converter/UtUsvmExecution.kt (98%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/jc/JcContainer.kt (95%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/jc/JcExecution.kt (96%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/jc/JcTestExecutor.kt (99%) rename {utbot-junit-contest/src/main/kotlin/org/utbot/contest => utbot-usvm/src/main/kotlin/org/utbot}/usvm/jc/JcTestExecutorDecoderApi.kt (99%) diff --git a/gradle.properties b/gradle.properties index c0cfbf7062..5034b34b1b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -104,6 +104,9 @@ springVersion=5.3.28 springBootVersion=2.7.13 springSecurityVersion=5.8.5 +approximationsVersion=bfce4eedde +usvmVersion=72924ad + # configuration for build server # # the following options are passed to gradle command explicitly (see appropriate workflow): diff --git a/settings.gradle.kts b/settings.gradle.kts index 38c5173f3b..0f9c6937b3 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -35,6 +35,8 @@ include("utbot-junit-contest") include("utbot-analytics") include("utbot-analytics-torch") +include("utbot-usvm") + include("utbot-cli") include("utbot-api") diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/IdGenerator.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/fuzzer/IdGenerator.kt similarity index 94% rename from utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/IdGenerator.kt rename to utbot-framework-api/src/main/kotlin/org/utbot/framework/fuzzer/IdGenerator.kt index 1d66dcfef5..1447694569 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/IdGenerator.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/fuzzer/IdGenerator.kt @@ -1,6 +1,5 @@ -package org.utbot.fuzzer +package org.utbot.framework.fuzzer -import org.utbot.framework.plugin.api.UtModel import java.util.* import java.util.concurrent.atomic.AtomicInteger @@ -80,5 +79,3 @@ class ReferencePreservingIntIdGenerator(lowerBound: Int = DEFAULT_LOWER_BOUND) : const val DEFAULT_LOWER_BOUND: Int = 1500_000_000 } } - -fun UtModel.fuzzed(block: FuzzedValue.() -> Unit = {}): FuzzedValue = FuzzedValue(this).apply(block) \ No newline at end of file diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt index 6b5c7480f3..6f09839f51 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/Api.kt @@ -1201,6 +1201,19 @@ class BuiltinClassId( } } +class CgClassId( + name: String, + elementClassId: ClassId? = null, + override val typeParameters: TypeParameters = TypeParameters(), + override val isNullable: Boolean = true, +) : ClassId(name, elementClassId) { + constructor( + classId: ClassId, + typeParameters: TypeParameters = TypeParameters(), + isNullable: Boolean = true, + ) : this(classId.name, classId.elementClassId, typeParameters, isNullable) +} + /** * Field id. Contains field name. * diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt index 4eb298e64a..908e2a8ca5 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt @@ -589,6 +589,23 @@ val ExecutableId.isMethod: Boolean val ExecutableId.isConstructor: Boolean get() = this is ConstructorId +fun arrayTypeOf(elementType: ClassId, isNullable: Boolean = false): ClassId { + val arrayIdName = "[${elementType.arrayLikeName}" + return when (elementType) { + is BuiltinClassId -> BuiltinClassId( + canonicalName = "${elementType.canonicalName}[]", + simpleName = "${elementType.simpleName}[]", + elementClassId = elementType, + isNullable = isNullable + ) + else -> ClassId( + name = arrayIdName, + elementClassId = elementType, + isNullable = isNullable + ) + } +} + /** * Construct MethodId */ diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/utils/UtilMethodProvider.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/utils/UtilMethodProvider.kt new file mode 100644 index 0000000000..dbe881be8f --- /dev/null +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/utils/UtilMethodProvider.kt @@ -0,0 +1,258 @@ +package org.utbot.framework.utils + +import org.utbot.framework.plugin.api.BuiltinClassId +import org.utbot.framework.plugin.api.BuiltinConstructorId +import org.utbot.framework.plugin.api.BuiltinMethodId +import org.utbot.framework.plugin.api.CgClassId +import org.utbot.framework.plugin.api.ClassId +import org.utbot.framework.plugin.api.MethodId +import org.utbot.framework.plugin.api.util.arrayTypeOf +import org.utbot.framework.plugin.api.util.baseStreamClassId +import org.utbot.framework.plugin.api.util.booleanClassId +import org.utbot.framework.plugin.api.util.builtinConstructorId +import org.utbot.framework.plugin.api.util.classClassId +import org.utbot.framework.plugin.api.util.id +import org.utbot.framework.plugin.api.util.intClassId +import org.utbot.framework.plugin.api.util.objectArrayClassId +import org.utbot.framework.plugin.api.util.objectClassId +import org.utbot.framework.plugin.api.util.stringClassId +import org.utbot.framework.plugin.api.util.voidClassId +import sun.misc.Unsafe +import java.lang.invoke.MethodHandles +import java.lang.invoke.MethodType +import java.lang.reflect.Method + +/** + * Set of ids of all possible util methods for a given class. + * + * The class may actually not have some of these methods if they + * are not required in the process of code generation (this is the case for [TestClassUtilMethodProvider]). + */ +abstract class UtilMethodProvider(val utilClassId: ClassId) { + val utilMethodIds: Set + get() = setOf( + getUnsafeInstanceMethodId, + createInstanceMethodId, + createArrayMethodId, + setFieldMethodId, + setStaticFieldMethodId, + getFieldValueMethodId, + getStaticFieldValueMethodId, + getEnumConstantByNameMethodId, + deepEqualsMethodId, + arraysDeepEqualsMethodId, + iterablesDeepEqualsMethodId, + streamsDeepEqualsMethodId, + mapsDeepEqualsMethodId, + hasCustomEqualsMethodId, + getArrayLengthMethodId, + consumeBaseStreamMethodId, + buildStaticLambdaMethodId, + buildLambdaMethodId, + getLookupInMethodId, + getLambdaCapturedArgumentTypesMethodId, + getLambdaCapturedArgumentValuesMethodId, + getInstantiatedMethodTypeMethodId, + getLambdaMethodMethodId, + getSingleAbstractMethodMethodId + ) + + val getUnsafeInstanceMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getUnsafeInstance", + returnType = Unsafe::class.id, + ) + + /** + * Method that creates instance using Unsafe + */ + val createInstanceMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "createInstance", + returnType = CgClassId(objectClassId, isNullable = true), + arguments = arrayOf(stringClassId) + ) + + val createArrayMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "createArray", + returnType = Array::class.id, + arguments = arrayOf(stringClassId, intClassId, Array::class.id) + ) + + val setFieldMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "setField", + returnType = voidClassId, + arguments = arrayOf(objectClassId, stringClassId, stringClassId, objectClassId) + ) + + val setStaticFieldMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "setStaticField", + returnType = voidClassId, + arguments = arrayOf(Class::class.id, stringClassId, objectClassId) + ) + + val getFieldValueMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getFieldValue", + returnType = objectClassId, + arguments = arrayOf(objectClassId, stringClassId, stringClassId) + ) + + val getStaticFieldValueMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getStaticFieldValue", + returnType = objectClassId, + arguments = arrayOf(Class::class.id, stringClassId) + ) + + val getEnumConstantByNameMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getEnumConstantByName", + returnType = objectClassId, + arguments = arrayOf(Class::class.id, stringClassId) + ) + + val deepEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "deepEquals", + returnType = booleanClassId, + arguments = arrayOf(objectClassId, objectClassId) + ) + + val arraysDeepEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "arraysDeepEquals", + returnType = booleanClassId, + arguments = arrayOf(objectClassId, objectClassId) + ) + + val iterablesDeepEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "iterablesDeepEquals", + returnType = booleanClassId, + arguments = arrayOf(java.lang.Iterable::class.id, java.lang.Iterable::class.id) + ) + + val streamsDeepEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "streamsDeepEquals", + returnType = booleanClassId, + arguments = arrayOf(java.util.stream.BaseStream::class.id, java.util.stream.BaseStream::class.id) + ) + + val mapsDeepEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "mapsDeepEquals", + returnType = booleanClassId, + arguments = arrayOf(java.util.Map::class.id, java.util.Map::class.id) + ) + + val hasCustomEqualsMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "hasCustomEquals", + returnType = booleanClassId, + arguments = arrayOf(Class::class.id) + ) + + val getArrayLengthMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getArrayLength", + returnType = intClassId, + arguments = arrayOf(objectClassId) + ) + + val consumeBaseStreamMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "consumeBaseStream", + returnType = voidClassId, + arguments = arrayOf(baseStreamClassId) + ) + + val buildStaticLambdaMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "buildStaticLambda", + returnType = objectClassId, + arguments = arrayOf( + classClassId, + classClassId, + stringClassId, + arrayTypeOf(capturedArgumentClassId) + ) + ) + + val buildLambdaMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "buildLambda", + returnType = objectClassId, + arguments = arrayOf( + classClassId, + classClassId, + stringClassId, + objectClassId, + arrayTypeOf(capturedArgumentClassId) + ) + ) + + val getLookupInMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getLookupIn", + returnType = MethodHandles.Lookup::class.id, + arguments = arrayOf(classClassId) + ) + + val getLambdaCapturedArgumentTypesMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getLambdaCapturedArgumentTypes", + returnType = arrayTypeOf(classClassId), + arguments = arrayOf(arrayTypeOf(capturedArgumentClassId)) + ) + + val getLambdaCapturedArgumentValuesMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getLambdaCapturedArgumentValues", + returnType = objectArrayClassId, + arguments = arrayOf(arrayTypeOf(capturedArgumentClassId)) + ) + + val getInstantiatedMethodTypeMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getInstantiatedMethodType", + returnType = MethodType::class.id, + arguments = arrayOf(Method::class.id, arrayTypeOf(classClassId)) + ) + + val getLambdaMethodMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getLambdaMethod", + returnType = Method::class.id, + arguments = arrayOf(classClassId, stringClassId) + ) + + val getSingleAbstractMethodMethodId: MethodId + get() = utilClassId.utilMethodId( + name = "getSingleAbstractMethod", + returnType = java.lang.reflect.Method::class.id, + arguments = arrayOf(classClassId) + ) + + val capturedArgumentClassId: BuiltinClassId + get() = BuiltinClassId( + canonicalName = "${utilClassId.name}.CapturedArgument", + simpleName = "CapturedArgument" + ) + + val capturedArgumentConstructorId: BuiltinConstructorId + get() = builtinConstructorId(capturedArgumentClassId, classClassId, objectClassId) +} + +internal fun ClassId.utilMethodId( + name: String, + returnType: ClassId, + vararg arguments: ClassId, + // usually util methods are static, so this argument is true by default + isStatic: Boolean = true +): MethodId = + BuiltinMethodId(this, name, returnType, arguments.toList(), isStatic = isStatic) diff --git a/utbot-framework-test/src/test/kotlin/org/utbot/framework/assemble/AssembleModelGeneratorTests.kt b/utbot-framework-test/src/test/kotlin/org/utbot/framework/assemble/AssembleModelGeneratorTests.kt index 9e7274dcdc..c2bee2ab8d 100644 --- a/utbot-framework-test/src/test/kotlin/org/utbot/framework/assemble/AssembleModelGeneratorTests.kt +++ b/utbot-framework-test/src/test/kotlin/org/utbot/framework/assemble/AssembleModelGeneratorTests.kt @@ -37,7 +37,6 @@ import org.utbot.examples.assemble.DefaultFieldWithDirectAccessor import org.utbot.examples.assemble.DefaultFieldWithSetter import org.utbot.examples.assemble.DefaultPackagePrivateField import org.utbot.examples.assemble.StaticField -import org.utbot.framework.codegen.tree.arrayTypeOf import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.FieldId @@ -50,6 +49,7 @@ import org.utbot.framework.plugin.api.UtNullModel import org.utbot.framework.plugin.api.UtPrimitiveModel import org.utbot.framework.plugin.api.util.UtContext import org.utbot.framework.plugin.api.util.UtContext.Companion.setUtContext +import org.utbot.framework.plugin.api.util.arrayTypeOf import org.utbot.framework.plugin.api.util.executableId import org.utbot.framework.plugin.api.util.id import org.utbot.framework.plugin.api.util.intArrayClassId 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 3423b4f3a3..49ec333e76 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/engine/UtBotSymbolicEngine.kt @@ -35,6 +35,7 @@ import org.utbot.framework.UtSettings.useDebugVisualization import org.utbot.framework.context.ApplicationContext import org.utbot.framework.context.ConcreteExecutionContext import org.utbot.framework.context.ConcreteExecutionContext.FuzzingContextParams +import org.utbot.framework.fuzzer.ReferencePreservingIntIdGenerator import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.Step import org.utbot.framework.plugin.api.util.* diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt index 622c3eb534..dfe8e2be57 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/Domain.kt @@ -3,9 +3,9 @@ package org.utbot.framework.codegen.domain import org.utbot.framework.DEFAULT_EXECUTION_TIMEOUT_IN_INSTRUMENTED_PROCESS_MS import org.utbot.framework.codegen.domain.builtin.mockitoClassId import org.utbot.framework.codegen.domain.builtin.ongoingStubbingClassId -import org.utbot.framework.codegen.domain.models.CgClassId import org.utbot.framework.codegen.tree.argumentsClassId import org.utbot.framework.plugin.api.BuiltinClassId +import org.utbot.framework.plugin.api.CgClassId import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodeGenerationSettingBox import org.utbot.framework.plugin.api.CodeGenerationSettingItem diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/builtin/UtilMethodBuiltins.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/builtin/UtilMethodBuiltins.kt index 9dc6b0f1b6..e87b580b18 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/builtin/UtilMethodBuiltins.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/builtin/UtilMethodBuiltins.kt @@ -2,259 +2,20 @@ package org.utbot.framework.codegen.domain.builtin import org.mockito.MockitoAnnotations import org.utbot.framework.codegen.domain.MockitoStaticMocking -import org.utbot.framework.codegen.domain.models.CgClassId import org.utbot.framework.codegen.renderer.utilMethodTextById -import org.utbot.framework.codegen.tree.arrayTypeOf -import org.utbot.framework.codegen.tree.utilMethodId import org.utbot.framework.codegen.tree.ututils.UtilClassKind.Companion.PACKAGE_DELIMITER import org.utbot.framework.codegen.tree.ututils.UtilClassKind.Companion.UT_UTILS_BASE_PACKAGE_NAME import org.utbot.framework.plugin.api.BuiltinClassId -import org.utbot.framework.plugin.api.BuiltinConstructorId import org.utbot.framework.plugin.api.BuiltinMethodId import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.MethodId -import org.utbot.framework.plugin.api.util.baseStreamClassId -import org.utbot.framework.plugin.api.util.booleanClassId -import org.utbot.framework.plugin.api.util.builtinConstructorId -import org.utbot.framework.plugin.api.util.classClassId import org.utbot.framework.plugin.api.util.id -import org.utbot.framework.plugin.api.util.intClassId import org.utbot.framework.plugin.api.util.jClass -import org.utbot.framework.plugin.api.util.objectArrayClassId import org.utbot.framework.plugin.api.util.objectClassId -import org.utbot.framework.plugin.api.util.stringClassId import org.utbot.framework.plugin.api.util.voidClassId -import sun.misc.Unsafe -import java.lang.invoke.MethodHandles -import java.lang.invoke.MethodType -import java.lang.reflect.Method +import org.utbot.framework.utils.UtilMethodProvider -/** - * Set of ids of all possible util methods for a given class. - * - * The class may actually not have some of these methods if they - * are not required in the process of code generation (this is the case for [TestClassUtilMethodProvider]). - */ -abstract class UtilMethodProvider(val utilClassId: ClassId) { - val utilMethodIds: Set - get() = setOf( - getUnsafeInstanceMethodId, - createInstanceMethodId, - createArrayMethodId, - setFieldMethodId, - setStaticFieldMethodId, - getFieldValueMethodId, - getStaticFieldValueMethodId, - getEnumConstantByNameMethodId, - deepEqualsMethodId, - arraysDeepEqualsMethodId, - iterablesDeepEqualsMethodId, - streamsDeepEqualsMethodId, - mapsDeepEqualsMethodId, - hasCustomEqualsMethodId, - getArrayLengthMethodId, - consumeBaseStreamMethodId, - buildStaticLambdaMethodId, - buildLambdaMethodId, - getLookupInMethodId, - getLambdaCapturedArgumentTypesMethodId, - getLambdaCapturedArgumentValuesMethodId, - getInstantiatedMethodTypeMethodId, - getLambdaMethodMethodId, - getSingleAbstractMethodMethodId - ) - - val getUnsafeInstanceMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getUnsafeInstance", - returnType = Unsafe::class.id, - ) - - /** - * Method that creates instance using Unsafe - */ - val createInstanceMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "createInstance", - returnType = CgClassId(objectClassId, isNullable = true), - arguments = arrayOf(stringClassId) - ) - - val createArrayMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "createArray", - returnType = Array::class.id, - arguments = arrayOf(stringClassId, intClassId, Array::class.id) - ) - - val setFieldMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "setField", - returnType = voidClassId, - arguments = arrayOf(objectClassId, stringClassId, stringClassId, objectClassId) - ) - - val setStaticFieldMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "setStaticField", - returnType = voidClassId, - arguments = arrayOf(Class::class.id, stringClassId, objectClassId) - ) - - val getFieldValueMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getFieldValue", - returnType = objectClassId, - arguments = arrayOf(objectClassId, stringClassId, stringClassId) - ) - - val getStaticFieldValueMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getStaticFieldValue", - returnType = objectClassId, - arguments = arrayOf(Class::class.id, stringClassId) - ) - - val getEnumConstantByNameMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getEnumConstantByName", - returnType = objectClassId, - arguments = arrayOf(Class::class.id, stringClassId) - ) - - val deepEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "deepEquals", - returnType = booleanClassId, - arguments = arrayOf(objectClassId, objectClassId) - ) - - val arraysDeepEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "arraysDeepEquals", - returnType = booleanClassId, - arguments = arrayOf(objectClassId, objectClassId) - ) - - val iterablesDeepEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "iterablesDeepEquals", - returnType = booleanClassId, - arguments = arrayOf(java.lang.Iterable::class.id, java.lang.Iterable::class.id) - ) - - val streamsDeepEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "streamsDeepEquals", - returnType = booleanClassId, - arguments = arrayOf(java.util.stream.BaseStream::class.id, java.util.stream.BaseStream::class.id) - ) - - val mapsDeepEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "mapsDeepEquals", - returnType = booleanClassId, - arguments = arrayOf(java.util.Map::class.id, java.util.Map::class.id) - ) - - val hasCustomEqualsMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "hasCustomEquals", - returnType = booleanClassId, - arguments = arrayOf(Class::class.id) - ) - - val getArrayLengthMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getArrayLength", - returnType = intClassId, - arguments = arrayOf(objectClassId) - ) - - val consumeBaseStreamMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "consumeBaseStream", - returnType = voidClassId, - arguments = arrayOf(baseStreamClassId) - ) - - val buildStaticLambdaMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "buildStaticLambda", - returnType = objectClassId, - arguments = arrayOf( - classClassId, - classClassId, - stringClassId, - arrayTypeOf(capturedArgumentClassId) - ) - ) - - val buildLambdaMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "buildLambda", - returnType = objectClassId, - arguments = arrayOf( - classClassId, - classClassId, - stringClassId, - objectClassId, - arrayTypeOf(capturedArgumentClassId) - ) - ) - - val getLookupInMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getLookupIn", - returnType = MethodHandles.Lookup::class.id, - arguments = arrayOf(classClassId) - ) - - val getLambdaCapturedArgumentTypesMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getLambdaCapturedArgumentTypes", - returnType = arrayTypeOf(classClassId), - arguments = arrayOf(arrayTypeOf(capturedArgumentClassId)) - ) - - val getLambdaCapturedArgumentValuesMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getLambdaCapturedArgumentValues", - returnType = objectArrayClassId, - arguments = arrayOf(arrayTypeOf(capturedArgumentClassId)) - ) - - val getInstantiatedMethodTypeMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getInstantiatedMethodType", - returnType = MethodType::class.id, - arguments = arrayOf(Method::class.id, arrayTypeOf(classClassId)) - ) - - val getLambdaMethodMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getLambdaMethod", - returnType = Method::class.id, - arguments = arrayOf(classClassId, stringClassId) - ) - - val getSingleAbstractMethodMethodId: MethodId - get() = utilClassId.utilMethodId( - name = "getSingleAbstractMethod", - returnType = java.lang.reflect.Method::class.id, - arguments = arrayOf(classClassId) - ) - - val capturedArgumentClassId: BuiltinClassId - get() = BuiltinClassId( - canonicalName = "${utilClassId.name}.CapturedArgument", - simpleName = "CapturedArgument" - ) - - val capturedArgumentConstructorId: BuiltinConstructorId - get() = builtinConstructorId(capturedArgumentClassId, classClassId, objectClassId) -} /** * This provider represents an util class file that is generated and put into the user's test module. diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt index ada8bf2113..7051b84ad4 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/context/CgContext.kt @@ -20,7 +20,6 @@ import org.utbot.framework.codegen.domain.UtModelWrapper import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.builtin.TestClassUtilMethodProvider import org.utbot.framework.codegen.domain.builtin.UtilClassFileMethodProvider -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider import org.utbot.framework.codegen.domain.models.* import org.utbot.framework.codegen.services.access.Block import org.utbot.framework.codegen.tree.EnvironmentFieldStateCache @@ -39,6 +38,7 @@ import org.utbot.framework.plugin.api.util.id import org.utbot.framework.plugin.api.util.isCheckedException import org.utbot.framework.plugin.api.util.isSubtypeOf import org.utbot.framework.plugin.api.util.jClass +import org.utbot.framework.utils.UtilMethodProvider typealias CgContextProperties = MutableDynamicProperties typealias CgContextProperty = DynamicProperty diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgElement.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgElement.kt index c143347adc..4d3ee7c675 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgElement.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/domain/models/CgElement.kt @@ -9,6 +9,7 @@ import org.utbot.framework.codegen.renderer.auxiliaryClassTextById import org.utbot.framework.codegen.renderer.utilMethodTextById import org.utbot.framework.codegen.tree.VisibilityModifier import org.utbot.framework.plugin.api.BuiltinClassId +import org.utbot.framework.plugin.api.CgClassId import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ConstructorId import org.utbot.framework.plugin.api.DocClassLinkStmt @@ -1034,17 +1035,4 @@ object CgEmptyLine : CgStatement data class CgExceptionHandler( val exception: CgVariable, val statements: List -) - -class CgClassId( - name: String, - elementClassId: ClassId? = null, - override val typeParameters: TypeParameters = TypeParameters(), - override val isNullable: Boolean = true, -) : ClassId(name, elementClassId) { - constructor( - classId: ClassId, - typeParameters: TypeParameters = TypeParameters(), - isNullable: Boolean = true, - ) : this(classId.name, classId.elementClassId, typeParameters, isNullable) -} +) \ No newline at end of file diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/CgRendererContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/CgRendererContext.kt index 0a4a82d0a1..c3276b9b22 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/CgRendererContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/CgRendererContext.kt @@ -1,6 +1,5 @@ package org.utbot.framework.codegen.renderer -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider import org.utbot.framework.codegen.domain.builtin.selectUtilClassId import org.utbot.framework.codegen.domain.context.CgContext import org.utbot.framework.codegen.tree.ututils.UtilClassKind @@ -10,6 +9,7 @@ import org.utbot.framework.codegen.services.language.CgLanguageAssistant import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.MethodId import org.utbot.framework.plugin.api.MockFramework +import org.utbot.framework.utils.UtilMethodProvider /** * Information from [CgContext] that is relevant for the renderer. diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/UtilMethodRenderer.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/UtilMethodRenderer.kt index 629647b80a..8052b907f1 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/UtilMethodRenderer.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/renderer/UtilMethodRenderer.kt @@ -2,7 +2,6 @@ package org.utbot.framework.codegen.renderer import org.utbot.framework.codegen.domain.StaticImport import org.utbot.framework.codegen.domain.builtin.TestClassUtilMethodProvider -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider import org.utbot.framework.codegen.domain.context.CgContextOwner import org.utbot.framework.codegen.tree.importIfNeeded import org.utbot.framework.plugin.api.ClassId @@ -11,6 +10,7 @@ import org.utbot.framework.plugin.api.MethodId import org.utbot.framework.plugin.api.MockFramework import org.utbot.framework.plugin.api.util.fieldClassId import org.utbot.framework.plugin.api.util.id +import org.utbot.framework.utils.UtilMethodProvider import java.lang.invoke.CallSite import java.lang.invoke.LambdaMetafactory import java.lang.invoke.MethodHandle diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt index 17ad0b0718..fb1c7acb62 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/CgMethodConstructor.kt @@ -5,7 +5,6 @@ import org.utbot.common.WorkaroundReason import org.utbot.common.isStatic import org.utbot.common.workaround import org.utbot.framework.UtSettings -import org.utbot.framework.plugin.api.ArtificialError import org.utbot.framework.assemble.assemble import org.utbot.framework.codegen.domain.ForceStaticMocking import org.utbot.framework.codegen.domain.ParametrizedTestSource @@ -21,7 +20,6 @@ import org.utbot.framework.codegen.domain.context.CgContextOwner import org.utbot.framework.codegen.domain.models.AnnotationTarget import org.utbot.framework.codegen.domain.models.CgAllocateArray import org.utbot.framework.codegen.domain.models.CgArrayElementAccess -import org.utbot.framework.codegen.domain.models.CgClassId import org.utbot.framework.codegen.domain.models.CgDeclaration import org.utbot.framework.codegen.domain.models.CgDocumentationComment import org.utbot.framework.codegen.domain.models.CgEqualTo @@ -46,7 +44,13 @@ import org.utbot.framework.codegen.domain.models.CgStatement import org.utbot.framework.codegen.domain.models.CgStaticFieldAccess import org.utbot.framework.codegen.domain.models.CgTestMethod import org.utbot.framework.codegen.domain.models.CgTestMethodType -import org.utbot.framework.codegen.domain.models.CgTestMethodType.* +import org.utbot.framework.codegen.domain.models.CgTestMethodType.ARTIFICIAL +import org.utbot.framework.codegen.domain.models.CgTestMethodType.CRASH +import org.utbot.framework.codegen.domain.models.CgTestMethodType.FAILING +import org.utbot.framework.codegen.domain.models.CgTestMethodType.PARAMETRIZED +import org.utbot.framework.codegen.domain.models.CgTestMethodType.PASSED_EXCEPTION +import org.utbot.framework.codegen.domain.models.CgTestMethodType.SUCCESSFUL +import org.utbot.framework.codegen.domain.models.CgTestMethodType.TIMEOUT import org.utbot.framework.codegen.domain.models.CgTryCatch import org.utbot.framework.codegen.domain.models.CgTypeCast import org.utbot.framework.codegen.domain.models.CgValue @@ -76,8 +80,10 @@ import org.utbot.framework.codegen.util.nullLiteral import org.utbot.framework.codegen.util.resolve import org.utbot.framework.fields.ExecutionStateAnalyzer import org.utbot.framework.fields.FieldPath +import org.utbot.framework.plugin.api.ArtificialError import org.utbot.framework.plugin.api.BuiltinClassId import org.utbot.framework.plugin.api.BuiltinMethodId +import org.utbot.framework.plugin.api.CgClassId import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.ConstructorId @@ -112,7 +118,6 @@ import org.utbot.framework.plugin.api.UtReferenceModel import org.utbot.framework.plugin.api.UtSandboxFailure import org.utbot.framework.plugin.api.UtStaticMethodInstrumentation import org.utbot.framework.plugin.api.UtStreamConsumingFailure -import org.utbot.framework.plugin.api.UtSymbolicExecution import org.utbot.framework.plugin.api.UtTaintAnalysisFailure import org.utbot.framework.plugin.api.UtTimeoutException import org.utbot.framework.plugin.api.UtVoidModel @@ -161,7 +166,6 @@ import org.utbot.framework.plugin.api.util.stringClassId import org.utbot.framework.plugin.api.util.voidClassId import org.utbot.framework.plugin.api.util.wrapIfPrimitive import org.utbot.framework.util.isUnit -import org.utbot.fuzzer.UtFuzzedExecution import java.lang.reflect.InvocationTargetException import java.lang.reflect.ParameterizedType import java.security.AccessControlException diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/ConstructorUtils.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/ConstructorUtils.kt index 1bdb81af01..bb7bd6c343 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/ConstructorUtils.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/tree/ConstructorUtils.kt @@ -8,7 +8,6 @@ import org.utbot.framework.codegen.domain.builtin.setArrayElement import org.utbot.framework.codegen.domain.context.CgContextOwner import org.utbot.framework.codegen.domain.models.CgAllocateInitializedArray import org.utbot.framework.codegen.domain.models.CgArrayInitializer -import org.utbot.framework.codegen.domain.models.CgClassId import org.utbot.framework.codegen.domain.models.CgExpression import org.utbot.framework.codegen.domain.models.CgTypeCast import org.utbot.framework.codegen.domain.models.CgValue @@ -21,6 +20,7 @@ import org.utbot.framework.fields.FieldAccess import org.utbot.framework.fields.FieldPath import org.utbot.framework.plugin.api.BuiltinClassId import org.utbot.framework.plugin.api.BuiltinMethodId +import org.utbot.framework.plugin.api.CgClassId import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ConstructorId import org.utbot.framework.plugin.api.ExecutableId @@ -31,7 +31,7 @@ import org.utbot.framework.plugin.api.UtModel import org.utbot.framework.plugin.api.UtNullModel import org.utbot.framework.plugin.api.UtPrimitiveModel import org.utbot.framework.plugin.api.WildcardTypeParameter -import org.utbot.framework.plugin.api.util.arrayLikeName +import org.utbot.framework.plugin.api.util.arrayTypeOf import org.utbot.framework.plugin.api.util.booleanClassId import org.utbot.framework.plugin.api.util.builtinStaticMethodId import org.utbot.framework.plugin.api.util.byteClassId @@ -215,7 +215,7 @@ private val simpleNamesNotRequiringImports by lazy { findSimpleNamesNotRequiring /** * Some class names do not require imports, but may lead to simple names clash. - * For example, custom class [Compiler] may clash with [java.lang.Compiler]. + * For example, custom class `Compiler` may clash with [java.lang.Compiler]. */ private fun findSimpleNamesNotRequiringImports(): Set = Scene.v().classes @@ -332,31 +332,6 @@ internal fun newArrayOf(elementType: ClassId, values: List): CgAll internal fun arrayInitializer(arrayType: ClassId, elementType: ClassId, values: List): CgArrayInitializer = CgArrayInitializer(arrayType, elementType, values) - -/** - * For a given [elementType] returns a [ClassId] of an array with elements of this type. - * For example, for an id of `int` the result will be an id of `int[]`. - * - * @param elementType the element type of the returned array class id - * @param isNullable a flag whether returned array is nullable or not - */ -fun arrayTypeOf(elementType: ClassId, isNullable: Boolean = false): ClassId { - val arrayIdName = "[${elementType.arrayLikeName}" - return when (elementType) { - is BuiltinClassId -> BuiltinClassId( - canonicalName = "${elementType.canonicalName}[]", - simpleName = "${elementType.simpleName}[]", - elementClassId = elementType, - isNullable = isNullable - ) - else -> ClassId( - name = arrayIdName, - elementClassId = elementType, - isNullable = isNullable - ) - } -} - internal fun Class<*>.overridesEquals(): Boolean = when { // Object does not override equals @@ -476,16 +451,6 @@ internal infix fun UtModel.isNotDefaultValueOf(type: ClassId): Boolean = !this.i */ internal operator fun UtArrayModel.get(index: Int): UtModel = stores[index] ?: constModel - -internal fun ClassId.utilMethodId( - name: String, - returnType: ClassId, - vararg arguments: ClassId, - // usually util methods are static, so this argument is true by default - isStatic: Boolean = true -): MethodId = - BuiltinMethodId(this, name, returnType, arguments.toList(), isStatic = isStatic) - fun ClassId.toImport(): RegularImport = RegularImport(packageName, simpleNameWithEnclosingClasses) // Immutable collections utils diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/util/DslUtil.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/util/DslUtil.kt index fccce6706e..1f830a0612 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/util/DslUtil.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/util/DslUtil.kt @@ -1,13 +1,9 @@ package org.utbot.framework.codegen.util -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider import org.utbot.framework.codegen.domain.models.CgArrayElementAccess import org.utbot.framework.codegen.domain.models.CgDecrement import org.utbot.framework.codegen.domain.models.CgEqualTo import org.utbot.framework.codegen.domain.models.CgExpression -import org.utbot.framework.codegen.domain.models.CgGetClass -import org.utbot.framework.codegen.domain.models.CgGetJavaClass -import org.utbot.framework.codegen.domain.models.CgGetKotlinClass import org.utbot.framework.codegen.domain.models.CgGetLength import org.utbot.framework.codegen.domain.models.CgGreaterThan import org.utbot.framework.codegen.domain.models.CgIncrement @@ -15,8 +11,6 @@ import org.utbot.framework.codegen.domain.models.CgLessThan import org.utbot.framework.codegen.domain.models.CgLiteral import org.utbot.framework.codegen.domain.models.CgVariable import org.utbot.framework.codegen.tree.CgMethodConstructor -import org.utbot.framework.plugin.api.ClassId -import org.utbot.framework.plugin.api.CodegenLanguage import org.utbot.framework.plugin.api.util.booleanClassId import org.utbot.framework.plugin.api.util.byteClassId import org.utbot.framework.plugin.api.util.charClassId diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/context/ConcreteExecutionContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/context/ConcreteExecutionContext.kt index 387fb897d3..e0d7c360cf 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/context/ConcreteExecutionContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/context/ConcreteExecutionContext.kt @@ -1,11 +1,11 @@ package org.utbot.framework.context import org.utbot.engine.MockStrategy +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ConcreteContextLoadingResult import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.UtExecution -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.instrumentation.ConcreteExecutor import org.utbot.instrumentation.instrumentation.execution.UtConcreteExecutionResult import org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/context/JavaFuzzingContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/context/JavaFuzzingContext.kt index ee4f57acbf..f383b2c9b6 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/context/JavaFuzzingContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/context/JavaFuzzingContext.kt @@ -1,11 +1,11 @@ package org.utbot.framework.context +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.EnvironmentModels import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.UtModel -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzing.JavaValueProvider import org.utbot.instrumentation.instrumentation.execution.UtConcreteExecutionResult diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/context/simple/SimpleJavaFuzzingContext.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/context/simple/SimpleJavaFuzzingContext.kt index 8951c65d5e..fefed3bd7b 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/context/simple/SimpleJavaFuzzingContext.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/context/simple/SimpleJavaFuzzingContext.kt @@ -1,12 +1,12 @@ package org.utbot.framework.context.simple import org.utbot.framework.context.JavaFuzzingContext +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.EnvironmentModels import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.UtModel -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzing.JavaValueProvider import org.utbot.fuzzing.ValueProvider import org.utbot.fuzzing.defaultValueProviders diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedType.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedType.kt index 407777bb96..1fe47a142c 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedType.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedType.kt @@ -17,4 +17,4 @@ open class FuzzedType( override fun toString(): String { return "FuzzedType(classId=$classId, generics=${generics.map { it.classId }})" } -} \ No newline at end of file +} diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedValue.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedValue.kt index d5d4a6d7f2..fc10480079 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedValue.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzer/FuzzedValue.kt @@ -19,4 +19,6 @@ import org.utbot.framework.plugin.api.UtModel open class FuzzedValue( val model: UtModel, var summary: String? = null, -) \ No newline at end of file +) + +fun UtModel.fuzzed(block: FuzzedValue.() -> Unit = {}): FuzzedValue = FuzzedValue(this).apply(block) \ No newline at end of file diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/JavaLanguage.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/JavaLanguage.kt index f5278473c5..0dc668cc8c 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/JavaLanguage.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/JavaLanguage.kt @@ -1,6 +1,7 @@ package org.utbot.fuzzing import mu.KotlinLogging +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.Instruction diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Arrays.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Arrays.kt index e53d9888ba..b9bbba8018 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Arrays.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Arrays.kt @@ -1,11 +1,11 @@ package org.utbot.fuzzing.providers +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.UtArrayModel import org.utbot.framework.plugin.api.util.defaultValueModel import org.utbot.framework.plugin.api.util.isArray import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.* diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Collections.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Collections.kt index f408d4c563..3a00334d3c 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Collections.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Collections.kt @@ -1,11 +1,11 @@ package org.utbot.fuzzing.providers import com.google.common.reflect.TypeToken +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.util.* import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzer.jType import org.utbot.fuzzing.* diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Enums.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Enums.kt index d51800f002..d5c1de0a39 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Enums.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Enums.kt @@ -1,11 +1,11 @@ package org.utbot.fuzzing.providers +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.UtEnumConstantModel import org.utbot.framework.plugin.api.util.isEnum import org.utbot.framework.plugin.api.util.jClass import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt index 14d4abfb8a..7c7fd73773 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Objects.kt @@ -2,6 +2,8 @@ package org.utbot.fuzzing.providers import mu.KotlinLogging import org.utbot.framework.UtSettings +import org.utbot.framework.fuzzer.IdGenerator +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.ConstructorId import org.utbot.framework.plugin.api.FieldId @@ -26,8 +28,6 @@ import org.utbot.framework.plugin.api.util.method import org.utbot.framework.plugin.api.util.stringClassId import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Others.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Others.kt index f90bd06d6f..c86b3b8064 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Others.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/providers/Others.kt @@ -1,10 +1,10 @@ package org.utbot.fuzzing.providers +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.util.* import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.* import org.utbot.fuzzing.utils.hex diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/GeneratedField.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/GeneratedField.kt index 2f53347119..0d2033d983 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/GeneratedField.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/GeneratedField.kt @@ -3,6 +3,7 @@ package org.utbot.fuzzing.spring import mu.KotlinLogging import org.utbot.common.dynamicPropertiesOf import org.utbot.common.withValue +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.DirectFieldAccessId import org.utbot.framework.plugin.api.FieldId @@ -14,7 +15,6 @@ import org.utbot.framework.plugin.api.util.jClass import org.utbot.framework.plugin.api.util.replaceWithWrapperIfPrimitive import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/SpringBeanValueProvider.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/SpringBeanValueProvider.kt index 388ce45c7c..840822c50c 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/SpringBeanValueProvider.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/SpringBeanValueProvider.kt @@ -2,6 +2,7 @@ package org.utbot.fuzzing.spring import org.utbot.common.dynamicPropertiesOf import org.utbot.common.withValue +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.util.SpringModelUtils import org.utbot.framework.plugin.api.util.SpringModelUtils.persistMethodIdOrNull @@ -9,7 +10,6 @@ import org.utbot.framework.plugin.api.util.executableId import org.utbot.framework.plugin.api.util.jClass import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.* import org.utbot.fuzzing.providers.SPRING_BEAN_PROP diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt index ca439f29bc..59c6f6d1b1 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/InjectMocks.kt @@ -1,5 +1,6 @@ package org.utbot.fuzzing.spring.unit +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.UtCompositeModel @@ -9,7 +10,6 @@ import org.utbot.framework.plugin.api.util.isStatic import org.utbot.framework.plugin.api.util.jField import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/Mocks.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/Mocks.kt index 1c848981bf..203b24fd52 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/Mocks.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/unit/Mocks.kt @@ -2,6 +2,7 @@ package org.utbot.fuzzing.spring.unit import com.google.common.reflect.TypeResolver import mu.KotlinLogging +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.MethodId import org.utbot.framework.plugin.api.UtCompositeModel @@ -10,7 +11,6 @@ import org.utbot.framework.plugin.api.util.jClass import org.utbot.framework.plugin.api.util.method import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/valid/ValidEntity.kt b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/valid/ValidEntity.kt index 4acc0dce66..4a3b349639 100644 --- a/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/valid/ValidEntity.kt +++ b/utbot-java-fuzzing/src/main/kotlin/org/utbot/fuzzing/spring/valid/ValidEntity.kt @@ -2,6 +2,7 @@ package org.utbot.fuzzing.spring.valid import org.utbot.common.toDynamicProperties import org.utbot.common.withValue +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.MethodId @@ -24,7 +25,6 @@ import org.utbot.framework.plugin.api.util.jClass import org.utbot.framework.plugin.api.util.jField import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdGenerator import org.utbot.fuzzer.fuzzed import org.utbot.fuzzing.FuzzedDescription import org.utbot.fuzzing.JavaValueProvider diff --git a/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/IdGeneratorTest.kt b/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/IdGeneratorTest.kt index 98efebd2f4..34e36ac950 100644 --- a/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/IdGeneratorTest.kt +++ b/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/IdGeneratorTest.kt @@ -4,7 +4,7 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test -import org.utbot.fuzzer.ReferencePreservingIntIdGenerator +import org.utbot.framework.fuzzer.ReferencePreservingIntIdGenerator class IdGeneratorTest { private enum class Size { S, M, L, XL } diff --git a/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/JavaFuzzingTest.kt b/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/JavaFuzzingTest.kt index 09d853edb9..987b43c323 100644 --- a/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/JavaFuzzingTest.kt +++ b/utbot-java-fuzzing/src/test/kotlin/org/utbot/fuzzing/JavaFuzzingTest.kt @@ -1,30 +1,30 @@ package org.utbot.fuzzing -import kotlinx.coroutines.runBlocking -import kotlinx.coroutines.withTimeout -import org.junit.jupiter.api.Assertions.* +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertInstanceOf +import org.junit.jupiter.api.Assertions.assertNotEquals import org.junit.jupiter.api.Test +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.MethodId import org.utbot.framework.plugin.api.UtAssembleModel import org.utbot.framework.plugin.api.UtNullModel import org.utbot.framework.plugin.api.UtPrimitiveModel -import org.utbot.framework.plugin.api.util.* import org.utbot.framework.plugin.api.util.constructor.ValueConstructor +import org.utbot.framework.plugin.api.util.executableId +import org.utbot.framework.plugin.api.util.id +import org.utbot.framework.plugin.api.util.intClassId +import org.utbot.framework.plugin.api.util.stringClassId +import org.utbot.framework.plugin.api.util.voidClassId import org.utbot.fuzzer.FuzzedConcreteValue -import org.utbot.fuzzing.samples.DeepNested import org.utbot.fuzzer.FuzzedType import org.utbot.fuzzer.FuzzedValue -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzing.providers.NullValueProvider import org.utbot.fuzzing.samples.AccessibleObjects +import org.utbot.fuzzing.samples.DeepNested import org.utbot.fuzzing.samples.FailToGenerateListGeneric import org.utbot.fuzzing.samples.StringListHolder import org.utbot.fuzzing.samples.Stubs import org.utbot.fuzzing.utils.Trie -import java.lang.reflect.GenericArrayType -import java.lang.reflect.ParameterizedType -import java.lang.reflect.Type -import java.util.IdentityHashMap import java.util.concurrent.atomic.AtomicInteger import kotlin.reflect.jvm.javaMethod diff --git a/utbot-junit-contest/build.gradle b/utbot-junit-contest/build.gradle index 6e3d5474ce..0b9d5c0d8e 100644 --- a/utbot-junit-contest/build.gradle +++ b/utbot-junit-contest/build.gradle @@ -149,7 +149,7 @@ jacocoTestReport { dependencies { implementation project(":utbot-framework") implementation project(":utbot-analytics") - + implementation project(":utbot-usvm") implementation("org.unittestbot.soot:soot-utbot-fork:${sootVersion}") { exclude group:'com.google.guava', module:'guava' @@ -192,6 +192,7 @@ dependencies { fetchInstrumentationJar project(path: ':utbot-instrumentation', configuration: 'instrumentationArchive') + //TODO: currently unused; their jars should be added to resources/lib if we want to switch to USVM instrumentation approximations "$approximationsRepo:approximations:$approximationsVersion" usvmApproximationsApi "$usvmRepo:usvm-jvm-api:$usvmVersion" diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/Contest.kt b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/Contest.kt index 581a3dae0b..9382af1ece 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/Contest.kt +++ b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/Contest.kt @@ -48,7 +48,6 @@ import kotlinx.coroutines.newSingleThreadContext import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withTimeoutOrNull import org.utbot.contest.usvm.createJcContainer -import org.utbot.contest.usvm.jc.JcContainer import org.utbot.contest.usvm.runUsvmGeneration import org.utbot.framework.SummariesGenerationType import org.utbot.framework.codegen.domain.* @@ -60,6 +59,7 @@ import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.util.isSynthetic import org.utbot.framework.util.jimpleBody import org.utbot.summary.summarizeAll +import org.utbot.usvm.jc.JcContainer internal const val junitVersion = 4 private val logger = KotlinLogging.logger {} @@ -168,7 +168,6 @@ fun main(args: Array) { project = "Contest", cut, timeBudgetSec, - fuzzingRatio = 0.1, classpathString, runFromEstimator = false, expectedExceptions = ExpectedExceptionsForClass(), diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt index f77c408ea5..6f00634101 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt +++ b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/ContestEstimator.kt @@ -26,7 +26,6 @@ import org.utbot.contest.Paths.evosuiteReportFile import org.utbot.contest.Paths.jarsDir import org.utbot.contest.Paths.moduleTestDir import org.utbot.contest.Paths.outputDir -import org.utbot.contest.usvm.jc.JcContainer import org.utbot.contest.usvm.runUsvmGeneration import org.utbot.features.FeatureExtractorFactoryImpl import org.utbot.features.FeatureProcessorWithStatesRepetitionFactory @@ -38,6 +37,7 @@ import org.utbot.framework.plugin.api.util.withUtContext import org.utbot.framework.plugin.services.JdkInfoService import org.utbot.instrumentation.ConcreteExecutor import org.utbot.predictors.MLPredictorFactoryImpl +import org.utbot.usvm.jc.JcContainer import kotlin.math.min private val logger = KotlinLogging.logger {} @@ -311,7 +311,6 @@ interface Tool { project.name, cut, timeLimit, - fuzzingRatio, project.sootClasspathString, runFromEstimator = true, expectedExceptions = expectedExceptions, @@ -428,7 +427,7 @@ fun main(args: Array) { // very special case when you run your project directly from IntellijIDEA omitting command line arguments if (args.isEmpty()) { processedClassesThreshold = 9999 //change to change number of classes to run - val timeLimit = 20 // increase if you want to debug something + val timeLimit = 30 // increase if you want to debug something val fuzzingRatio = 0.1 // sets fuzzing ratio to total test generation // Uncomment it for debug purposes: @@ -448,8 +447,8 @@ fun main(args: Array) { // tools = listOf(Tool.EvoSuite) // config for SBST 2022 - methodFilter = null - projectFilter = listOf("fastjson-1.2.50", "guava-26.0", "seata-core-0.5.0", "spoon-core-7.0.0") + methodFilter = "com.alibaba.fastjson.asm.ByteVector.*" + projectFilter = listOf("fastjson-1.2.50") tools = listOf(mainTool) estimatorArgs = arrayOf( diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ContestUsvm.kt b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ContestUsvm.kt index 5c3cfbb669..40c281908d 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ContestUsvm.kt +++ b/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ContestUsvm.kt @@ -28,12 +28,6 @@ import org.utbot.common.info import org.utbot.common.measureTime import org.utbot.contest.* import org.utbot.contest.junitVersion -import org.utbot.contest.usvm.converter.JcToUtExecutionConverter -import org.utbot.contest.usvm.converter.SimpleInstructionIdProvider -import org.utbot.contest.usvm.converter.toExecutableId -import org.utbot.contest.usvm.jc.JcContainer -import org.utbot.contest.usvm.jc.JcContainer.Companion.CONTEST_TEST_EXECUTION_TIMEOUT -import org.utbot.contest.usvm.jc.JcTestExecutor import org.utbot.contest.usvm.log.ErrorCountingLoggerAppender import org.utbot.framework.codegen.domain.ProjectType import org.utbot.framework.codegen.domain.RuntimeExceptionTestsBehaviour @@ -41,6 +35,7 @@ import org.utbot.framework.codegen.domain.junitByVersion import org.utbot.framework.codegen.generator.CodeGenerator import org.utbot.framework.codegen.generator.CodeGeneratorParams import org.utbot.framework.codegen.services.language.CgLanguageAssistant +import org.utbot.framework.fuzzer.ReferencePreservingIntIdGenerator import org.utbot.framework.minimization.minimizeExecutions import org.utbot.framework.plugin.api.* import org.utbot.framework.plugin.api.util.constructor @@ -49,9 +44,14 @@ import org.utbot.framework.plugin.api.util.method import org.utbot.framework.plugin.api.util.utContext import org.utbot.framework.plugin.api.util.withUtContext import org.utbot.framework.plugin.services.JdkInfoService -import org.utbot.fuzzer.ReferencePreservingIntIdGenerator import org.utbot.fuzzer.UtFuzzedExecution import org.utbot.summary.usvm.summarizeAll +import org.utbot.usvm.converter.JcToUtExecutionConverter +import org.utbot.usvm.converter.SimpleInstructionIdProvider +import org.utbot.usvm.converter.toExecutableId +import org.utbot.usvm.jc.JcContainer +import org.utbot.usvm.jc.JcContainer.Companion.TEST_EXECUTION_TIMEOUT +import org.utbot.usvm.jc.JcTestExecutor import java.io.File import java.net.URLClassLoader import kotlin.time.Duration.Companion.milliseconds @@ -64,7 +64,6 @@ fun runUsvmGeneration( project: String, cut: ClassUnderTest, timeLimitSec: Long, - fuzzingRatio: Double, classpathString: String, runFromEstimator: Boolean, expectedExceptions: ExpectedExceptionsForClass, @@ -165,7 +164,7 @@ fun runUsvmGeneration( options = UMachineOptions( // TODO usvm-sbft: if we have less than CONTEST_TEST_EXECUTION_TIMEOUT time left, we should try execute // with smaller timeout, but instrumentation currently doesn't allow to change timeout for individual runs - timeout = generationTimeoutMillisWithoutCodegen.milliseconds - alreadySpentBudgetMillis.milliseconds - CONTEST_TEST_EXECUTION_TIMEOUT, + timeout = generationTimeoutMillisWithoutCodegen.milliseconds - alreadySpentBudgetMillis.milliseconds - TEST_EXECUTION_TIMEOUT, pathSelectionStrategies = listOf(PathSelectionStrategy.CLOSEST_TO_UNCOVERED_RANDOM), pathSelectorFairnessStrategy = PathSelectorFairnessStrategy.COMPLETELY_FAIR, solverType = SolverType.Z3, // TODO: usvm-ksmt: Yices doesn't work on old linux diff --git a/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringIntegrationTestJavaFuzzingContext.kt b/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringIntegrationTestJavaFuzzingContext.kt index b391cf009d..0b22966f15 100644 --- a/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringIntegrationTestJavaFuzzingContext.kt +++ b/utbot-spring-framework/src/main/kotlin/org/utbot/framework/context/spring/SpringIntegrationTestJavaFuzzingContext.kt @@ -3,6 +3,7 @@ package org.utbot.framework.context.spring import mu.KotlinLogging import org.utbot.common.tryLoadClass import org.utbot.framework.context.JavaFuzzingContext +import org.utbot.framework.fuzzer.IdentityPreservingIdGenerator import org.utbot.framework.plugin.api.ConstructorId import org.utbot.framework.plugin.api.EnvironmentModels import org.utbot.framework.plugin.api.ExecutableId @@ -17,7 +18,6 @@ import org.utbot.framework.plugin.api.util.SpringModelUtils.allControllerParamet import org.utbot.framework.plugin.api.util.allDeclaredFieldIds import org.utbot.framework.plugin.api.util.jField import org.utbot.framework.plugin.api.util.utContext -import org.utbot.fuzzer.IdentityPreservingIdGenerator import org.utbot.fuzzing.JavaValueProvider import org.utbot.fuzzing.ValueProvider import org.utbot.fuzzing.providers.AnyDepthNullValueProvider diff --git a/utbot-usvm/build.gradle.kts b/utbot-usvm/build.gradle.kts new file mode 100644 index 0000000000..92bfce89fe --- /dev/null +++ b/utbot-usvm/build.gradle.kts @@ -0,0 +1,37 @@ +val jacoDbVersion: String by rootProject +val usvmVersion: String by rootProject +val approximationsVersion: String by rootProject + +val approximationsRepo = "com.github.UnitTestBot.java-stdlib-approximations" +val usvmRepo = "com.github.UnitTestBot.usvm" + +repositories { + mavenCentral() + maven("https://jitpack.io") +} + +val approximations: Configuration by configurations.creating {} +val usvmApproximationsApi: Configuration by configurations.creating {} +val usvmInstrumentationCollector: Configuration by configurations.creating {} +val usvmInstrumentationRunner: Configuration by configurations.creating {} + +dependencies { + implementation(project(":utbot-framework-api")) + + implementation(group = "org.jacodb", name = "jacodb-core", version = jacoDbVersion) + implementation(group = "org.jacodb", name = "jacodb-analysis", version = jacoDbVersion) + implementation(group = "org.jacodb", name = "jacodb-approximations", version = jacoDbVersion) + + implementation(group = usvmRepo, name = "usvm-core", version = usvmVersion) + implementation(group = usvmRepo, name = "usvm-jvm", version = usvmVersion) + implementation(group = usvmRepo, name = "usvm-jvm-api", version = usvmVersion) + implementation(group = usvmRepo, name = "usvm-jvm-instrumentation", version = usvmVersion) + implementation(group = usvmRepo, name = "usvm-jvm-instrumentation-collectors", version = usvmVersion) + + approximations("$approximationsRepo:approximations:$approximationsVersion") + + usvmApproximationsApi("$usvmRepo:usvm-jvm-api:$usvmVersion") + usvmInstrumentationCollector("$usvmRepo:usvm-jvm-instrumentation-collectors:$usvmVersion") + usvmInstrumentationRunner("$usvmRepo:usvm-jvm-instrumentation:$usvmVersion") + usvmInstrumentationRunner("$usvmRepo:usvm-jvm-instrumentation-collectors:$usvmVersion") +} \ No newline at end of file diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/ConverterUtils.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/ConverterUtils.kt similarity index 99% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/ConverterUtils.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/ConverterUtils.kt index d381ded397..02d2840044 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/ConverterUtils.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/ConverterUtils.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import org.jacodb.analysis.library.analyzers.thisInstance import org.jacodb.api.JcArrayType diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/InstructionIdProvider.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/InstructionIdProvider.kt similarity index 91% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/InstructionIdProvider.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/InstructionIdProvider.kt index 898ba718eb..196728c769 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/InstructionIdProvider.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/InstructionIdProvider.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter fun interface InstructionIdProvider { fun provideInstructionId(methodSignature: String, instIndex: Int): Long diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtExecutionConverter.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtExecutionConverter.kt similarity index 97% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtExecutionConverter.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtExecutionConverter.kt index 615d2dfdb8..2b1392b7e7 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtExecutionConverter.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtExecutionConverter.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import mu.KotlinLogging import org.jacodb.api.JcClassOrInterface @@ -18,12 +18,7 @@ import org.usvm.instrumentation.testcase.descriptor.UTestExceptionDescriptor import org.usvm.instrumentation.util.enclosingClass import org.usvm.instrumentation.util.enclosingMethod import org.utbot.common.isPublic -import org.utbot.contest.usvm.jc.JcExecution -import org.utbot.contest.usvm.jc.UTestConcreteExecutionResult -import org.utbot.contest.usvm.jc.UTestResultWrapper -import org.utbot.contest.usvm.jc.UTestSymbolicExceptionResult -import org.utbot.contest.usvm.jc.UTestSymbolicSuccessResult -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.Coverage import org.utbot.framework.plugin.api.EnvironmentModels @@ -49,7 +44,12 @@ import org.utbot.framework.plugin.api.mapper.UtModelDeepMapper import org.utbot.framework.plugin.api.util.executableId import org.utbot.framework.plugin.api.util.jClass import org.utbot.framework.plugin.api.util.utContext -import org.utbot.fuzzer.IdGenerator +import org.utbot.framework.utils.UtilMethodProvider +import org.utbot.usvm.jc.JcExecution +import org.utbot.usvm.jc.UTestConcreteExecutionResult +import org.utbot.usvm.jc.UTestResultWrapper +import org.utbot.usvm.jc.UTestSymbolicExceptionResult +import org.utbot.usvm.jc.UTestSymbolicSuccessResult import java.util.IdentityHashMap private val logger = KotlinLogging.logger {} @@ -64,7 +64,7 @@ class JcToUtExecutionConverter( private val toValueConverter = Descriptor2ValueConverter(utContext.classLoader) private val instToModelConverter = UTestInstToUtModelConverter(jcExecution.uTest, jcClasspath, idGenerator, utilMethodProvider) - private var jcToUtModelConverter = JcToUtModelConverter(idGenerator, jcClasspath, instToModelConverter) + private var jcToUtModelConverter = JcToUtModelConverter(idGenerator, instToModelConverter) private var uTestProcessResult = instToModelConverter.processUTest() fun convert() = jcExecution.uTestExecutionResultWrappers.firstNotNullOfOrNull { result -> diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtModelConverter.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtModelConverter.kt similarity index 98% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtModelConverter.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtModelConverter.kt index 8d23e99025..5719d1c5d8 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/JcToUtModelConverter.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/JcToUtModelConverter.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import org.jacodb.api.JcClasspath import org.usvm.instrumentation.testcase.api.UTestExpression @@ -13,6 +13,7 @@ import org.usvm.instrumentation.testcase.descriptor.UTestObjectDescriptor import org.usvm.instrumentation.testcase.descriptor.UTestRefDescriptor import org.usvm.instrumentation.testcase.descriptor.UTestValueDescriptor import org.usvm.instrumentation.util.InstrumentationModuleConstants.nameForExistingButNullString +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ClassId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.UtArrayModel @@ -31,7 +32,6 @@ import org.utbot.framework.plugin.api.util.classClassId import org.utbot.framework.plugin.api.util.id import org.utbot.framework.plugin.api.util.jClass import org.utbot.framework.plugin.api.util.stringClassId -import org.utbot.fuzzer.IdGenerator enum class EnvironmentStateKind { INITIAL, FINAL @@ -48,7 +48,6 @@ data class UtCyclicReferenceModel( class JcToUtModelConverter( private val idGenerator: IdGenerator, - private val jcClasspath: JcClasspath, private val instToUtModelConverter: UTestInstToUtModelConverter, ) { private val descriptorToModelCache = diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestInstToUtModelConverter.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestInstToUtModelConverter.kt similarity index 99% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestInstToUtModelConverter.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestInstToUtModelConverter.kt index 7411481588..54df355e48 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestInstToUtModelConverter.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestInstToUtModelConverter.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import mu.KotlinLogging import org.jacodb.api.JcClasspath @@ -34,7 +34,7 @@ import org.usvm.instrumentation.testcase.api.UTestSetStaticFieldStatement import org.usvm.instrumentation.testcase.api.UTestShortExpression import org.usvm.instrumentation.testcase.api.UTestStaticMethodCall import org.usvm.instrumentation.testcase.api.UTestStringExpression -import org.utbot.framework.codegen.domain.builtin.UtilMethodProvider +import org.utbot.framework.fuzzer.IdGenerator import org.utbot.framework.plugin.api.ExecutableId import org.utbot.framework.plugin.api.FieldId import org.utbot.framework.plugin.api.MethodId @@ -53,7 +53,7 @@ import org.utbot.framework.plugin.api.UtStaticMethodInstrumentation import org.utbot.framework.plugin.api.util.classClassId import org.utbot.framework.plugin.api.util.objectClassId import org.utbot.framework.plugin.api.util.voidClassId -import org.utbot.fuzzer.IdGenerator +import org.utbot.framework.utils.UtilMethodProvider private val logger = KotlinLogging.logger {} diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestValueDescriptorUtils.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestValueDescriptorUtils.kt similarity index 97% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestValueDescriptorUtils.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestValueDescriptorUtils.kt index 659a086f34..cf969c7fba 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UTestValueDescriptorUtils.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UTestValueDescriptorUtils.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import org.usvm.instrumentation.testcase.descriptor.UTestArrayDescriptor import org.usvm.instrumentation.testcase.descriptor.UTestClassDescriptor diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UtUsvmExecution.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UtUsvmExecution.kt similarity index 98% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UtUsvmExecution.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UtUsvmExecution.kt index 2bed13737b..4d8513f5fa 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/converter/UtUsvmExecution.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/converter/UtUsvmExecution.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.converter +package org.utbot.usvm.converter import org.utbot.framework.plugin.api.Coverage import org.utbot.framework.plugin.api.DocStatement diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcContainer.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcContainer.kt similarity index 95% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcContainer.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcContainer.kt index 6ef671fcfe..0cf23878ee 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcContainer.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcContainer.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.jc +package org.utbot.usvm.jc import kotlinx.coroutines.runBlocking import mu.KotlinLogging @@ -62,7 +62,7 @@ class JcContainer private constructor( cp, javaHome.absolutePath, persistenceLocation, - CONTEST_TEST_EXECUTION_TIMEOUT + TEST_EXECUTION_TIMEOUT ) runBlocking { db.awaitBackgroundJobs() @@ -76,7 +76,7 @@ class JcContainer private constructor( } companion object : AutoCloseable { - val CONTEST_TEST_EXECUTION_TIMEOUT = 1.seconds + val TEST_EXECUTION_TIMEOUT = 1.seconds private val cache = HashMap, JcContainer>() diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcExecution.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcExecution.kt similarity index 96% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcExecution.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcExecution.kt index 3afa7f79ed..b8b396ca77 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcExecution.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcExecution.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.jc +package org.utbot.usvm.jc import org.jacodb.api.JcType import org.jacodb.api.JcTypedMethod diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutor.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutor.kt similarity index 99% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutor.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutor.kt index 301b96f58c..8ff326c6dd 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutor.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutor.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.jc +package org.utbot.usvm.jc import kotlinx.coroutines.runBlocking import mu.KotlinLogging @@ -9,8 +9,8 @@ import org.jacodb.api.JcMethod import org.jacodb.api.JcType import org.jacodb.api.JcTypedMethod import org.jacodb.api.ext.constructors -import org.jacodb.api.ext.objectType import org.jacodb.api.ext.findTypeOrNull +import org.jacodb.api.ext.objectType import org.jacodb.api.ext.toType import org.jacodb.approximation.JcEnrichedVirtualField import org.usvm.UConcreteHeapRef @@ -34,8 +34,8 @@ import org.usvm.instrumentation.testcase.api.UTestMockObject import org.usvm.instrumentation.testcase.api.UTestNullExpression import org.usvm.instrumentation.testcase.api.UTestStaticMethodCall import org.usvm.machine.JcContext -import org.usvm.machine.state.JcMethodResult import org.usvm.machine.JcMocker +import org.usvm.machine.state.JcMethodResult import org.usvm.machine.state.JcState import org.usvm.machine.state.localIdx import org.usvm.memory.ULValue diff --git a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutorDecoderApi.kt b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutorDecoderApi.kt similarity index 99% rename from utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutorDecoderApi.kt rename to utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutorDecoderApi.kt index c0263e10a9..9cf13d7687 100644 --- a/utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcTestExecutorDecoderApi.kt +++ b/utbot-usvm/src/main/kotlin/org/utbot/usvm/jc/JcTestExecutorDecoderApi.kt @@ -1,4 +1,4 @@ -package org.utbot.contest.usvm.jc +package org.utbot.usvm.jc import org.jacodb.api.JcClassOrInterface import org.jacodb.api.JcField