Skip to content

Commit

Permalink
using correct JDK to run workers
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullinAM committed Feb 22, 2024
1 parent 5103aa5 commit 5625e2e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 7 additions & 0 deletions kex-core/src/main/kotlin/org/vorpal/research/kex/util/rt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import org.vorpal.research.kthelper.assert.unreachable
import org.vorpal.research.kthelper.logging.log
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths
import kotlin.io.path.readLines

val Config.outputDirectory: Path get() = getPathValue("kex", "outputDir")!!.normalize()
Expand Down Expand Up @@ -50,6 +51,12 @@ val Config.libPath: Path?
runtimeDepsPath?.resolve(it)?.normalize()
}

fun getJDKPath(): Path {
return Paths.get(System.getProperty("java.home")).parent.toAbsolutePath()
}

fun getJavaPath(): Path = getJDKPath().resolve("bin", "java").toAbsolutePath()

fun getRuntime(): Container? {
if (!kexConfig.getBooleanValue("kex", "useJavaRuntime", true)) return null
val libPath = kexConfig.libPath ?: return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionTimedOutResult
import org.vorpal.research.kex.trace.symbolic.protocol.Master2ClientConnection
import org.vorpal.research.kex.trace.symbolic.protocol.Master2WorkerConnection
import org.vorpal.research.kex.trace.symbolic.protocol.MasterProtocolHandler
import org.vorpal.research.kex.util.getJavaPath
import org.vorpal.research.kex.util.getJvmModuleParams
import org.vorpal.research.kex.util.getPathSeparator
import org.vorpal.research.kex.util.newFixedThreadPoolContextWithMDC
Expand Down Expand Up @@ -84,7 +85,7 @@ class ExecutorMaster(

private fun createProcess(): Process {
val pb = ProcessBuilder(
"java",
getJavaPath().toString(),
*workerJvmParams,
"-Djava.security.manager",
"-Djava.security.policy==${executorPolicyPath}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionCompletedResult
import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionResult
import org.vorpal.research.kex.trace.symbolic.protocol.ExecutionTimedOutResult
import org.vorpal.research.kex.trace.symbolic.protocol.TestExecutionRequest
import org.vorpal.research.kex.util.getJavaPath
import org.vorpal.research.kex.util.getJvmModuleParams
import org.vorpal.research.kex.util.getPathSeparator
import org.vorpal.research.kex.util.outputDirectory
Expand Down Expand Up @@ -56,7 +57,7 @@ internal object ExecutorMasterController : AutoCloseable {

val kfgClassPath = ctx.classPath
val pb = ProcessBuilder(
"java",
getJavaPath().toString(),
"-Djava.security.manager", "-Djava.security.policy==${executorPolicyPath}",
"-Dlogback.statusListenerClass=ch.qos.logback.core.status.NopStatusListener",
*getJvmModuleParams().toTypedArray(),
Expand Down

0 comments on commit 5625e2e

Please sign in to comment.