@@ -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.executor.UTestRunner
29
30
import org.utbot.contest.usvm.runUsvmGeneration
30
31
import org.utbot.features.FeatureExtractorFactoryImpl
31
32
import org.utbot.features.FeatureProcessorWithStatesRepetitionFactory
@@ -263,6 +264,11 @@ interface Tool {
263
264
expectedExceptions,
264
265
methodNameFilter
265
266
)
267
+
268
+ override fun close () {
269
+ if (UTestRunner .isInitialized())
270
+ UTestRunner .runner.close()
271
+ }
266
272
}
267
273
268
274
object EvoSuite : Tool {
@@ -351,6 +357,8 @@ interface Tool {
351
357
)
352
358
353
359
fun moveProducedFilesIfNeeded ()
360
+
361
+ fun close () {}
354
362
}
355
363
356
364
fun main (args : Array <String >) {
@@ -508,52 +516,56 @@ fun runEstimator(
508
516
509
517
try {
510
518
tools.forEach { tool ->
511
- var classIndex = 0
512
-
513
- outer@ for (project in projects) {
514
- if (projectFilter != null && project.name !in projectFilter) continue
515
-
516
- val statsForProject = StatsForProject (project.name)
517
- globalStats.projectStats.add(statsForProject)
518
-
519
- logger.info { " ------------- project [${project.name} ] ---- " }
520
-
521
- // take all the classes from the corresponding jar if a list of the specified classes is empty
522
- val extendedClassFqn = project.classFQNs.ifEmpty { project.classNames }
523
-
524
- for (classFqn in extendedClassFqn.filter { classFqnFilter?.equals(it) ? : true }) {
525
- classIndex++
526
- if (classIndex > processedClassesThreshold) {
527
- logger.info { " Reached limit of $processedClassesThreshold classes" }
528
- break @outer
529
- }
530
-
531
- try {
532
- val cut =
533
- ClassUnderTest (
534
- project.classloader.loadClass(classFqn).id,
535
- project.outputTestSrcFolder,
536
- project.unzippedDir
519
+ try {
520
+ var classIndex = 0
521
+
522
+ outer@ for (project in projects) {
523
+ if (projectFilter != null && project.name !in projectFilter) continue
524
+
525
+ val statsForProject = StatsForProject (project.name)
526
+ globalStats.projectStats.add(statsForProject)
527
+
528
+ logger.info { " ------------- project [${project.name} ] ---- " }
529
+
530
+ // take all the classes from the corresponding jar if a list of the specified classes is empty
531
+ val extendedClassFqn = project.classFQNs.ifEmpty { project.classNames }
532
+
533
+ for (classFqn in extendedClassFqn.filter { classFqnFilter?.equals(it) ? : true }) {
534
+ classIndex++
535
+ if (classIndex > processedClassesThreshold) {
536
+ logger.info { " Reached limit of $processedClassesThreshold classes" }
537
+ break @outer
538
+ }
539
+
540
+ try {
541
+ val cut =
542
+ ClassUnderTest (
543
+ project.classloader.loadClass(classFqn).id,
544
+ project.outputTestSrcFolder,
545
+ project.unzippedDir
546
+ )
547
+
548
+ logger.info { " ------------- [${project.name} ] ---->--- [$classIndex :$classFqn ] ---------------------" }
549
+
550
+ tool.run (
551
+ project,
552
+ cut,
553
+ timeLimit,
554
+ fuzzingRatio,
555
+ methodNameFilter,
556
+ statsForProject,
557
+ compiledTestDir,
558
+ classFqn,
559
+ project.expectedExceptions.getForClass(classFqn)
537
560
)
538
-
539
- logger.info { " ------------- [${project.name} ] ---->--- [$classIndex :$classFqn ] ---------------------" }
540
-
541
- tool.run (
542
- project,
543
- cut,
544
- timeLimit,
545
- fuzzingRatio,
546
- methodNameFilter,
547
- statsForProject,
548
- compiledTestDir,
549
- classFqn,
550
- project.expectedExceptions.getForClass(classFqn)
551
- )
552
- }
553
- catch (e: Throwable ) {
554
- logger.warn(e) { " ===================== ERROR IN [${project.name} ] FOR [$classIndex :$classFqn ] ============" }
561
+ }
562
+ catch (e: Throwable ) {
563
+ logger.warn(e) { " ===================== ERROR IN [${project.name} ] FOR [$classIndex :$classFqn ] ============" }
564
+ }
555
565
}
556
566
}
567
+ } finally {
568
+ tool.close()
557
569
}
558
570
}
559
571
} finally {
0 commit comments