From 1b18f4ed1ede24a9612a8c948a06665d3277a0e9 Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Wed, 17 Jan 2024 11:49:34 +0100 Subject: [PATCH] [K/N][Tests] Migrate first ObjC test with framework ^KT-61259 --- ...LightTreeBlackBoxCodegenTestGenerated.java | 10 +++++ ...hIrFakeOverrideGeneratorTestGenerated.java | 10 +++++ .../FirPsiBlackBoxCodegenTestGenerated.java | 10 +++++ .../codegen/box/cinterop/objc/kt53151.kt | 39 +++++++++++++++++++ .../JvmAbiConsistencyTestBoxGenerated.java | 10 +++++ .../codegen/BlackBoxCodegenTestGenerated.java | 10 +++++ .../IrBlackBoxCodegenTestGenerated.java | 10 +++++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 10 +++++ .../LightAnalysisModeTestGenerated.java | 13 +++++++ .../fir/FirJsCodegenBoxTestGenerated.java | 10 +++++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 10 +++++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 10 +++++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 10 +++++ .../backend.native/tests/build.gradle | 9 ----- .../tests/interop/objc/kt53151/main.kt | 8 ---- .../tests/interop/objc/kt53151/objclib.def | 10 ----- .../testFramework/Foo.framework/Headers/Foo.h | 3 -- .../Foo.framework/Modules/module.modulemap | 3 -- .../FirNativeCodegenBoxTestGenerated.java | 19 +++++++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 21 ++++++++++ .../NativeCodegenBoxTestGenerated.java | 17 ++++++++ .../NativeCodegenBoxTestNoPLGenerated.java | 19 +++++++++ .../support/group/ExtTestCaseGroupProvider.kt | 2 + .../konan/test/blackbox/support/util/Names.kt | 5 ++- .../test/FirWasmCodegenBoxTestGenerated.java | 10 +++++ .../test/K1WasmCodegenBoxTestGenerated.java | 10 +++++ 26 files changed, 263 insertions(+), 35 deletions(-) create mode 100644 compiler/testData/codegen/box/cinterop/objc/kt53151.kt delete mode 100644 kotlin-native/backend.native/tests/interop/objc/kt53151/main.kt delete mode 100644 kotlin-native/backend.native/tests/interop/objc/kt53151/objclib.def delete mode 100644 kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Headers/Foo.h delete mode 100644 kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Modules/module.modulemap diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index 572b1034b5a..24cf05ece0f 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -6293,6 +6293,16 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index b4189a82672..c87cab467f9 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -6293,6 +6293,16 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 5a3004e9912..8c07c1d32f8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -6293,6 +6293,16 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/box/cinterop/objc/kt53151.kt b/compiler/testData/codegen/box/cinterop/objc/kt53151.kt new file mode 100644 index 00000000000..c2a8859dcc0 --- /dev/null +++ b/compiler/testData/codegen/box/cinterop/objc/kt53151.kt @@ -0,0 +1,39 @@ +// TARGET_BACKEND: NATIVE +// DISABLE_NATIVE: isAppleTarget=false + +// FREE_CINTEROP_ARGS: -compiler-option -F$generatedSourcesDir/cinterop +// MODULE: cinterop +// FILE: objclib.def +language = Objective-C +modules = Foo +--- +static int getDefInt() { + return 2; +} + +static int getFrameworkIntFromDef() { + return getFrameworkInt(); +} + +// FILE: Foo.framework/Headers/Foo.h +static int getFrameworkInt() { + return 1; +} + +// FILE: Foo.framework/Modules/module.modulemap +framework module Foo { + umbrella header "Foo.h" +} + +// MODULE: main(cinterop) +// FILE: main.kt +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) +import kotlin.test.* +import objclib.* + +fun box(): String { + assertEquals(1, getFrameworkInt()) + assertEquals(2, getDefInt()) + assertEquals(1, getFrameworkIntFromDef()) + return "OK" +} 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 f2a5d657bab..772b3238639 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 @@ -6293,6 +6293,16 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index f70b3efb925..1159a500594 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -6059,6 +6059,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index c0384c726ad..6e74bcf6c64 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -6293,6 +6293,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index e94f422268a..4bbc529f057 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -6293,6 +6293,16 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 5545633f748..4b6f03fe886 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5510,6 +5510,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Objc extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 11000ac31f5..02795eebce8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -4631,6 +4631,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index ac6cd7c067c..fb6af628181 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -4631,6 +4631,16 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 04cf40c5575..d49d4e5266d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -4631,6 +4631,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 56b936c9b34..df1c7d23f2a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -4631,6 +4631,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/kotlin-native/backend.native/tests/build.gradle b/kotlin-native/backend.native/tests/build.gradle index 2a61a2866b4..e3c4f1497b2 100644 --- a/kotlin-native/backend.native/tests/build.gradle +++ b/kotlin-native/backend.native/tests/build.gradle @@ -1189,10 +1189,6 @@ if (PlatformInfo.isAppleTarget(project)) { createInterop("objc_kt50648") { it.defFile 'interop/objc/kt50648/objclib.def' } - createInterop("objc_kt53151") { - it.defFile 'interop/objc/kt53151/objclib.def' - it.compilerOpts "-F$projectDir/interop/objc/kt53151/testFramework" - } createInterop("objc_kt55938") { it.defFile 'interop/objc/kt55938/objclib.def' it.headers "$projectDir/interop/objc/kt55938/objclib.h" @@ -1694,11 +1690,6 @@ if (PlatformInfo.isAppleTarget(project)) { } } - interopTest("interop_objc_kt53151") { - source = "interop/objc/kt53151/main.kt" - interop = "objc_kt53151" - } - interopTest("interop_objc_kt55938") { source = "interop/objc/kt55938/main.kt" lib = "interop/objc/kt55938/lib.kt" diff --git a/kotlin-native/backend.native/tests/interop/objc/kt53151/main.kt b/kotlin-native/backend.native/tests/interop/objc/kt53151/main.kt deleted file mode 100644 index 17c39978661..00000000000 --- a/kotlin-native/backend.native/tests/interop/objc/kt53151/main.kt +++ /dev/null @@ -1,8 +0,0 @@ -import kotlin.test.* -import objclib.* - -fun main() { - assertEquals(1, getFrameworkInt()) - assertEquals(2, getDefInt()) - assertEquals(1, getFrameworkIntFromDef()) -} diff --git a/kotlin-native/backend.native/tests/interop/objc/kt53151/objclib.def b/kotlin-native/backend.native/tests/interop/objc/kt53151/objclib.def deleted file mode 100644 index 5db9264857c..00000000000 --- a/kotlin-native/backend.native/tests/interop/objc/kt53151/objclib.def +++ /dev/null @@ -1,10 +0,0 @@ -language = Objective-C -modules = Foo ---- -static int getDefInt() { - return 2; -} - -static int getFrameworkIntFromDef() { - return getFrameworkInt(); -} diff --git a/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Headers/Foo.h b/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Headers/Foo.h deleted file mode 100644 index 7fc46022feb..00000000000 --- a/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Headers/Foo.h +++ /dev/null @@ -1,3 +0,0 @@ -static int getFrameworkInt() { - return 1; -} diff --git a/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Modules/module.modulemap b/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Modules/module.modulemap deleted file mode 100644 index 0aab69f0af4..00000000000 --- a/kotlin-native/backend.native/tests/interop/objc/kt53151/testFramework/Foo.framework/Modules/module.modulemap +++ /dev/null @@ -1,3 +0,0 @@ -framework module Foo { - umbrella header "Foo.h" -} diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index 0f71e38f7c8..366dedba6a1 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -5056,6 +5056,25 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("kt53151.kt") + public void testKt53151() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index bd710e901ca..b6a78b8ebbc 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -5170,6 +5170,27 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("kt53151.kt") + public void testKt53151() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index fed29c2d7a9..6054498b537 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -4942,6 +4942,23 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("kt53151.kt") + public void testKt53151() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 601cc189506..2898bb3b4cf 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -5057,6 +5057,25 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("kt53151.kt") + public void testKt53151() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/objc/kt53151.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt index c457b9d7f4d..6cab39998ff 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/group/ExtTestCaseGroupProvider.kt @@ -177,6 +177,7 @@ private class ExtTestDataFile( args += "-opt-in=kotlin.native.internal.InternalForKotlinNativeTests" // for ReflectionPackageName val freeCInteropArgs = structure.directives.listValues(FREE_CINTEROP_ARGS.name) .orEmpty().flatMap { it.split(" ") } + .map { it.replace("\$generatedSourcesDir", testDataFileSettings.generatedSourcesDir.absolutePath) } return TestCompilerArgs(args, freeCInteropArgs, testDataFileSettings.assertionsMode) } @@ -719,6 +720,7 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable) : Te source.files.forEach { extTestFile -> val file = moduleDir.resolve(extTestFile.name) + file.parentFile.mkdirs() file.writeText(extTestFile.text) process(destination, TestFile.createCommitted(file, destination)) } diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt index c9b2ce6884b..a4d680d10a6 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/support/util/Names.kt @@ -7,14 +7,15 @@ package org.jetbrains.kotlin.konan.test.blackbox.support.util internal val Class<*>.sanitizedName: String get() = sanitize(name) -internal fun getSanitizedFileName(fileName: String): String = sanitize(fileName, allowDots = true) +internal fun getSanitizedFileName(fileName: String): String = sanitize(fileName, allowDots = true, allowSlashes = true) -private fun sanitize(s: String, allowDots: Boolean = false) = buildString { +private fun sanitize(s: String, allowDots: Boolean = false, allowSlashes: Boolean = false) = buildString { s.forEach { ch -> append( when { ch.isLetterOrDigit() || ch == '_' -> ch allowDots && ch == '.' -> ch + allowSlashes && ch == '/' -> ch else -> '_' } ) diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 20d39d38522..42cded68014 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -4613,6 +4613,16 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT") diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 89be49a68cc..fc1c3a29443 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -4613,6 +4613,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop/objc") + @TestDataPath("$PROJECT_ROOT") + public class Objc { + @Test + public void testAllFilesPresentInObjc() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop/objc"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/cinterop/packages") @TestDataPath("$PROJECT_ROOT")