Skip to content

Commit 17eed5d

Browse files
committed
Ignore test that requires a second JDK installation
1 parent 143b175 commit 17eed5d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

core/src/test/kotlin/com/tschuchort/compiletesting/KotlinCompilationTests.kt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import org.assertj.core.api.Assertions.assertThat
77
import org.jetbrains.kotlin.compiler.plugin.AbstractCliOption
88
import org.jetbrains.kotlin.compiler.plugin.CliOption
99
import org.jetbrains.kotlin.compiler.plugin.CommandLineProcessor
10+
import org.junit.Ignore
1011
import org.junit.Rule
1112
import org.junit.Test
1213
import org.junit.rules.TemporaryFolder
1314
import java.io.ByteArrayOutputStream
1415
import java.io.File
16+
import java.nio.file.Files
1517
import javax.annotation.processing.AbstractProcessor
1618
import javax.annotation.processing.RoundEnvironment
1719
import javax.lang.model.element.TypeElement
@@ -830,33 +832,32 @@ class KotlinCompilationTests {
830832
)
831833
}
832834

835+
@Ignore // Ignored because symlinks can't be created on Windows 7 without admin rights
833836
@Test
834837
fun `java compilation runs in a sub-process when jdk is specified`() {
835838
val source = SourceFile.java("JSource.java",
836839
"""
837840
class JSource {}
838841
""".trimIndent())
839-
val fakeJdkHome = temporaryFolder.newFolder("fake-jdk-home")
840-
fakeJdkHome.resolve("bin").mkdirs()
842+
val fakeJdkHome = temporaryFolder.newFolder("jdk-copy")
843+
fakeJdkHome.mkdirs()
844+
Files.createLink(fakeJdkHome.resolve("bin").toPath(), processJdkHome.toPath())
841845
val logsStream = ByteArrayOutputStream()
842846
val compiler = defaultCompilerConfig().apply {
843847
sources = listOf(source)
844848
jdkHome = fakeJdkHome
845849
messageOutputStream = logsStream
846850
}
847-
val compilation = runCatching {
848-
// jdk is fake so it won't compile
849-
compiler.compile()
850-
}
851-
// it should fail since we are passing a fake jdk
852-
assertThat(compilation.isFailure).isTrue()
851+
val result = compiler.compile()
852+
assertThat(result.exitCode).isEqualTo(ExitCode.COMPILATION_ERROR)
853853
val logs = logsStream.toString("utf-8")// use string charset for jdk 8 compatibility
854854
assertThat(logs).contains(
855855
"compiling java in a sub-process because a jdkHome is specified"
856856
)
857857
assertThat(logs).doesNotContain(
858858
"jdkHome is set to null, removing boot classpath from java compilation"
859859
)
860+
fakeJdkHome.delete()
860861
}
861862

862863
class InheritedClass {}

0 commit comments

Comments
 (0)