Skip to content

Commit c8665bc

Browse files
authored
Fix classpath (#2706)
1 parent 08234e2 commit c8665bc

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ jakartaVersion=3.1.0
104104
jacoDbVersion=1.4.3
105105
# TODO left outdated here to avoid exceeding GitHub packages drive space,
106106
# TODO run `gradle publishToMavenLocal -Pversion={usvmVersion}` locally in usvm project and update {usvmVersion} locally
107-
usvmVersion=comp-231130-17
107+
usvmVersion=comp-231130-19
108108

109109
# use latest Java 8 compaitable Spring and Spring Boot versions
110110
springVersion=5.3.28

utbot-junit-contest/src/main/kotlin/org/utbot/contest/Contest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fun main(args: Array<String>) {
113113
val tmpDir = outputDir.resolveSibling("data")
114114

115115
val cpEntries = classpathString.split(File.pathSeparator).map { File(it) }
116-
val classLoader = URLClassLoader(cpEntries.map { it.toUrl() }.toTypedArray())
116+
val classLoader = URLClassLoader(cpEntries.map { it.toUrl() }.toTypedArray(), null)
117117
val context = UtContext(classLoader)
118118

119119
val testCompileCp = System.getenv("UTBOT_CONTEST_TEST_COMPILE_CP")

utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/ContestUsvm.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ fun runUsvmGeneration(
9393
usePersistence = false,
9494
persistenceDir = tmpDir,
9595
classpath = classpathFiles,
96+
javaHome = JdkInfoService.provide().path.toFile(),
9697
machineOptions = UMachineOptions(
9798
// TODO usvm-sbft: if we have less than CONTEST_TEST_EXECUTION_TIMEOUT time left, we should try execute
9899
// with smaller timeout, but instrumentation currently doesn't allow to change timeout for individual runs
@@ -103,7 +104,6 @@ fun runUsvmGeneration(
103104
)
104105
) {
105106
// TODO usvm-sbft: we may want to tune these JcSettings for contest
106-
useJavaRuntime(JdkInfoService.provide().path.toFile())
107107
// TODO: require usePersistence=false for ClassScorer
108108
installFeatures(InMemoryHierarchy, Approximations, ClassScorer(TypeScorer, ::scoreClassNode))
109109
loadByteCode(classpathFiles)

utbot-junit-contest/src/main/kotlin/org/utbot/contest/usvm/jc/JcContainer.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class JcContainer private constructor(
2222
usePersistence: Boolean,
2323
persistenceDir: File,
2424
classpath: List<File>,
25+
javaHome: File,
2526
machineOptions: UMachineOptions,
2627
builder: JcSettings.() -> Unit,
2728
) : AutoCloseable {
@@ -46,6 +47,8 @@ class JcContainer private constructor(
4647

4748
val (db, cp) = runBlocking {
4849
val db = jacodb {
50+
useJavaRuntime(javaHome)
51+
4952
builder()
5053

5154
if (persistenceLocation != null) {
@@ -62,6 +65,7 @@ class JcContainer private constructor(
6265
JcRuntimeTraceInstrumenterFactory::class,
6366
cpPath,
6467
cp,
68+
javaHome.absolutePath,
6569
persistenceLocation,
6670
CONTEST_TEST_EXECUTION_TIMEOUT
6771
)
@@ -86,6 +90,7 @@ class JcContainer private constructor(
8690
usePersistence: Boolean,
8791
persistenceDir: File,
8892
classpath: List<File>,
93+
javaHome: File,
8994
machineOptions: UMachineOptions,
9095
builder: JcSettings.() -> Unit,
9196
): JcContainer {
@@ -94,7 +99,7 @@ class JcContainer private constructor(
9499
// TODO usvm-sbft: right now max cache size is 1, do we need to increase it?
95100
logger.info { "JcContainer cache miss" }
96101
close()
97-
JcContainer(usePersistence, persistenceDir, classpath, machineOptions, builder)
102+
JcContainer(usePersistence, persistenceDir, classpath, javaHome, machineOptions, builder)
98103
.also { cache[cacheKey] = it }
99104
}
100105
}

0 commit comments

Comments
 (0)