Add JVM/JVM_IR mixed compilation tests for compileKotlinAgainstKotlin/boxInline

This commit is contained in:
Alexander Udalov
2020-08-28 20:56:28 +02:00
parent e324733b01
commit 9e357354fb
20 changed files with 10190 additions and 15 deletions
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.psi.KtFile;
import org.jetbrains.kotlin.test.ConfigurationKind;
import org.jetbrains.kotlin.test.InTextDirectivesUtils;
import org.jetbrains.kotlin.test.KotlinTestUtils;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
import java.io.File;
@@ -99,11 +100,21 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
);
}
@NotNull
protected TargetBackend getBackendA() {
return getBackend();
}
@NotNull
protected TargetBackend getBackendB() {
return getBackend();
}
@NotNull
private ClassFileFactory compileA(@NotNull TestFile testFile, List<TestFile> files) {
Disposable compileDisposable = createDisposable("compileA");
CompilerConfiguration configuration = createConfiguration(
ConfigurationKind.ALL, getTestJdkKind(files), getBackend(),
ConfigurationKind.ALL, getTestJdkKind(files), getBackendA(),
Collections.singletonList(KotlinTestUtils.getAnnotationsJar()),
Collections.emptyList(), Collections.singletonList(testFile)
);
@@ -126,7 +137,7 @@ public abstract class AbstractCompileKotlinAgainstKotlinTest extends CodegenTest
private ClassFileFactory compileB(@NotNull TestFile testFile, List<TestFile> files) {
String commonHeader = StringsKt.substringBefore(files.get(0).content, "FILE:", "");
CompilerConfiguration configuration = createConfiguration(
ConfigurationKind.ALL, getTestJdkKind(files), getBackend(),
ConfigurationKind.ALL, getTestJdkKind(files), getBackendB(),
Arrays.asList(KotlinTestUtils.getAnnotationsJar(), aDir),
Collections.emptyList(), Arrays.asList(testFile, new TestFile("header", commonHeader))
);
@@ -9,5 +9,19 @@ import org.jetbrains.kotlin.codegen.AbstractCompileKotlinAgainstInlineKotlinTest
import org.jetbrains.kotlin.test.TargetBackend
abstract class AbstractIrCompileKotlinAgainstInlineKotlinTest : AbstractCompileKotlinAgainstInlineKotlinTest() {
override val backend = TargetBackend.JVM_IR
override val backend: TargetBackend get() = TargetBackend.JVM_IR
}
abstract class AbstractJvmIrAgainstOldBoxInlineTest : AbstractIrCompileKotlinAgainstInlineKotlinTest() {
override val backend: TargetBackend get() = TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD
override fun getBackendA(): TargetBackend = TargetBackend.JVM
override fun getBackendB(): TargetBackend = TargetBackend.JVM_IR
}
abstract class AbstractJvmOldAgainstIrBoxInlineTest : AbstractIrCompileKotlinAgainstInlineKotlinTest() {
override val backend: TargetBackend get() = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR
override fun getBackendA(): TargetBackend = TargetBackend.JVM_IR
override fun getBackendB(): TargetBackend = TargetBackend.JVM
}
@@ -9,5 +9,19 @@ import org.jetbrains.kotlin.codegen.AbstractCompileKotlinAgainstKotlinTest
import org.jetbrains.kotlin.test.TargetBackend
abstract class AbstractIrCompileKotlinAgainstKotlinTest : AbstractCompileKotlinAgainstKotlinTest() {
override val backend = TargetBackend.JVM_IR
override val backend: TargetBackend get() = TargetBackend.JVM_IR
}
abstract class AbstractJvmIrAgainstOldBoxTest : AbstractIrCompileKotlinAgainstKotlinTest() {
override val backend: TargetBackend get() = TargetBackend.JVM_MULTI_MODULE_IR_AGAINST_OLD
override fun getBackendA(): TargetBackend = TargetBackend.JVM
override fun getBackendB(): TargetBackend = TargetBackend.JVM_IR
}
abstract class AbstractJvmOldAgainstIrBoxTest : AbstractIrCompileKotlinAgainstKotlinTest() {
override val backend: TargetBackend get() = TargetBackend.JVM_MULTI_MODULE_OLD_AGAINST_IR
override fun getBackendA(): TargetBackend = TargetBackend.JVM_IR
override fun getBackendB(): TargetBackend = TargetBackend.JVM
}
@@ -13,6 +13,8 @@ enum class TargetBackend(
JVM(false),
JVM_OLD(false, JVM),
JVM_IR(true, JVM),
JVM_MULTI_MODULE_IR_AGAINST_OLD(true, JVM_IR),
JVM_MULTI_MODULE_OLD_AGAINST_IR(false, JVM),
JS(false),
JS_IR(true, JS),
JS_IR_ES6(true, JS_IR),