From 990c2dc5d77a002154e14a666cd9541948b95cfa Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Thu, 10 Sep 2015 17:51:03 +0200 Subject: [PATCH] Extending daemon diagnostics reporting in tests --- .../kotlin/daemon/CompilerDaemonTest.kt | 16 +++++++++++----- .../kotlin/jps/build/SimpleKotlinJpsBuildTest.kt | 3 +++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/compiler/tests/org/jetbrains/kotlin/daemon/CompilerDaemonTest.kt b/compiler/tests/org/jetbrains/kotlin/daemon/CompilerDaemonTest.kt index 43efba74df2..2222d51b01a 100644 --- a/compiler/tests/org/jetbrains/kotlin/daemon/CompilerDaemonTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/daemon/CompilerDaemonTest.kt @@ -39,11 +39,17 @@ public class CompilerDaemonTest : KotlinIntegrationTestBase() { File("dependencies/bootstrap-compiler/Kotlin/kotlinc/lib/kotlin-reflect.jar")) } private fun compileOnDaemon(args: Array): 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 { diff --git a/jps-plugin/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt b/jps-plugin/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt index b53e3bec6c2..591da70fc26 100644 --- a/jps-plugin/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt +++ b/jps-plugin/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt @@ -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) } }