Make BlackBox tests for Java 9 generated
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.cli.common.output.writeAll
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
|
||||
import org.jetbrains.kotlin.test.ConfigurationKind
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
// TODO: merge into main codegen box tests somehow
|
||||
class Java9CodegenTest : AbstractBlackBoxCodegenTest() {
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
val fileName = KotlinTestUtils.getTestDataPathBase() + "/codegen/" + prefix + "/" + getTestName(true) + ".kt"
|
||||
val testFile = TestFile(fileName, File(fileName).readText())
|
||||
createEnvironmentWithMockJdkAndIdeaAnnotations(ConfigurationKind.NO_KOTLIN_REFLECT, listOf(testFile), TestJdkKind.FULL_JDK_9)
|
||||
}
|
||||
|
||||
override fun getPrefix(): String = "java9/box"
|
||||
|
||||
override fun blackBox(reportFailures: Boolean) {
|
||||
val tmpdir = KotlinTestUtils.tmpDirForTest(this)
|
||||
generateClassesInFile().writeAll(tmpdir, null)
|
||||
|
||||
val jdk9Home = KotlinTestUtils.getJdk9Home()
|
||||
val javaExe = File(jdk9Home, "bin/java.exe").takeIf(File::exists)
|
||||
?: File(jdk9Home, "bin/java").takeIf(File::exists)
|
||||
?: error("Can't find 'java' executable in $jdk9Home")
|
||||
|
||||
val command = arrayOf(
|
||||
javaExe.absolutePath,
|
||||
"-ea",
|
||||
"-classpath",
|
||||
listOf(tmpdir, ForTestCompileRuntime.runtimeJarForTests()).joinToString(File.pathSeparator, transform = File::getAbsolutePath),
|
||||
PackagePartClassUtils.getFilePartShortName(getTestName(false))
|
||||
)
|
||||
|
||||
val process = ProcessBuilder(*command).inheritIO().start()
|
||||
process.waitFor(1, TimeUnit.MINUTES)
|
||||
assertEquals(0, process.exitValue())
|
||||
}
|
||||
|
||||
fun testVarHandle() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamic() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamic200() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamic201() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamicIndy200() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamicIndy201() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamicWithInline() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
|
||||
fun testConcatDynamicInlineClasses() {
|
||||
loadFile()
|
||||
blackBox(true)
|
||||
}
|
||||
}
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/java9/box")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class Jdk9BlackBoxCodegenTestGenerated extends AbstractJdk9BlackBoxCodegenTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInBox() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/java9/box"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamic.kt")
|
||||
public void testConcatDynamic() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamic200.kt")
|
||||
public void testConcatDynamic200() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamic200.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamic201.kt")
|
||||
public void testConcatDynamic201() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamic201.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamicIndy200.kt")
|
||||
public void testConcatDynamicIndy200() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy200.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamicIndy201.kt")
|
||||
public void testConcatDynamicIndy201() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamicIndy201.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamicInlineClasses.kt")
|
||||
public void testConcatDynamicInlineClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamicInlineClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("concatDynamicWithInline.kt")
|
||||
public void testConcatDynamicWithInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/concatDynamicWithInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("varHandle.kt")
|
||||
public void testVarHandle() throws Exception {
|
||||
runTest("compiler/testData/codegen/java9/box/varHandle.kt");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user