Tests: remove bytecode listing tests for old JVM backend

These tests are mostly used to check ABI in case you're compiling a
library or library-like code, which is no longer possible (since old JVM
backend is only used in the IDE).
This commit is contained in:
Alexander Udalov
2023-11-01 15:44:42 +01:00
committed by Space Team
parent 56936e2012
commit 1cf04916d6
8 changed files with 10 additions and 2725 deletions
@@ -9,8 +9,6 @@ import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.BlackBoxCodegenSuppressor
import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput
import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade
import org.jetbrains.kotlin.test.backend.handlers.BytecodeListingHandler
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
@@ -18,7 +16,6 @@ import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.builders.configureJvmArtifactsHandlersStep
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
@@ -28,20 +25,18 @@ import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.runners.AbstractKotlinCompilerWithTargetBackendTest
abstract class AbstractBytecodeListingTestBase<R : ResultingArtifact.FrontendOutput<R>, I : ResultingArtifact.BackendInput<I>>(
targetBackend: TargetBackend,
abstract class AbstractBytecodeListingTestBase<R : ResultingArtifact.FrontendOutput<R>>(
val targetFrontend: FrontendKind<R>
) : AbstractKotlinCompilerWithTargetBackendTest(targetBackend) {
) : AbstractKotlinCompilerWithTargetBackendTest(TargetBackend.JVM_IR) {
abstract val frontendFacade: Constructor<FrontendFacade<R>>
abstract val frontendToBackendConverter: Constructor<Frontend2BackendConverter<R, I>>
abstract val backendFacade: Constructor<BackendFacade<I, BinaryArtifacts.Jvm>>
abstract val frontendToBackendConverter: Constructor<Frontend2BackendConverter<R, IrBackendInput>>
override fun TestConfigurationBuilder.configuration() {
defaultDirectives {
+CodegenTestDirectives.CHECK_BYTECODE_LISTING
}
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, backendFacade)
commonConfigurationForTest(targetFrontend, frontendFacade, frontendToBackendConverter, ::JvmIrBackendFacade)
commonHandlersForCodegenTest()
configureJvmArtifactsHandlersStep {
@@ -52,46 +47,22 @@ abstract class AbstractBytecodeListingTestBase<R : ResultingArtifact.FrontendOut
}
}
open class AbstractBytecodeListingTest : AbstractBytecodeListingTestBase<ClassicFrontendOutputArtifact, ClassicBackendInput>(
TargetBackend.JVM, FrontendKinds.ClassicFrontend
) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, ClassicBackendInput>>
get() = ::ClassicFrontend2ClassicBackendConverter
override val backendFacade: Constructor<BackendFacade<ClassicBackendInput, BinaryArtifacts.Jvm>>
get() = ::ClassicJvmBackendFacade
}
open class AbstractIrBytecodeListingTest : AbstractBytecodeListingTestBase<ClassicFrontendOutputArtifact, IrBackendInput>(
TargetBackend.JVM_IR, FrontendKinds.ClassicFrontend
) {
open class AbstractIrBytecodeListingTest : AbstractBytecodeListingTestBase<ClassicFrontendOutputArtifact>(FrontendKinds.ClassicFrontend) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, IrBackendInput>>
get() = ::ClassicFrontend2IrConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
}
abstract class AbstractFirBytecodeListingTestBase(val parser: FirParser) :
AbstractBytecodeListingTestBase<FirOutputArtifact, IrBackendInput>(
TargetBackend.JVM_IR,
FrontendKinds.FIR
) {
AbstractBytecodeListingTestBase<FirOutputArtifact>(FrontendKinds.FIR) {
override val frontendFacade: Constructor<FrontendFacade<FirOutputArtifact>>
get() = ::FirFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<FirOutputArtifact, IrBackendInput>>
get() = ::Fir2IrJvmResultsConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.configureFirParser(parser)
@@ -171,10 +171,6 @@ fun generateJUnit5CompilerTests(args: Array<String>, mainClassName: String?) {
model("codegen/boxInline")
}
testClass<AbstractBytecodeListingTest> {
model("codegen/bytecodeListing")
}
testClass<AbstractIrBytecodeListingTest> {
model("codegen/bytecodeListing")
}
@@ -289,9 +289,6 @@ fun main(args: Array<String>) {
}
testGroup("plugins/allopen/tests-gen", "plugins/allopen/testData") {
testClass<AbstractBytecodeListingTestForAllOpen> {
model("bytecodeListing", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractIrBytecodeListingTestForAllOpen> {
model("bytecodeListing", excludedPattern = excludedFirTestdataPattern)
}
@@ -316,9 +313,6 @@ fun main(args: Array<String>) {
testClass<AbstractFirPsiDiagnosticsTestForNoArg> {
model("diagnostics", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractBytecodeListingTestForNoArg> {
model("bytecodeListing", excludedPattern = excludedFirTestdataPattern)
}
testClass<AbstractIrBytecodeListingTestForNoArg> {
model("bytecodeListing", excludedPattern = excludedFirTestdataPattern)
}
@@ -18,14 +18,9 @@ package org.jetbrains.kotlin.allopen
import org.jetbrains.kotlin.test.Constructor
import org.jetbrains.kotlin.test.FirParser
import org.jetbrains.kotlin.test.TargetBackend
import org.jetbrains.kotlin.test.backend.classic.ClassicBackendInput
import org.jetbrains.kotlin.test.backend.classic.ClassicJvmBackendFacade
import org.jetbrains.kotlin.test.backend.ir.IrBackendInput
import org.jetbrains.kotlin.test.backend.ir.JvmIrBackendFacade
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.configureFirParser
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2ClassicBackendConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontend2IrConverter
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendFacade
import org.jetbrains.kotlin.test.frontend.classic.ClassicFrontendOutputArtifact
@@ -35,10 +30,9 @@ import org.jetbrains.kotlin.test.frontend.fir.FirOutputArtifact
import org.jetbrains.kotlin.test.model.*
import org.jetbrains.kotlin.test.runners.codegen.AbstractBytecodeListingTestBase
abstract class AbstractBytecodeListingTestForAllOpenBase<R : ResultingArtifact.FrontendOutput<R>, I : ResultingArtifact.BackendInput<I>>(
targetBackend: TargetBackend,
abstract class AbstractBytecodeListingTestForAllOpenBase<R : ResultingArtifact.FrontendOutput<R>>(
targetFrontend: FrontendKind<R>
) : AbstractBytecodeListingTestBase<R, I>(targetBackend, targetFrontend){
) : AbstractBytecodeListingTestBase<R>(targetFrontend) {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.apply {
@@ -47,40 +41,20 @@ abstract class AbstractBytecodeListingTestForAllOpenBase<R : ResultingArtifact.F
}
}
open class AbstractBytecodeListingTestForAllOpen :
AbstractBytecodeListingTestForAllOpenBase<ClassicFrontendOutputArtifact, ClassicBackendInput>(
TargetBackend.JVM, FrontendKinds.ClassicFrontend
) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, ClassicBackendInput>>
get() = ::ClassicFrontend2ClassicBackendConverter
override val backendFacade: Constructor<BackendFacade<ClassicBackendInput, BinaryArtifacts.Jvm>>
get() = ::ClassicJvmBackendFacade
}
open class AbstractIrBytecodeListingTestForAllOpen :
AbstractBytecodeListingTestForAllOpenBase<ClassicFrontendOutputArtifact, IrBackendInput>(
TargetBackend.JVM_IR, FrontendKinds.ClassicFrontend
) {
AbstractBytecodeListingTestForAllOpenBase<ClassicFrontendOutputArtifact>(FrontendKinds.ClassicFrontend) {
override val frontendFacade: Constructor<FrontendFacade<ClassicFrontendOutputArtifact>>
get() = ::ClassicFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<ClassicFrontendOutputArtifact, IrBackendInput>>
get() = ::ClassicFrontend2IrConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
}
open class AbstractFirPsiBytecodeListingTestForAllOpen :
AbstractBytecodeListingTestForAllOpenBase<FirOutputArtifact, IrBackendInput>(
TargetBackend.JVM_IR, FrontendKinds.FIR
) {
AbstractBytecodeListingTestForAllOpenBase<FirOutputArtifact>(FrontendKinds.FIR) {
override val frontendFacade: Constructor<FrontendFacade<FirOutputArtifact>>
get() = ::FirFrontendFacade
override val frontendToBackendConverter: Constructor<Frontend2BackendConverter<FirOutputArtifact, IrBackendInput>>
get() = ::Fir2IrJvmResultsConverter
override val backendFacade: Constructor<BackendFacade<IrBackendInput, BinaryArtifacts.Jvm>>
get() = ::JvmIrBackendFacade
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
@@ -1,123 +0,0 @@
/*
* Copyright 2010-2023 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.allopen;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("plugins/allopen/testData/bytecodeListing")
@TestDataPath("$PROJECT_ROOT")
public class BytecodeListingTestForAllOpenGenerated extends AbstractBytecodeListingTestForAllOpen {
@Test
public void testAllFilesPresentInBytecodeListing() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/allopen/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), TargetBackend.JVM, true);
}
@Test
@TestMetadata("allOpenOnNotClasses.kt")
public void testAllOpenOnNotClasses() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/allOpenOnNotClasses.kt");
}
@Test
@TestMetadata("alreadyOpen.kt")
public void testAlreadyOpen() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/alreadyOpen.kt");
}
@Test
@TestMetadata("annotationMembers.kt")
public void testAnnotationMembers() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/annotationMembers.kt");
}
@Test
@TestMetadata("anonymousObject.kt")
public void testAnonymousObject() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/anonymousObject.kt");
}
@Test
@TestMetadata("explicitFinal.kt")
public void testExplicitFinal() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/explicitFinal.kt");
}
@Test
@TestMetadata("metaAnnotation_differentModules.kt")
public void testMetaAnnotation_differentModules() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/metaAnnotation_differentModules.kt");
}
@Test
@TestMetadata("metaAnnotation_sameModule.kt")
public void testMetaAnnotation_sameModule() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/metaAnnotation_sameModule.kt");
}
@Test
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/nestedClass.kt");
}
@Test
@TestMetadata("nestedInner.kt")
public void testNestedInner() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/nestedInner.kt");
}
@Test
@TestMetadata("noAllOpen.kt")
public void testNoAllOpen() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/noAllOpen.kt");
}
@Test
@TestMetadata("privateMembers.kt")
public void testPrivateMembers() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/privateMembers.kt");
}
@Test
@TestMetadata("sealed.kt")
public void testSealed() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/sealed.kt");
}
@Test
@TestMetadata("severalAllOpen.kt")
public void testSeveralAllOpen() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/severalAllOpen.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/simple.kt");
}
@Test
@TestMetadata("springAnnotations.kt")
public void testSpringAnnotations() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/springAnnotations.kt");
}
@Test
@TestMetadata("superClassAnnotation.kt")
public void testSuperClassAnnotation() throws Exception {
runTest("plugins/allopen/testData/bytecodeListing/superClassAnnotation.kt");
}
}
@@ -43,13 +43,6 @@ open class AbstractFirLightTreeBlackBoxCodegenTestForNoArg : AbstractFirLightTre
// ---------------------------- bytecode ----------------------------
open class AbstractBytecodeListingTestForNoArg : AbstractBytecodeListingTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
builder.enableNoArg()
}
}
open class AbstractIrBytecodeListingTestForNoArg : AbstractIrBytecodeListingTest() {
override fun configure(builder: TestConfigurationBuilder) {
super.configure(builder)
@@ -1,81 +0,0 @@
/*
* Copyright 2010-2023 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.noarg;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TargetBackend;
import org.jetbrains.kotlin.test.TestMetadata;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.GenerateTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("plugins/noarg/testData/bytecodeListing")
@TestDataPath("$PROJECT_ROOT")
public class BytecodeListingTestForNoArgGenerated extends AbstractBytecodeListingTestForNoArg {
@Test
public void testAllFilesPresentInBytecodeListing() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("plugins/noarg/testData/bytecodeListing"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), TargetBackend.JVM, true);
}
@Test
@TestMetadata("annoOnNotClass.kt")
public void testAnnoOnNotClass() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/annoOnNotClass.kt");
}
@Test
@TestMetadata("constructorVisibility.kt")
public void testConstructorVisibility() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/constructorVisibility.kt");
}
@Test
@TestMetadata("defaultParameters.kt")
public void testDefaultParameters() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/defaultParameters.kt");
}
@Test
@TestMetadata("inherited.kt")
public void testInherited() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/inherited.kt");
}
@Test
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/nestedClass.kt");
}
@Test
@TestMetadata("noNoArg.kt")
public void testNoNoArg() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/noNoArg.kt");
}
@Test
@TestMetadata("severalNoArg.kt")
public void testSeveralNoArg() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/severalNoArg.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/simple.kt");
}
@Test
@TestMetadata("superTypes.kt")
public void testSuperTypes() throws Exception {
runTest("plugins/noarg/testData/bytecodeListing/superTypes.kt");
}
}