@@ -26,6 +26,7 @@ import org.utbot.contest.Paths.evosuiteReportFile
26
26
import org.utbot.contest.Paths.jarsDir
27
27
import org.utbot.contest.Paths.moduleTestDir
28
28
import org.utbot.contest.Paths.outputDir
29
+ import org.utbot.contest.usvm.runUsvmGeneration
29
30
import org.utbot.features.FeatureExtractorFactoryImpl
30
31
import org.utbot.features.FeatureProcessorWithStatesRepetitionFactory
31
32
import org.utbot.framework.PathSelectorType
@@ -125,10 +126,20 @@ object Paths {
125
126
}
126
127
127
128
@Suppress(" unused" )
128
- enum class Tool {
129
- UtBot {
130
- @OptIn(ObsoleteCoroutinesApi ::class )
131
- @Suppress(" EXPERIMENTAL_API_USAGE" )
129
+ interface Tool {
130
+ abstract class UtBotBasedTool : Tool {
131
+ abstract fun runGeneration (
132
+ project : ProjectToEstimate ,
133
+ cut : ClassUnderTest ,
134
+ timeLimit : Long ,
135
+ fuzzingRatio : Double ,
136
+ methodNameFilter : String? ,
137
+ statsForProject : StatsForProject ,
138
+ compiledTestDir : File ,
139
+ classFqn : String ,
140
+ expectedExceptions : ExpectedExceptionsForClass
141
+ ) : StatsForClass
142
+
132
143
override fun run (
133
144
project : ProjectToEstimate ,
134
145
cut : ClassUnderTest ,
@@ -142,19 +153,21 @@ enum class Tool {
142
153
) = withUtContext(ContextManager .createNewContext(project.classloader)) {
143
154
val classStats: StatsForClass = try {
144
155
runGeneration(
145
- project.name ,
156
+ project,
146
157
cut,
147
158
timeLimit,
148
159
fuzzingRatio,
149
- project.sootClasspathString,
150
- runFromEstimator = true ,
151
- expectedExceptions,
152
- methodNameFilter
160
+ methodNameFilter,
161
+ statsForProject,
162
+ compiledTestDir,
163
+ classFqn,
164
+ expectedExceptions
153
165
)
154
166
} catch (e: CancellationException ) {
155
167
logger.info { " [$classFqn ] finished with CancellationException" }
156
168
return
157
169
} catch (e: Throwable ) {
170
+ logger.error(e) { " ISOLATION: $e " }
158
171
logger.info { " ISOLATION: $e " }
159
172
logger.info { " continue without compilation" }
160
173
return
@@ -198,8 +211,61 @@ enum class Tool {
198
211
override fun moveProducedFilesIfNeeded () {
199
212
// don't do anything
200
213
}
201
- },
202
- EvoSuite {
214
+ }
215
+
216
+ object UtBot : UtBotBasedTool() {
217
+ @OptIn(ObsoleteCoroutinesApi ::class )
218
+ @Suppress(" EXPERIMENTAL_API_USAGE" )
219
+ override fun runGeneration (
220
+ project : ProjectToEstimate ,
221
+ cut : ClassUnderTest ,
222
+ timeLimit : Long ,
223
+ fuzzingRatio : Double ,
224
+ methodNameFilter : String? ,
225
+ statsForProject : StatsForProject ,
226
+ compiledTestDir : File ,
227
+ classFqn : String ,
228
+ expectedExceptions : ExpectedExceptionsForClass
229
+ ): StatsForClass {
230
+ return runGeneration(
231
+ project.name,
232
+ cut,
233
+ timeLimit,
234
+ fuzzingRatio,
235
+ project.sootClasspathString,
236
+ runFromEstimator = true ,
237
+ expectedExceptions,
238
+ methodNameFilter
239
+ )
240
+ }
241
+ }
242
+
243
+ object USVM : UtBotBasedTool() {
244
+ @OptIn(ObsoleteCoroutinesApi ::class )
245
+ @Suppress(" EXPERIMENTAL_API_USAGE" )
246
+ override fun runGeneration (
247
+ project : ProjectToEstimate ,
248
+ cut : ClassUnderTest ,
249
+ timeLimit : Long ,
250
+ fuzzingRatio : Double ,
251
+ methodNameFilter : String? ,
252
+ statsForProject : StatsForProject ,
253
+ compiledTestDir : File ,
254
+ classFqn : String ,
255
+ expectedExceptions : ExpectedExceptionsForClass
256
+ ): StatsForClass = runUsvmGeneration(
257
+ project.name,
258
+ cut,
259
+ timeLimit,
260
+ fuzzingRatio,
261
+ project.sootClasspathString,
262
+ runFromEstimator = true ,
263
+ expectedExceptions,
264
+ methodNameFilter
265
+ )
266
+ }
267
+
268
+ object EvoSuite : Tool {
203
269
override fun run (
204
270
project : ProjectToEstimate ,
205
271
cut : ClassUnderTest ,
@@ -272,7 +338,7 @@ enum class Tool {
272
338
}
273
339
};
274
340
275
- abstract fun run (
341
+ fun run (
276
342
project : ProjectToEstimate ,
277
343
cut : ClassUnderTest ,
278
344
timeLimit : Long ,
@@ -284,7 +350,7 @@ enum class Tool {
284
350
expectedExceptions : ExpectedExceptionsForClass
285
351
)
286
352
287
- abstract fun moveProducedFilesIfNeeded ()
353
+ fun moveProducedFilesIfNeeded ()
288
354
}
289
355
290
356
fun main (args : Array <String >) {
@@ -295,7 +361,7 @@ fun main(args: Array<String>) {
295
361
val tools: List <Tool >
296
362
297
363
// very special case when you run your project directly from IntellijIDEA omitting command line arguments
298
- if (args.isEmpty() && System .getProperty( " os.name " )?. run { contains( " win " , ignoreCase = true ) } == true ) {
364
+ if (args.isEmpty()) {
299
365
processedClassesThreshold = 9999 // change to change number of classes to run
300
366
val timeLimit = 20 // increase if you want to debug something
301
367
val fuzzingRatio = 0.1 // sets fuzzing ratio to total test generation
@@ -319,7 +385,8 @@ fun main(args: Array<String>) {
319
385
// config for SBST 2022
320
386
methodFilter = null
321
387
projectFilter = listOf (" fastjson-1.2.50" , " guava-26.0" , " seata-core-0.5.0" , " spoon-core-7.0.0" )
322
- tools = listOf (Tool .UtBot )
388
+ // TODO usvm-sbft-merge: add if here if we want merge contest it into main
389
+ tools = listOf (Tool .USVM )
323
390
324
391
estimatorArgs = arrayOf(
325
392
classesLists,
@@ -339,7 +406,8 @@ fun main(args: Array<String>) {
339
406
processedClassesThreshold = 9999
340
407
methodFilter = null
341
408
projectFilter = null
342
- tools = listOf (Tool .UtBot )
409
+ // TODO usvm-sbft-merge: add if here if we want merge contest it into main
410
+ tools = listOf (Tool .USVM )
343
411
}
344
412
345
413
JdkInfoService .jdkInfoProvider = ContestEstimatorJdkInfoProvider (javaHome)
0 commit comments