@@ -48,23 +48,29 @@ import kotlin.coroutines.cancellation.CancellationException
48
48
import kotlin.math.min
49
49
import kotlin.reflect.KCallable
50
50
51
+ /* *
52
+ * Generates test cases: one by one or a whole set for the method under test.
53
+ *
54
+ * Note: the instantiating of [TestCaseGenerator] may take some time,
55
+ * because it requires initializing Soot for the current [buildDir] and [classpath].
56
+ */
51
57
open class TestCaseGenerator (
52
58
private val buildDir : Path ,
53
59
private val classpath : String? ,
54
60
private val dependencyPaths : String ,
55
61
val engineActions : MutableList <(UtBotSymbolicEngine ) -> Unit > = mutableListOf(),
56
62
val isCanceled : () -> Boolean = { false },
57
63
) {
58
- private lateinit var logger: KLogger
59
- private lateinit var timeoutLogger: KLogger
64
+ private val logger: KLogger = KotlinLogging .logger {}
65
+ private val timeoutLogger: KLogger = KotlinLogging .logger(logger.name + " .timeout" )
66
+
67
+ private val classpathForEngine: String
68
+ get() = buildDir.toString() + (classpath?.let { File .pathSeparator + it } ? : " " )
60
69
61
70
init {
62
71
if (! isCanceled()) {
63
72
checkFrameworkDependencies(dependencyPaths)
64
73
65
- logger = KotlinLogging .logger {}
66
- timeoutLogger = KotlinLogging .logger(logger.name + " .timeout" )
67
-
68
74
logger.trace(" Initializing ${this .javaClass.name} with buildDir = $buildDir , classpath = $classpath " )
69
75
70
76
@@ -80,7 +86,7 @@ open class TestCaseGenerator(
80
86
if (warmupConcreteExecution) {
81
87
ConcreteExecutor (
82
88
UtExecutionInstrumentation ,
83
- classpathForEngine() ,
89
+ classpathForEngine,
84
90
dependencyPaths
85
91
).apply {
86
92
classLoader = utContext.classLoader
@@ -234,8 +240,6 @@ open class TestCaseGenerator(
234
240
)
235
241
}
236
242
237
- private fun classpathForEngine () = buildDir.toString() + (classpath?.let { File .pathSeparator + it } ? : " " )
238
-
239
243
private fun createSymbolicEngine (
240
244
controller : EngineController ,
241
245
method : UtMethod <* >,
@@ -248,7 +252,7 @@ open class TestCaseGenerator(
248
252
return UtBotSymbolicEngine (
249
253
controller,
250
254
method,
251
- classpathForEngine() ,
255
+ classpathForEngine,
252
256
dependencyPaths = dependencyPaths,
253
257
mockStrategy = mockStrategyApi.toModel(),
254
258
chosenClassesToMockAlways = chosenClassesToMockAlways,
0 commit comments