Extending daemon diagnostics reporting in tests

This commit is contained in:
Ilya Chernikov
2015-09-10 17:51:03 +02:00
parent cbaa981aab
commit 990c2dc5d7
2 changed files with 14 additions and 5 deletions
@@ -39,11 +39,17 @@ public class CompilerDaemonTest : KotlinIntegrationTestBase() {
File("dependencies/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-reflect.jar")) }
private fun compileOnDaemon(args: Array<out String>): CompilerResults {
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, DaemonReportingTargets(out = System.err), autostart = true, checkId = true)
TestCase.assertNotNull("failed to connect daemon", daemon)
val strm = ByteArrayOutputStream()
val code = KotlinCompilerClient.compile(daemon!!, args, strm)
return CompilerResults(code, strm.toString())
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "")
try {
val daemon = KotlinCompilerClient.connectToCompileService(compilerId, daemonJVMOptions, daemonOptions, DaemonReportingTargets(out = System.err), autostart = true, checkId = true)
TestCase.assertNotNull("failed to connect daemon", daemon)
val strm = ByteArrayOutputStream()
val code = KotlinCompilerClient.compile(daemon!!, args, strm)
return CompilerResults(code, strm.toString())
}
finally {
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
}
}
private fun runDaemonCompilerTwice(logName: String, vararg arguments: String): Unit {
@@ -20,6 +20,7 @@ import com.intellij.util.PathUtil
import org.jetbrains.jps.model.java.JpsJavaExtensionService
import org.jetbrains.kotlin.rmi.COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY
import org.jetbrains.kotlin.rmi.COMPILE_DAEMON_ENABLED_PROPERTY
import org.jetbrains.kotlin.rmi.COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY
import org.jetbrains.kotlin.test.JetTestUtils
import java.io.File
@@ -110,6 +111,7 @@ public class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
public fun testThreeModulesNoReexportWithDaemon() {
System.setProperty(COMPILE_DAEMON_ENABLED_PROPERTY,"")
System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "")
val flagFile = File.createTempFile("kotlin-jps-tests-", "-is-running");
try {
System.setProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY, flagFile.absolutePath)
@@ -118,6 +120,7 @@ public class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
finally {
flagFile.delete()
System.clearProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY)
System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY)
System.clearProperty(COMPILE_DAEMON_ENABLED_PROPERTY)
}
}