Skip to content

Fix classpath #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jakartaVersion=3.1.0
jacoDbVersion=1.4.3
# TODO left outdated here to avoid exceeding GitHub packages drive space,
# TODO run `gradle publishToMavenLocal -Pversion={usvmVersion}` locally in usvm project and update {usvmVersion} locally
usvmVersion=comp-231130-17
usvmVersion=comp-231130-19

# use latest Java 8 compaitable Spring and Spring Boot versions
springVersion=5.3.28
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fun main(args: Array<String>) {
val tmpDir = outputDir.resolveSibling("data")

val cpEntries = classpathString.split(File.pathSeparator).map { File(it) }
val classLoader = URLClassLoader(cpEntries.map { it.toUrl() }.toTypedArray())
val classLoader = URLClassLoader(cpEntries.map { it.toUrl() }.toTypedArray(), null)
val context = UtContext(classLoader)

val testCompileCp = System.getenv("UTBOT_CONTEST_TEST_COMPILE_CP")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fun runUsvmGeneration(
usePersistence = false,
persistenceDir = tmpDir,
classpath = classpathFiles,
javaHome = JdkInfoService.provide().path.toFile(),
machineOptions = UMachineOptions(
// TODO usvm-sbft: if we have less than CONTEST_TEST_EXECUTION_TIMEOUT time left, we should try execute
// with smaller timeout, but instrumentation currently doesn't allow to change timeout for individual runs
Expand All @@ -103,7 +104,6 @@ fun runUsvmGeneration(
)
) {
// TODO usvm-sbft: we may want to tune these JcSettings for contest
useJavaRuntime(JdkInfoService.provide().path.toFile())
// TODO: require usePersistence=false for ClassScorer
installFeatures(InMemoryHierarchy, Approximations, ClassScorer(TypeScorer, ::scoreClassNode))
loadByteCode(classpathFiles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class JcContainer private constructor(
usePersistence: Boolean,
persistenceDir: File,
classpath: List<File>,
javaHome: File,
machineOptions: UMachineOptions,
builder: JcSettings.() -> Unit,
) : AutoCloseable {
Expand All @@ -46,6 +47,8 @@ class JcContainer private constructor(

val (db, cp) = runBlocking {
val db = jacodb {
useJavaRuntime(javaHome)

builder()

if (persistenceLocation != null) {
Expand All @@ -62,6 +65,7 @@ class JcContainer private constructor(
JcRuntimeTraceInstrumenterFactory::class,
cpPath,
cp,
javaHome.absolutePath,
persistenceLocation,
CONTEST_TEST_EXECUTION_TIMEOUT
)
Expand All @@ -86,6 +90,7 @@ class JcContainer private constructor(
usePersistence: Boolean,
persistenceDir: File,
classpath: List<File>,
javaHome: File,
machineOptions: UMachineOptions,
builder: JcSettings.() -> Unit,
): JcContainer {
Expand All @@ -94,7 +99,7 @@ class JcContainer private constructor(
// TODO usvm-sbft: right now max cache size is 1, do we need to increase it?
logger.info { "JcContainer cache miss" }
close()
JcContainer(usePersistence, persistenceDir, classpath, machineOptions, builder)
JcContainer(usePersistence, persistenceDir, classpath, javaHome, machineOptions, builder)
.also { cache[cacheKey] = it }
}
}
Expand Down