Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniilStepanov committed Jan 24, 2023
1 parent 51ded78 commit f6d9667
Show file tree
Hide file tree
Showing 25 changed files with 185 additions and 170 deletions.
8 changes: 2 additions & 6 deletions utbot-core/src/main/kotlin/org/utbot/common/KClassUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import java.lang.reflect.Method
* NOTE: vararg parameters must be passed as an array of the corresponding type.
*/
fun Method.invokeCatching(obj: Any?, args: List<Any?>) = try {
val invocation =
try {
invoke(obj, *args.toTypedArray())
} catch (e: Throwable) {
null
}
val invocation = invoke(obj, *args.toTypedArray())

Result.success(invocation)
} catch (e: InvocationTargetException) {
Result.failure<Nothing>(e.targetException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ object UtSettings : AbstractSettings(logger, defaultKeyForSettingsPath, defaultS
/**
* Set to true to start fuzzing if symbolic execution haven't return anything
*/
var useFuzzing: Boolean by getBooleanProperty(false)
var useFuzzing: Boolean by getBooleanProperty(true)

/**
* Set to true to use grey-box fuzzing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ data class UtArrayModel(
* @param instantiationCall is an [UtExecutableCallModel] to instantiate represented object. It **must** not return `null`.
* @param modificationsChain is a chain of [UtStatementModel] to construct object state.
*/
data class UtAssembleModel constructor(
data class UtAssembleModel private constructor(
override val id: Int?,
override val classId: ClassId,
override val modelName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.utbot.common.currentThreadInfo
import org.utbot.framework.plugin.api.util.UtContext.Companion.setUtContext
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.ThreadContextElement
//import mu.KotlinLogging
import mu.KotlinLogging

val utContext: UtContext
get() = UtContext.currentContext()
Expand Down Expand Up @@ -75,7 +75,7 @@ inline fun <T> withUtContext(context: UtContext, block: () -> T): T = setUtConte
try {
return@use block.invoke()
} catch (e: Exception) {
//KotlinLogging.logger("withUtContext").error { e }
KotlinLogging.logger("withUtContext").error { e }
throw e
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import org.utbot.framework.plugin.api.util.anyInstance
import org.utbot.framework.plugin.api.util.constructLambda
import org.utbot.framework.plugin.api.util.constructStaticLambda
import org.utbot.framework.plugin.api.util.constructor
import org.utbot.framework.plugin.api.util.id
import org.utbot.framework.plugin.api.util.isStatic
import org.utbot.framework.plugin.api.util.jClass
import org.utbot.framework.plugin.api.util.jField
Expand Down
9 changes: 0 additions & 9 deletions utbot-framework/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ repositories {

configurations {
z3native
fetchInstrumentationJar
}

dependencies {
Expand Down Expand Up @@ -36,10 +35,6 @@ dependencies {
implementation group: 'io.github.microutils', name: 'kotlin-logging', version: kotlinLoggingVersion
implementation group: 'org.jacoco', name: 'org.jacoco.report', version: jacocoVersion
implementation group: 'org.apache.commons', name: 'commons-text', version: apacheCommonsTextVersion
implementation "org.javaruntype:javaruntype:1.3"
implementation "ru.vyarus:generics-resolver:3.0.3"
implementation "ognl:ognl:3.3.2"

// we need this for construction mocks from composite models
implementation group: 'org.mockito', name: 'mockito-core', version: '4.2.0'

Expand All @@ -51,7 +46,6 @@ dependencies {
z3native group: 'com.microsoft.z3', name: 'z3-native-win64', version: z3Version, ext: 'zip'
z3native group: 'com.microsoft.z3', name: 'z3-native-linux64', version: z3Version, ext: 'zip'
z3native group: 'com.microsoft.z3', name: 'z3-native-osx', version: z3Version, ext: 'zip'
fetchInstrumentationJar project(path: ':utbot-instrumentation', configuration:'instrumentationArchive')
}

processResources {
Expand All @@ -60,7 +54,4 @@ processResources {
into "lib/x64"
}
}
from(configurations.fetchInstrumentationJar) {
into "lib"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import org.utbot.fuzzing.utils.Trie
import org.utbot.greyboxfuzzer.GreyBoxFuzzer
import org.utbot.greyboxfuzzer.util.FuzzerUtModelConstructor
import org.utbot.instrumentation.ConcreteExecutor
import ru.vyarus.java.generics.resolver.context.GenericsInfoFactory
import org.utbot.instrumentation.instrumentation.execution.UtConcreteExecutionData
import org.utbot.instrumentation.instrumentation.execution.UtConcreteExecutionResult
import org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,8 @@ data class CgContext(
}
}

private var nestedClassIndex = 0
private fun createClassIdForNestedClass(testClassModel: TestClassModel): ClassId {
val simpleName = "${testClassModel.classUnderTest.simpleName}Test${nestedClassIndex++}"
val simpleName = "${testClassModel.classUnderTest.simpleName}Test"
return BuiltinClassId(
canonicalName = currentTestClass.canonicalName + "." + simpleName,
simpleName = simpleName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class CgClass(
val body: CgClassBody,
val isStatic: Boolean,
val isNested: Boolean,
): CgStatement {
): CgElement {
val packageName
get() = id.packageName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -623,15 +623,7 @@ abstract class CgAbstractRenderer(
is Boolean -> toStringConstant()
// String is "\"" + "str" + "\"", RawString is "str"
is String -> if (asRawString) "$this".escapeCharacters() else toStringConstant()
else -> {
val t = this@toStringConstant.type
val illegalType = t.toString().contains("$") || !t.isPublic
if (this == null && UtSettings.greyBoxFuzzingCompetitionMode && !illegalType) {
"(${this@toStringConstant.type}) null"
} else {
"$this"
}
}
else -> "$this"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@ internal class CgJavaRenderer(context: CgRendererContext, printer: CgPrinter = C
renderExceptions(element)
}

private fun getTypeStringRepresentation(typeId: ClassId): String =
when {
typeId.isArray -> getTypeStringRepresentation(typeId.elementClassId!!) + "[]"
else -> typeId.toString()
}

override fun renderMethodSignature(element: CgMockMethod) {
val returnType = element.returnType.asString()
Expand Down
Loading

0 comments on commit f6d9667

Please sign in to comment.