Adapt test infrastructure to the latest changes
^KT-43677 In Progress
This commit is contained in:
+4
-4
@@ -7,7 +7,6 @@ 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
|
||||
@@ -36,7 +35,9 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes
|
||||
}
|
||||
|
||||
override fun runJavacTask(files: MutableCollection<File>, options: List<String>) {
|
||||
KotlinTestUtils.compileJavaFilesExternally(files, options + getAdditionalJavacArgs(), getJdkHome())
|
||||
assert(KotlinTestUtils.compileJavaFilesExternally(files, options, getJdkHome())) {
|
||||
"Javac failed: $options on $files"
|
||||
}
|
||||
}
|
||||
|
||||
override fun getTestJdkKind(files: List<TestFile>): TestJdkKind {
|
||||
@@ -46,7 +47,6 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes
|
||||
abstract fun getTestJdkKind(): TestJdkKind
|
||||
abstract fun getJdkHome(): File
|
||||
|
||||
open fun getAdditionalJavacArgs(): List<String> = emptyList()
|
||||
open fun getAdditionalJvmArgs(): List<String> = emptyList()
|
||||
|
||||
abstract override fun getPrefix(): String
|
||||
@@ -78,4 +78,4 @@ abstract class AbstractCustomJDKBlackBoxCodegenTest : AbstractBlackBoxCodegenTes
|
||||
process.waitFor(1, TimeUnit.MINUTES)
|
||||
assertEquals(0, process.exitValue())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -5,7 +5,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.jvm.compiler.ADDITIONAL_JAVAC_ARGS_FOR_15
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import org.jetbrains.kotlin.test.TestJdkKind
|
||||
import java.io.File
|
||||
@@ -15,7 +14,6 @@ abstract class AbstractJdk15BlackBoxCodegenTest : AbstractCustomJDKBlackBoxCodeg
|
||||
override fun getJdkHome(): File = KotlinTestUtils.getJdk15Home()
|
||||
override fun getPrefix(): String = "java15/box"
|
||||
|
||||
override fun getAdditionalJavacArgs(): List<String> = ADDITIONAL_JAVAC_ARGS_FOR_15
|
||||
override fun getAdditionalJvmArgs(): List<String> = listOf("--enable-preview")
|
||||
|
||||
override fun verifyWithDex(): Boolean = false
|
||||
|
||||
@@ -556,6 +556,14 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
|
||||
for (TestFile file : files) {
|
||||
javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:"));
|
||||
}
|
||||
|
||||
if (kotlinTarget != null && kotlinTarget.isPreview()) {
|
||||
javacOptions.add("--release");
|
||||
javacOptions.add(kotlinTarget.getDescriptionForJavacArgument());
|
||||
javacOptions.add("--enable-preview");
|
||||
return javacOptions;
|
||||
}
|
||||
|
||||
String javaTarget = computeJavaTarget(javacOptions, kotlinTarget);
|
||||
if (javaTarget != null) {
|
||||
javacOptions.add("-source");
|
||||
@@ -574,7 +582,7 @@ public abstract class CodegenTestCase extends KotlinBaseTest<KotlinBaseTest.Test
|
||||
if (JAVA_COMPILATION_TARGET != null && !javacOptions.contains("-target"))
|
||||
return JAVA_COMPILATION_TARGET;
|
||||
if (kotlinTarget != null && kotlinTarget.compareTo(JvmTarget.JVM_1_6) > 0)
|
||||
return kotlinTarget.getDescription();
|
||||
return kotlinTarget.getDescriptionForJavacArgument();
|
||||
if (IS_SOURCE_6_STILL_SUPPORTED)
|
||||
return "1.6";
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user