From ab2b4311fd1af6e4d36f7e23214f0901c926d143 Mon Sep 17 00:00:00 2001 From: Sergey Rostov Date: Mon, 26 Nov 2018 14:31:10 +0300 Subject: [PATCH] JPS: fix SimpleKotlinJpsBuildTest.testDaemon Make it the same as testJpsDaemonIC --- .../jps/build/SimpleKotlinJpsBuildTest.kt | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt index 6b5f8179062..8c915775fa6 100644 --- a/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt +++ b/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/SimpleKotlinJpsBuildTest.kt @@ -16,8 +16,10 @@ package org.jetbrains.kotlin.jps.build +import com.intellij.openapi.util.io.FileUtil import com.intellij.util.PathUtil import org.jetbrains.jps.model.java.JpsJavaExtensionService +import org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner import org.jetbrains.kotlin.daemon.common.* import org.jetbrains.kotlin.test.KotlinTestUtils import java.io.File @@ -66,22 +68,16 @@ class SimpleKotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() { // TODO: add JS tests fun testDaemon() { - System.setProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "") - System.setProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "") - // spaces in the name to test proper file name handling - val flagFile = File.createTempFile("kotlin-jps - tests-", "-is-running") - val logFile = File.createTempFile("kotlin-daemon", ".log") - System.setProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY, flagFile.absolutePath) - System.setProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY, logFile.loggerCompatiblePath) - try { - testLoadingKotlinFromDifferentModules() - } - finally { - flagFile.delete() - System.clearProperty(COMPILE_DAEMON_LOG_PATH_PROPERTY) - System.clearProperty(COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY) - System.clearProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) - System.clearProperty(COMPILE_DAEMON_ENABLED_PROPERTY) + val daemonHome = FileUtil.createTempDirectory("daemon-home", "testJpsDaemonIC") + + withSystemProperty(COMPILE_DAEMON_CUSTOM_RUN_FILES_PATH_FOR_TESTS, daemonHome.absolutePath) { + withSystemProperty(COMPILE_DAEMON_ENABLED_PROPERTY, "true") { + withSystemProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY, "true") { + withSystemProperty(JpsKotlinCompilerRunner.FAIL_ON_FALLBACK_PROPERTY, "true") { + testLoadingKotlinFromDifferentModules() + } + } + } } } }