@@ -26,6 +26,7 @@ import org.utbot.contest.Paths.evosuiteReportFile
2626import org.utbot.contest.Paths.jarsDir
2727import org.utbot.contest.Paths.moduleTestDir
2828import org.utbot.contest.Paths.outputDir
29+ import org.utbot.contest.usvm.runUsvmGeneration
2930import org.utbot.features.FeatureExtractorFactoryImpl
3031import org.utbot.features.FeatureProcessorWithStatesRepetitionFactory
3132import org.utbot.framework.PathSelectorType
@@ -125,10 +126,20 @@ object Paths {
125126}
126127
127128@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+
132143 override fun run (
133144 project : ProjectToEstimate ,
134145 cut : ClassUnderTest ,
@@ -142,19 +153,21 @@ enum class Tool {
142153 ) = withUtContext(ContextManager .createNewContext(project.classloader)) {
143154 val classStats: StatsForClass = try {
144155 runGeneration(
145- project.name ,
156+ project,
146157 cut,
147158 timeLimit,
148159 fuzzingRatio,
149- project.sootClasspathString,
150- runFromEstimator = true ,
151- expectedExceptions,
152- methodNameFilter
160+ methodNameFilter,
161+ statsForProject,
162+ compiledTestDir,
163+ classFqn,
164+ expectedExceptions
153165 )
154166 } catch (e: CancellationException ) {
155167 logger.info { " [$classFqn ] finished with CancellationException" }
156168 return
157169 } catch (e: Throwable ) {
170+ logger.error(e) { " ISOLATION: $e " }
158171 logger.info { " ISOLATION: $e " }
159172 logger.info { " continue without compilation" }
160173 return
@@ -198,8 +211,61 @@ enum class Tool {
198211 override fun moveProducedFilesIfNeeded () {
199212 // don't do anything
200213 }
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 {
203269 override fun run (
204270 project : ProjectToEstimate ,
205271 cut : ClassUnderTest ,
@@ -272,7 +338,7 @@ enum class Tool {
272338 }
273339 };
274340
275- abstract fun run (
341+ fun run (
276342 project : ProjectToEstimate ,
277343 cut : ClassUnderTest ,
278344 timeLimit : Long ,
@@ -284,7 +350,7 @@ enum class Tool {
284350 expectedExceptions : ExpectedExceptionsForClass
285351 )
286352
287- abstract fun moveProducedFilesIfNeeded ()
353+ fun moveProducedFilesIfNeeded ()
288354}
289355
290356fun main (args : Array <String >) {
@@ -295,7 +361,7 @@ fun main(args: Array<String>) {
295361 val tools: List <Tool >
296362
297363 // 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()) {
299365 processedClassesThreshold = 9999 // change to change number of classes to run
300366 val timeLimit = 20 // increase if you want to debug something
301367 val fuzzingRatio = 0.1 // sets fuzzing ratio to total test generation
@@ -319,7 +385,8 @@ fun main(args: Array<String>) {
319385 // config for SBST 2022
320386 methodFilter = null
321387 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 )
323390
324391 estimatorArgs = arrayOf(
325392 classesLists,
@@ -339,7 +406,8 @@ fun main(args: Array<String>) {
339406 processedClassesThreshold = 9999
340407 methodFilter = null
341408 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 )
343411 }
344412
345413 JdkInfoService .jdkInfoProvider = ContestEstimatorJdkInfoProvider (javaHome)
0 commit comments