Set java.io.tmpdir to Gradle's build directory for unit and integration tests. (#638)

This commit is contained in:
Chris Rankin 2017-05-05 17:30:51 +01:00 committed by GitHub
parent 25dbac0f07
commit 0ed009dfa0
2 changed files with 11 additions and 2 deletions

View File

@ -123,6 +123,11 @@ allprojects {
} }
} }
tasks.withType(Test) {
// Prevent the project from creating temporary files outside of the build directory.
systemProperties['java.io.tmpdir'] = buildDir
}
group 'net.corda' group 'net.corda'
version "$corda_release_version" version "$corda_release_version"

View File

@ -589,7 +589,8 @@ class DriverDSL(
val systemProperties = overriddenSystemProperties + mapOf( val systemProperties = overriddenSystemProperties + mapOf(
"name" to nodeConf.myLegalName, "name" to nodeConf.myLegalName,
"visualvm.display.name" to "corda-${nodeConf.myLegalName}" "visualvm.display.name" to "corda-${nodeConf.myLegalName}",
"java.io.tmpdir" to System.getProperty("java.io.tmpdir") // Inherit from parent process
) )
val extraJvmArguments = systemProperties.map { "-D${it.key}=${it.value}" } + val extraJvmArguments = systemProperties.map { "-D${it.key}=${it.value}" } +
"-javaagent:$quasarJarPath" "-javaagent:$quasarJarPath"
@ -621,7 +622,10 @@ class DriverDSL(
className = className, // cannot directly get class for this, so just use string className = className, // cannot directly get class for this, so just use string
arguments = listOf("--base-directory", handle.configuration.baseDirectory.toString()), arguments = listOf("--base-directory", handle.configuration.baseDirectory.toString()),
jdwpPort = debugPort, jdwpPort = debugPort,
extraJvmArguments = listOf("-Dname=node-${handle.configuration.p2pAddress}-webserver"), extraJvmArguments = listOf(
"-Dname=node-${handle.configuration.p2pAddress}-webserver",
"-Djava.io.tmpdir=${System.getProperty("java.io.tmpdir")}" // Inherit from parent process
),
errorLogPath = Paths.get("error.$className.log") errorLogPath = Paths.get("error.$className.log")
) )
}.flatMap { process -> addressMustBeBound(executorService, handle.webAddress, process).map { process } } }.flatMap { process -> addressMustBeBound(executorService, handle.webAddress, process).map { process } }