From 224a4e1e3cc1c7160ea123c5c28db7fbfbc2add1 Mon Sep 17 00:00:00 2001 From: "vladislav.grechko" Date: Wed, 21 Feb 2024 17:13:35 +0100 Subject: [PATCH] Do not exclude `codegen/box/script` directory from JVM ABI tests --- .../scriptPropFromAnotherModuleK2.jvm_abi.txt | 43 +++++++++++++ .../script/scriptPropFromAnotherModuleK2.kt | 1 + .../JvmAbiConsistencyTestBoxGenerated.java | 60 ++++++++++++++++++- .../generators/GenerateJUnit5CompilerTests.kt | 2 +- 4 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.jvm_abi.txt diff --git a/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.jvm_abi.txt b/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.jvm_abi.txt new file mode 100644 index 00000000000..8630d9341ac --- /dev/null +++ b/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.jvm_abi.txt @@ -0,0 +1,43 @@ +MODULE lib + CLASS Script.class + CLASS METADATA + K1 + ([Ljava/lang/String;)V + K2 + --- + Property: class.metadata.superTypes + K1 + [kotlin/script/templates/standard/ScriptTemplateWithArgs] + K2 + [] + Property: class.metadata.contextReceiverTypes + K1 + [] + K2 + [kotlin/script/templates/standard/ScriptTemplateWithArgs] +MODULE main + CLASS TestKt.class + Annotation: class.invisibleAnnotations + K1 + @Lkotlin/jvm/internal/SourceDebugExtension;( value: #{ SMAP + test.kt + Kotlin + *S Kotlin + *F + + 1 test.kt + TestKt + + 2 ArrayIntrinsics.kt + kotlin/ArrayIntrinsicsKt + *L + 1#1,29:1 + 26#2:30 + *S KotlinDebug + *F + + 1 test.kt + TestKt + *L + 22#1:30 + *E + } ) + K2 + --- diff --git a/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.kt b/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.kt index 7ae65919287..9c2902783f2 100644 --- a/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.kt +++ b/compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.kt @@ -3,6 +3,7 @@ // IGNORE_LIGHT_ANALYSIS // !LANGUAGE: -SkipStandaloneScriptsInSourceRoots // WITH_STDLIB +// JVM_ABI_K1_K2_DIFF: KT-63963, KT-63960, KT-62465 // Although this test works in K1 just fine, it is named with the suffix K2 to show that the demonstrated method is the only one // available so far to call a script from another module. diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index e079294b1d9..8748ff70ec2 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -23,7 +23,7 @@ import java.util.regex.Pattern; public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistencyTest { @Test public void testAllFilesPresentInBox() { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true, "multiplatform/k2", "script"); + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true, "multiplatform/k2"); } @Nested @@ -50686,6 +50686,64 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency } } + @Nested + @TestMetadata("compiler/testData/codegen/box/script") + @TestDataPath("$PROJECT_ROOT") + public class Script { + @Test + public void testAllFilesPresentInScript() { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/script"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("classReference.kt") + public void testClassReference() { + runTest("compiler/testData/codegen/box/script/classReference.kt"); + } + + @Test + @TestMetadata("localCaptureTests.kt") + public void testLocalCaptureTests() { + runTest("compiler/testData/codegen/box/script/localCaptureTests.kt"); + } + + @Test + @TestMetadata("localCaptureTestsK2.kt") + public void testLocalCaptureTestsK2() { + runTest("compiler/testData/codegen/box/script/localCaptureTestsK2.kt"); + } + + @Test + @TestMetadata("scripInstance.kt") + public void testScripInstance() { + runTest("compiler/testData/codegen/box/script/scripInstance.kt"); + } + + @Test + @TestMetadata("scriptNestedClassInstance.kt") + public void testScriptNestedClassInstance() { + runTest("compiler/testData/codegen/box/script/scriptNestedClassInstance.kt"); + } + + @Test + @TestMetadata("scriptNestedClassInstanceK2.kt") + public void testScriptNestedClassInstanceK2() { + runTest("compiler/testData/codegen/box/script/scriptNestedClassInstanceK2.kt"); + } + + @Test + @TestMetadata("scriptPropFromAnotherModuleK2.kt") + public void testScriptPropFromAnotherModuleK2() { + runTest("compiler/testData/codegen/box/script/scriptPropFromAnotherModuleK2.kt"); + } + + @Test + @TestMetadata("syntheticJavaPropertyInScript.kt") + public void testSyntheticJavaPropertyInScript() { + runTest("compiler/testData/codegen/box/script/syntheticJavaPropertyInScript.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/sealed") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt index ed9edf88007..2860a21e01e 100644 --- a/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt +++ b/compiler/tests-for-compiler-generator/tests/org/jetbrains/kotlin/test/generators/GenerateJUnit5CompilerTests.kt @@ -80,7 +80,7 @@ fun generateJUnit5CompilerTests(args: Array, mainClassName: String?) { // We split JVM ABI tests into two parts, to avoid creation of a huge file, unable to analyze by IntelliJ with default settings testClass("JvmAbiConsistencyTestBoxGenerated") { - model("codegen/box", excludeDirs = k2BoxTestDir + excludedScriptDirs) + model("codegen/box", excludeDirs = k2BoxTestDir) } testClass("JvmAbiConsistencyTestRestGenerated") {