From c09e8909d4bdade0d0340127e93e4f3a5c20f1bf Mon Sep 17 00:00:00 2001 From: Vladimir Sukharev Date: Tue, 5 Dec 2023 22:40:02 +0100 Subject: [PATCH] [K/N] Move cinterop tests from standalone to codegen/box ^KT-61259 --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 2 +- ...rsedBlackBoxCodegenBasedTestGenerated.java | 2 +- ...LightTreeBlackBoxCodegenTestGenerated.java | 10 ++ ...hIrFakeOverrideGeneratorTestGenerated.java | 10 ++ .../FirPsiBlackBoxCodegenTestGenerated.java | 10 ++ .../codegen/box}/cinterop/arrayPointers.kt | 4 +- .../codegen/box}/cinterop/auxiliarySources.kt | 7 +- .../codegen/box}/cinterop/bitfields.kt | 4 +- .../box}/cinterop/callbacksAndVarargs.kt | 5 +- .../testData/codegen/box}/cinterop/enums.kt | 4 +- .../box}/cinterop/forwardDeclarations.kt | 5 +- .../testData/codegen/box}/cinterop/funptr.kt | 7 +- .../testData/codegen/box}/cinterop/funptr.out | 0 .../testData/codegen/box}/cinterop/globals.kt | 7 +- .../codegen/box}/cinterop/incompleteTypes.kt | 18 +-- .../testData/codegen/box}/cinterop/kt43265.kt | 5 +- .../testData/codegen/box}/cinterop/kt44283.kt | 5 +- .../testData/codegen/box}/cinterop/kt54284.kt | 5 +- .../codegen/box}/cinterop/kt54284_fmodules.kt | 5 +- .../testData/codegen/box}/cinterop/kt63048.kt | 5 +- .../leakMemoryWithRunningThreadUnchecked.kt | 6 +- .../codegen/box}/cinterop/toKString.kt | 5 +- .../codegen/BlackBoxCodegenTestGenerated.java | 10 ++ .../IrBlackBoxCodegenTestGenerated.java | 10 ++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 10 ++ .../LightAnalysisModeTestGenerated.java | 13 ++ .../tests/analysis/api/firLowLevel.kt | 10 +- .../fir/FirJsCodegenBoxTestGenerated.java | 10 ++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 10 ++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 10 ++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 10 ++ .../FirNativeCodegenBoxTestGenerated.java | 109 +++++++++++++++++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 111 ++++++++++++++++++ .../FirNativeStandaloneTestGenerated.java | 111 ------------------ .../NativeCodegenBoxTestGenerated.java | 107 +++++++++++++++++ .../NativeCodegenBoxTestNoPLGenerated.java | 109 +++++++++++++++++ .../NativeStandaloneTestGenerated.java | 109 ----------------- .../support/group/ExtTestCaseGroupProvider.kt | 38 +++--- .../test/FirWasmCodegenBoxTestGenerated.java | 10 ++ .../test/K1WasmCodegenBoxTestGenerated.java | 10 ++ 40 files changed, 672 insertions(+), 266 deletions(-) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/arrayPointers.kt (91%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/auxiliarySources.kt (85%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/bitfields.kt (98%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/callbacksAndVarargs.kt (98%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/enums.kt (94%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/forwardDeclarations.kt (95%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/funptr.kt (98%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/funptr.out (100%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/globals.kt (93%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/incompleteTypes.kt (86%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/kt43265.kt (91%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/kt44283.kt (95%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/kt54284.kt (91%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/kt54284_fmodules.kt (91%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/kt63048.kt (94%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/leakMemoryWithRunningThreadUnchecked.kt (96%) rename {native/native.tests/testData/standalone => compiler/testData/codegen/box}/cinterop/toKString.kt (92%) diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index c5f5c8208f4..731260af6cf 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -22,7 +22,7 @@ import java.util.regex.Pattern; public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBoxCodegenBasedTest { @Test public void testAllFilesPresentInBox() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "cinterop"); } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 687502592f5..2ef5606d9fb 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -22,7 +22,7 @@ import java.util.regex.Pattern; public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFirReversedBlackBoxCodegenBasedTest { @Test public void testAllFilesPresentInBox() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true); + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "cinterop"); } @Nested 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 ad0fee22d0e..b867e33e28a 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 @@ -6240,6 +6240,16 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 b4dabaa7526..da5fb59d0dc 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 @@ -6240,6 +6240,16 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 f604253589b..a50e92f7c3d 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 @@ -6240,6 +6240,16 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/testData/standalone/cinterop/arrayPointers.kt b/compiler/testData/codegen/box/cinterop/arrayPointers.kt similarity index 91% rename from native/native.tests/testData/standalone/cinterop/arrayPointers.kt rename to compiler/testData/codegen/box/cinterop/arrayPointers.kt index 47556a5ff89..743812c3647 100644 --- a/native/native.tests/testData/standalone/cinterop/arrayPointers.kt +++ b/compiler/testData/codegen/box/cinterop/arrayPointers.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: carrayPointers.def --- @@ -18,7 +19,7 @@ import carrayPointers.* import kotlin.test.* import kotlinx.cinterop.* -fun main() { +fun box(): String { arrayPointer = globalArray assertEquals(globalArray[0], arrayPointer!![0]) arrayPointer!![0] = 15 @@ -29,4 +30,5 @@ fun main() { struct.arrayPointer = globalArray assertEquals(globalArray[0], struct.arrayPointer!![0]) } + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/auxiliarySources.kt b/compiler/testData/codegen/box/cinterop/auxiliarySources.kt similarity index 85% rename from native/native.tests/testData/standalone/cinterop/auxiliarySources.kt rename to compiler/testData/codegen/box/cinterop/auxiliarySources.kt index 186d55cfd59..21dc6922ba3 100644 --- a/native/native.tests/testData/standalone/cinterop/auxiliarySources.kt +++ b/compiler/testData/codegen/box/cinterop/auxiliarySources.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // FREE_CINTEROP_ARGS: -header auxiliaryCppSources.h // MODULE: cinterop @@ -20,7 +21,7 @@ extern "C" { #include #include "auxiliaryCppSources.h" -static std::string _name = "Hello from C++"; +static std::string _name = "OK"; const char* name() { return _name.c_str(); @@ -35,6 +36,6 @@ import auxiliaryCppSources.* import kotlin.test.* import kotlinx.cinterop.* -fun main() { - assertEquals(name()!!.toKString(), "Hello from C++") +fun box(): String { + return name()!!.toKString() } diff --git a/native/native.tests/testData/standalone/cinterop/bitfields.kt b/compiler/testData/codegen/box/cinterop/bitfields.kt similarity index 98% rename from native/native.tests/testData/standalone/cinterop/bitfields.kt rename to compiler/testData/codegen/box/cinterop/bitfields.kt index da894eedb4b..9e5724a6b99 100644 --- a/native/native.tests/testData/standalone/cinterop/bitfields.kt +++ b/compiler/testData/codegen/box/cinterop/bitfields.kt @@ -4,6 +4,7 @@ */ // May need disabling when gcSchedulerType=aggressive . since it may be too slow +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: bitfields.def --- @@ -119,7 +120,7 @@ fun test(s: S, x1: Long, x2: B2, x3: UShort, x4: UInt, x5: Int, x6: Long, x7: E, check(s, x1, x2, x3, x4, x5, x6, x7, x8, x9) } -fun main(args: Array) { +fun box(): String { memScoped { val s = alloc() for (x1 in -1L..0L) @@ -133,4 +134,5 @@ fun main(args: Array) { for (x9 in intArrayOf(-8, -1, 0, 5, 7)) // 4 bits width test(s, x1, x2, x3.toUShort(), x4, x5, x6, x7, x8, x9) } + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/callbacksAndVarargs.kt b/compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt similarity index 98% rename from native/native.tests/testData/standalone/cinterop/callbacksAndVarargs.kt rename to compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt index e0c8152adc9..42367a9920a 100644 --- a/native/native.tests/testData/standalone/cinterop/callbacksAndVarargs.kt +++ b/compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt @@ -2,6 +2,7 @@ * Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: ccallbacksAndVarargs.def --- @@ -89,10 +90,12 @@ import kotlin.test.* import kotlinx.cinterop.* import ccallbacksAndVarargs.* -fun main() { +fun box(): String { testStructCallbacks() testVarargs() testCallableReferences() + + return "OK" } fun testStructCallbacks() { diff --git a/native/native.tests/testData/standalone/cinterop/enums.kt b/compiler/testData/codegen/box/cinterop/enums.kt similarity index 94% rename from native/native.tests/testData/standalone/cinterop/enums.kt rename to compiler/testData/codegen/box/cinterop/enums.kt index 9f8a179d512..73fc95f42c0 100644 --- a/native/native.tests/testData/standalone/cinterop/enums.kt +++ b/compiler/testData/codegen/box/cinterop/enums.kt @@ -2,6 +2,7 @@ * 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. */ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: cenums.def --- @@ -20,7 +21,7 @@ import kotlinx.cinterop.* import kotlin.test.* @OptIn(kotlin.ExperimentalStdlibApi::class) -fun main() { +fun box(): String { memScoped { val e = alloc() e.value = E.C @@ -39,4 +40,5 @@ fun main() { // assertEquals(entries[0], E.A) // assertEquals(entries[1], E.B) // assertEquals(entries[2], E.C) + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/forwardDeclarations.kt b/compiler/testData/codegen/box/cinterop/forwardDeclarations.kt similarity index 95% rename from native/native.tests/testData/standalone/cinterop/forwardDeclarations.kt rename to compiler/testData/codegen/box/cinterop/forwardDeclarations.kt index 8c71c731be8..1617fe226e6 100644 --- a/native/native.tests/testData/standalone/cinterop/forwardDeclarations.kt +++ b/compiler/testData/codegen/box/cinterop/forwardDeclarations.kt @@ -1,5 +1,6 @@ // This test mostly checks frontend behaviour. +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: cForwardDeclarations.def --- @@ -37,7 +38,7 @@ fun checkSubtype2() {} fun checkDifferentTypes(s: StructDeclared?) = 1 fun checkDifferentTypes(s: StructDefined?) = 2 -fun main() { +fun box(): String { checkSubtype2() checkSubtype2() @@ -50,4 +51,6 @@ fun main() { assertEquals(-1, useStructDeclared(declared?.ptr)) assertEquals(-2, useStructDefined(defined?.ptr)) + + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/funptr.kt b/compiler/testData/codegen/box/cinterop/funptr.kt similarity index 98% rename from native/native.tests/testData/standalone/cinterop/funptr.kt rename to compiler/testData/codegen/box/cinterop/funptr.kt index 2fe97822c13..f560abf614d 100644 --- a/native/native.tests/testData/standalone/cinterop/funptr.kt +++ b/compiler/testData/codegen/box/cinterop/funptr.kt @@ -1,9 +1,10 @@ -// OUTPUT_DATA_FILE: funptr.out /* * Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +// TARGET_BACKEND: NATIVE +// OUTPUT_DATA_FILE: funptr.out // MODULE: cinterop // FILE: cfunptr.def headerFilter = NOTHING @@ -115,7 +116,7 @@ typealias NotSoLongSignatureFunction = ( Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, Int ) -> Int -fun main(args: Array) { +fun box(): String { val atoiPtr = getAtoiPtr()!! val getPrintIntPtrPtr = getGetPrintIntPtrPtr()!! @@ -144,6 +145,8 @@ fun main(args: Array) { val notSoLongSignaturePtr: CPointer>? = getNotSoLongSignatureFunctionPtr() printIntPtr(notSoLongSignaturePtr!!.invoke(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) printIntPtr(notSoLongSignatureFunction(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) + + return "OK" } fun Boolean.ifThenOneElseZero() = if (this) 1 else 0 diff --git a/native/native.tests/testData/standalone/cinterop/funptr.out b/compiler/testData/codegen/box/cinterop/funptr.out similarity index 100% rename from native/native.tests/testData/standalone/cinterop/funptr.out rename to compiler/testData/codegen/box/cinterop/funptr.out diff --git a/native/native.tests/testData/standalone/cinterop/globals.kt b/compiler/testData/codegen/box/cinterop/globals.kt similarity index 93% rename from native/native.tests/testData/standalone/cinterop/globals.kt rename to compiler/testData/codegen/box/cinterop/globals.kt index 1f6a6f3fa0f..46388f532d9 100644 --- a/native/native.tests/testData/standalone/cinterop/globals.kt +++ b/compiler/testData/codegen/box/cinterop/globals.kt @@ -3,6 +3,7 @@ * that can be found in the LICENSE file. */ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: cglobals.def --- @@ -20,7 +21,7 @@ int g5[2][2] = { 15, 16, 17, 18 }; struct S* const g6 = &g3; -void foo() { +void globals_foo() { // Test that local vars are not treated as global ones. float g1; } @@ -47,7 +48,7 @@ _Pragma("clang assume_nonnull end") import kotlinx.cinterop.* import cglobals.* -fun main(args: Array) { +fun box(): String { assert(g1__ == 42) assert(g2 == 17) @@ -71,4 +72,6 @@ fun main(args: Array) { assert(g8.toLong() == 0x1L) assert(g9.toLong() == 0x2L) + + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/incompleteTypes.kt b/compiler/testData/codegen/box/cinterop/incompleteTypes.kt similarity index 86% rename from native/native.tests/testData/standalone/cinterop/incompleteTypes.kt rename to compiler/testData/codegen/box/cinterop/incompleteTypes.kt index 23adce77973..52f980911dd 100644 --- a/native/native.tests/testData/standalone/cinterop/incompleteTypes.kt +++ b/compiler/testData/codegen/box/cinterop/incompleteTypes.kt @@ -1,11 +1,12 @@ -// FREE_CINTEROP_ARGS: -header library.h +// FREE_CINTEROP_ARGS: -header incompleteTypes.h +// TARGET_BACKEND: NATIVE // MODULE: cinterop -// FILE: library.def +// FILE: incompleteTypes.def # The def file is intentionally empty -# `library.h` is meant to be included via `-header` option of cinterop tool +# `incompleteTypes.h` is meant to be included via `-header` option of cinterop tool -// FILE: library.h +// FILE: incompleteTypes.h #ifdef __cplusplus extern "C" { #endif @@ -34,9 +35,9 @@ extern "C" { } #endif -// FILE: library.cpp +// FILE: incompleteTypes.cpp #include -#include "library.h" +#include "incompleteTypes.h" extern "C" { @@ -94,11 +95,11 @@ extern "C" { @file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) -import library.* +import incompleteTypes.* import kotlinx.cinterop.* import kotlin.test.* -fun main() { +fun box(): String { assertNotNull(s.ptr) assertNotNull(u.ptr) assertNotNull(array) @@ -119,4 +120,5 @@ fun main() { for (i in 0 until arrayLength()) { assertEquals(0x1, array[i]) } + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/kt43265.kt b/compiler/testData/codegen/box/cinterop/kt43265.kt similarity index 91% rename from native/native.tests/testData/standalone/cinterop/kt43265.kt rename to compiler/testData/codegen/box/cinterop/kt43265.kt index 8605236d17d..0896d231c5f 100644 --- a/native/native.tests/testData/standalone/cinterop/kt43265.kt +++ b/compiler/testData/codegen/box/cinterop/kt43265.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: kt43265.def strictEnums = bcm2835FunctionSelect @@ -15,6 +16,8 @@ import kt43265.* import kotlin.test.* @kotlinx.cinterop.ExperimentalForeignApi -fun main() { +fun box(): String { assertEquals(bcm2835FunctionSelect.BCM2835_GPIO_FSEL_ALT3, bcm2835FunctionSelect.BCM2835_GPIO_FSEL_MASK) + + return "OK" } \ No newline at end of file diff --git a/native/native.tests/testData/standalone/cinterop/kt44283.kt b/compiler/testData/codegen/box/cinterop/kt44283.kt similarity index 95% rename from native/native.tests/testData/standalone/cinterop/kt44283.kt rename to compiler/testData/codegen/box/cinterop/kt44283.kt index 7cddd8be50a..b07ebc76983 100644 --- a/native/native.tests/testData/standalone/cinterop/kt44283.kt +++ b/compiler/testData/codegen/box/cinterop/kt44283.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: kt44283.def --- @@ -39,7 +40,7 @@ import kotlin.test.* val callbackCounter = AtomicInt(0) @ExperimentalForeignApi -fun main() { +fun box(): String { val func = staticCFunction, Unit> { kotlin.native.runtime.GC.collect() // Helps to ensure that "runtime" is already initialized. @@ -52,4 +53,6 @@ fun main() { assertEquals(0, callbackCounter.value) invokeFromThread(func.reinterpret()) assertEquals(1, callbackCounter.value) + + return "OK" } \ No newline at end of file diff --git a/native/native.tests/testData/standalone/cinterop/kt54284.kt b/compiler/testData/codegen/box/cinterop/kt54284.kt similarity index 91% rename from native/native.tests/testData/standalone/cinterop/kt54284.kt rename to compiler/testData/codegen/box/cinterop/kt54284.kt index 24f75746215..0b2c6415de6 100644 --- a/native/native.tests/testData/standalone/cinterop/kt54284.kt +++ b/compiler/testData/codegen/box/cinterop/kt54284.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: kt54284.def --- @@ -17,11 +18,13 @@ import kt54284.* import kotlin.test.* @ExperimentalForeignApi -fun main() { +fun box(): String { assertEquals("FILE:__FILE__", KFILE) assertEquals("LINE:__LINE__", KLINE) assertEquals("TIME:__TIME__", KTIME) assertEquals("DATE:__DATE__", KDATE) assertEquals("NAME:__FILE_NAME__", KFILENAME) assertEquals("BASE:__BASE_FILE__", KBASEFILE) + + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/kt54284_fmodules.kt b/compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt similarity index 91% rename from native/native.tests/testData/standalone/cinterop/kt54284_fmodules.kt rename to compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt index 065993016f8..a2e30b907e2 100644 --- a/native/native.tests/testData/standalone/cinterop/kt54284_fmodules.kt +++ b/compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: kt54284_fmodules.def compilerOpts = -fmodules @@ -17,11 +18,13 @@ import kt54284_fmodules.* import kotlin.test.* @ExperimentalForeignApi -fun main() { +fun box(): String { assertEquals("FILE:__FILE__", KFILE) assertEquals("LINE:__LINE__", KLINE) assertEquals("TIME:__TIME__", KTIME) assertEquals("DATE:__DATE__", KDATE) assertEquals("NAME:__FILE_NAME__", KFILENAME) assertEquals("BASE:__BASE_FILE__", KBASEFILE) + + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/kt63048.kt b/compiler/testData/codegen/box/cinterop/kt63048.kt similarity index 94% rename from native/native.tests/testData/standalone/cinterop/kt63048.kt rename to compiler/testData/codegen/box/cinterop/kt63048.kt index c00daae6403..d126879e278 100644 --- a/native/native.tests/testData/standalone/cinterop/kt63048.kt +++ b/compiler/testData/codegen/box/cinterop/kt63048.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: kt63048.def language = Objective-C @@ -42,7 +43,9 @@ class ImplWithoutOverride : WithClassProperty() { } } -fun main() { +fun box(): String { assertEquals("42", Impl.stringProperty()) assertEquals("153", ImplWithoutOverride.stringProperty()) + + return "OK" } \ No newline at end of file diff --git a/native/native.tests/testData/standalone/cinterop/leakMemoryWithRunningThreadUnchecked.kt b/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt similarity index 96% rename from native/native.tests/testData/standalone/cinterop/leakMemoryWithRunningThreadUnchecked.kt rename to compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt index d711cca437e..1d24e97e6ea 100644 --- a/native/native.tests/testData/standalone/cinterop/leakMemoryWithRunningThreadUnchecked.kt +++ b/compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt @@ -1,6 +1,6 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: leakMemoryWithRunningThreadUnchecked.def -package leakMemoryWithRunningThreadUnchecked --- void test_RunInNewThread(void (*)()); @@ -58,7 +58,7 @@ fun ensureInititalized() { global.value = 1 } -fun main() { +fun box(): String { Platform.isMemoryLeakCheckerActive = true kotlin.native.runtime.Debugging.forceCheckedShutdown = false assertTrue(global.value == 0) @@ -67,4 +67,6 @@ fun main() { assertTrue(global.value == 1) // Now exiting. With unchecked shutdown, we exit quietly, even though there're // unfinished threads with runtimes. + + return "OK" } diff --git a/native/native.tests/testData/standalone/cinterop/toKString.kt b/compiler/testData/codegen/box/cinterop/toKString.kt similarity index 92% rename from native/native.tests/testData/standalone/cinterop/toKString.kt rename to compiler/testData/codegen/box/cinterop/toKString.kt index eccee1800b5..c5732560a73 100644 --- a/native/native.tests/testData/standalone/cinterop/toKString.kt +++ b/compiler/testData/codegen/box/cinterop/toKString.kt @@ -1,3 +1,4 @@ +// TARGET_BACKEND: NATIVE // MODULE: cinterop // FILE: toKString.def --- @@ -17,10 +18,12 @@ import kotlinx.cinterop.* import kotlin.native.* import kotlin.test.* -fun main() { +fun box(): String { assertEquals("", empty()!!.toKStringFromUtf8()) assertEquals("foo", foo()!!.toKStringFromUtf8()) assertEquals("куку", kuku()!!.toKStringFromUtf8()) assertEquals("\uFFFD\uFFFD", invalid_utf8()!!.toKStringFromUtf8()) assertEquals("before zero", zero_in_the_middle()!!.toKStringFromUtf8()) + + return "OK" } 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 89de0041adb..ed75517d29a 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 @@ -6006,6 +6006,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 9670e92cdec..8ab432fafc4 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 @@ -6240,6 +6240,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 c1ebd1a5d6d..4786755191f 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 @@ -6240,6 +6240,16 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 c8625c91d6d..6d497c70e1a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5452,6 +5452,19 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Cinterop extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath); + } + + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/firLowLevel.kt b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/firLowLevel.kt index b351e4de384..36fd0b88513 100644 --- a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/firLowLevel.kt +++ b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/firLowLevel.kt @@ -323,11 +323,17 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() { } testClass { - model("codegen/box") + model( + "codegen/box", + excludeDirs = listOf("cinterop") // CInterop tests contain .DEF .H .CPP .M files, which are invalid for Compiler Core new test system + ) } testClass { - model("codegen/box") + model( + "codegen/box", + excludeDirs = listOf("cinterop") // CInterop tests contain .DEF .H .CPP .M files, which are invalid for Compiler Core new test system + ) } testClass(suiteTestClassName = "LLFirBlackBoxModernJdkCodegenBasedTestGenerated") { 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 e48d9cd72f9..0e7651e2af2 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 @@ -4584,6 +4584,16 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 aaef9b1bedb..ad61f9a30ab 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 @@ -4584,6 +4584,16 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 78396400283..f5ebe4a9277 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 @@ -4584,6 +4584,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 fbe013ef19d..cc203e3239c 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 @@ -4584,6 +4584,16 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT") 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 6ef4ac03e8d..90852a55935 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 @@ -4736,6 +4736,115 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("arrayPointers.kt") + public void testArrayPointers() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/arrayPointers.kt"); + } + + @Test + @TestMetadata("auxiliarySources.kt") + public void testAuxiliarySources() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/auxiliarySources.kt"); + } + + @Test + @TestMetadata("bitfields.kt") + public void testBitfields() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/bitfields.kt"); + } + + @Test + @TestMetadata("callbacksAndVarargs.kt") + public void testCallbacksAndVarargs() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt"); + } + + @Test + @TestMetadata("enums.kt") + public void testEnums() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/enums.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("funptr.kt") + public void testFunptr() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/funptr.kt"); + } + + @Test + @TestMetadata("globals.kt") + public void testGlobals() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/globals.kt"); + } + + @Test + @TestMetadata("incompleteTypes.kt") + public void testIncompleteTypes() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/incompleteTypes.kt"); + } + + @Test + @TestMetadata("kt43265.kt") + public void testKt43265() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt43265.kt"); + } + + @Test + @TestMetadata("kt44283.kt") + public void testKt44283() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt44283.kt"); + } + + @Test + @TestMetadata("kt54284.kt") + public void testKt54284() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284.kt"); + } + + @Test + @TestMetadata("kt54284_fmodules.kt") + public void testKt54284_fmodules() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt"); + } + + @Test + @TestMetadata("kt63048.kt") + public void testKt63048() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt63048.kt"); + } + + @Test + @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") + public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); + } + + @Test + @TestMetadata("toKString.kt") + public void testToKString() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/toKString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 baaf725aa98..d95f72f68c3 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 @@ -4844,6 +4844,117 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + @Tag("frontend-fir") + @FirPipeline() + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("arrayPointers.kt") + public void testArrayPointers() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/arrayPointers.kt"); + } + + @Test + @TestMetadata("auxiliarySources.kt") + public void testAuxiliarySources() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/auxiliarySources.kt"); + } + + @Test + @TestMetadata("bitfields.kt") + public void testBitfields() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/bitfields.kt"); + } + + @Test + @TestMetadata("callbacksAndVarargs.kt") + public void testCallbacksAndVarargs() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt"); + } + + @Test + @TestMetadata("enums.kt") + public void testEnums() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/enums.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("funptr.kt") + public void testFunptr() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/funptr.kt"); + } + + @Test + @TestMetadata("globals.kt") + public void testGlobals() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/globals.kt"); + } + + @Test + @TestMetadata("incompleteTypes.kt") + public void testIncompleteTypes() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/incompleteTypes.kt"); + } + + @Test + @TestMetadata("kt43265.kt") + public void testKt43265() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt43265.kt"); + } + + @Test + @TestMetadata("kt44283.kt") + public void testKt44283() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt44283.kt"); + } + + @Test + @TestMetadata("kt54284.kt") + public void testKt54284() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284.kt"); + } + + @Test + @TestMetadata("kt54284_fmodules.kt") + public void testKt54284_fmodules() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt"); + } + + @Test + @TestMetadata("kt63048.kt") + public void testKt63048() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt63048.kt"); + } + + @Test + @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") + public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); + } + + @Test + @TestMetadata("toKString.kt") + public void testToKString() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/toKString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java index 4df1d49004a..96a8f836f9c 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeStandaloneTestGenerated.java @@ -34,117 +34,6 @@ public class FirNativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @Nested - @TestMetadata("native/native.tests/testData/standalone/cinterop") - @TestDataPath("$PROJECT_ROOT") - @Tag("standalone") - @EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR") - @UseStandardTestCaseGroupProvider() - @Tag("frontend-fir") - @FirPipeline() - public class Cinterop { - @Test - public void testAllFilesPresentInCinterop() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("arrayPointers.kt") - public void testArrayPointers() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/arrayPointers.kt"); - } - - @Test - @TestMetadata("auxiliarySources.kt") - public void testAuxiliarySources() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/auxiliarySources.kt"); - } - - @Test - @TestMetadata("bitfields.kt") - public void testBitfields() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/bitfields.kt"); - } - - @Test - @TestMetadata("callbacksAndVarargs.kt") - public void testCallbacksAndVarargs() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/callbacksAndVarargs.kt"); - } - - @Test - @TestMetadata("enums.kt") - public void testEnums() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/enums.kt"); - } - - @Test - @TestMetadata("forwardDeclarations.kt") - public void testForwardDeclarations() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/forwardDeclarations.kt"); - } - - @Test - @TestMetadata("funptr.kt") - public void testFunptr() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/funptr.kt"); - } - - @Test - @TestMetadata("globals.kt") - public void testGlobals() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/globals.kt"); - } - - @Test - @TestMetadata("incompleteTypes.kt") - public void testIncompleteTypes() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/incompleteTypes.kt"); - } - - @Test - @TestMetadata("kt43265.kt") - public void testKt43265() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt43265.kt"); - } - - @Test - @TestMetadata("kt44283.kt") - public void testKt44283() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt44283.kt"); - } - - @Test - @TestMetadata("kt54284.kt") - public void testKt54284() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt54284.kt"); - } - - @Test - @TestMetadata("kt54284_fmodules.kt") - public void testKt54284_fmodules() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt54284_fmodules.kt"); - } - - @Test - @TestMetadata("kt63048.kt") - public void testKt63048() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt63048.kt"); - } - - @Test - @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") - public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); - } - - @Test - @TestMetadata("toKString.kt") - public void testToKString() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/toKString.kt"); - } - } - @Nested @TestMetadata("native/native.tests/testData/standalone/console") @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 af6e9555fcb..3c3dd7c26be 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 @@ -4628,6 +4628,113 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("arrayPointers.kt") + public void testArrayPointers() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/arrayPointers.kt"); + } + + @Test + @TestMetadata("auxiliarySources.kt") + public void testAuxiliarySources() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/auxiliarySources.kt"); + } + + @Test + @TestMetadata("bitfields.kt") + public void testBitfields() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/bitfields.kt"); + } + + @Test + @TestMetadata("callbacksAndVarargs.kt") + public void testCallbacksAndVarargs() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt"); + } + + @Test + @TestMetadata("enums.kt") + public void testEnums() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/enums.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("funptr.kt") + public void testFunptr() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/funptr.kt"); + } + + @Test + @TestMetadata("globals.kt") + public void testGlobals() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/globals.kt"); + } + + @Test + @TestMetadata("incompleteTypes.kt") + public void testIncompleteTypes() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/incompleteTypes.kt"); + } + + @Test + @TestMetadata("kt43265.kt") + public void testKt43265() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt43265.kt"); + } + + @Test + @TestMetadata("kt44283.kt") + public void testKt44283() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt44283.kt"); + } + + @Test + @TestMetadata("kt54284.kt") + public void testKt54284() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284.kt"); + } + + @Test + @TestMetadata("kt54284_fmodules.kt") + public void testKt54284_fmodules() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt"); + } + + @Test + @TestMetadata("kt63048.kt") + public void testKt63048() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt63048.kt"); + } + + @Test + @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") + public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); + } + + @Test + @TestMetadata("toKString.kt") + public void testToKString() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/toKString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 4118601de59..2c406815766 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 @@ -4737,6 +4737,115 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + @UseExtTestCaseGroupProvider() + @UsePartialLinkage(mode = Mode.DISABLED) + @Tag("no-partial-linkage-may-be-skipped") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true); + } + + @Test + @TestMetadata("arrayPointers.kt") + public void testArrayPointers() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/arrayPointers.kt"); + } + + @Test + @TestMetadata("auxiliarySources.kt") + public void testAuxiliarySources() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/auxiliarySources.kt"); + } + + @Test + @TestMetadata("bitfields.kt") + public void testBitfields() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/bitfields.kt"); + } + + @Test + @TestMetadata("callbacksAndVarargs.kt") + public void testCallbacksAndVarargs() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/callbacksAndVarargs.kt"); + } + + @Test + @TestMetadata("enums.kt") + public void testEnums() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/enums.kt"); + } + + @Test + @TestMetadata("forwardDeclarations.kt") + public void testForwardDeclarations() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt"); + } + + @Test + @TestMetadata("funptr.kt") + public void testFunptr() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/funptr.kt"); + } + + @Test + @TestMetadata("globals.kt") + public void testGlobals() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/globals.kt"); + } + + @Test + @TestMetadata("incompleteTypes.kt") + public void testIncompleteTypes() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/incompleteTypes.kt"); + } + + @Test + @TestMetadata("kt43265.kt") + public void testKt43265() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt43265.kt"); + } + + @Test + @TestMetadata("kt44283.kt") + public void testKt44283() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt44283.kt"); + } + + @Test + @TestMetadata("kt54284.kt") + public void testKt54284() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284.kt"); + } + + @Test + @TestMetadata("kt54284_fmodules.kt") + public void testKt54284_fmodules() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt54284_fmodules.kt"); + } + + @Test + @TestMetadata("kt63048.kt") + public void testKt63048() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/kt63048.kt"); + } + + @Test + @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") + public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); + } + + @Test + @TestMetadata("toKString.kt") + public void testToKString() throws Exception { + runTest("compiler/testData/codegen/box/cinterop/toKString.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT") diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java index 645d0d56798..a58e9d2e48d 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeStandaloneTestGenerated.java @@ -31,115 +31,6 @@ public class NativeStandaloneTestGenerated extends AbstractNativeBlackBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @Nested - @TestMetadata("native/native.tests/testData/standalone/cinterop") - @TestDataPath("$PROJECT_ROOT") - @Tag("standalone") - @EnforcedProperty(property = ClassLevelProperty.TEST_KIND, propertyValue = "STANDALONE_NO_TR") - @UseStandardTestCaseGroupProvider() - public class Cinterop { - @Test - public void testAllFilesPresentInCinterop() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("native/native.tests/testData/standalone/cinterop"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @Test - @TestMetadata("arrayPointers.kt") - public void testArrayPointers() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/arrayPointers.kt"); - } - - @Test - @TestMetadata("auxiliarySources.kt") - public void testAuxiliarySources() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/auxiliarySources.kt"); - } - - @Test - @TestMetadata("bitfields.kt") - public void testBitfields() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/bitfields.kt"); - } - - @Test - @TestMetadata("callbacksAndVarargs.kt") - public void testCallbacksAndVarargs() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/callbacksAndVarargs.kt"); - } - - @Test - @TestMetadata("enums.kt") - public void testEnums() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/enums.kt"); - } - - @Test - @TestMetadata("forwardDeclarations.kt") - public void testForwardDeclarations() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/forwardDeclarations.kt"); - } - - @Test - @TestMetadata("funptr.kt") - public void testFunptr() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/funptr.kt"); - } - - @Test - @TestMetadata("globals.kt") - public void testGlobals() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/globals.kt"); - } - - @Test - @TestMetadata("incompleteTypes.kt") - public void testIncompleteTypes() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/incompleteTypes.kt"); - } - - @Test - @TestMetadata("kt43265.kt") - public void testKt43265() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt43265.kt"); - } - - @Test - @TestMetadata("kt44283.kt") - public void testKt44283() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt44283.kt"); - } - - @Test - @TestMetadata("kt54284.kt") - public void testKt54284() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt54284.kt"); - } - - @Test - @TestMetadata("kt54284_fmodules.kt") - public void testKt54284_fmodules() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt54284_fmodules.kt"); - } - - @Test - @TestMetadata("kt63048.kt") - public void testKt63048() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/kt63048.kt"); - } - - @Test - @TestMetadata("leakMemoryWithRunningThreadUnchecked.kt") - public void testLeakMemoryWithRunningThreadUnchecked() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/leakMemoryWithRunningThreadUnchecked.kt"); - } - - @Test - @TestMetadata("toKString.kt") - public void testToKString() throws Exception { - runTest("native/native.tests/testData/standalone/cinterop/toKString.kt"); - } - } - @Nested @TestMetadata("native/native.tests/testData/standalone/console") @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 7ae81579c88..56ac89c356f 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 @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.DISABLE_N import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.DISABLE_NATIVE_K1 import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.DISABLE_NATIVE_K2 import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.FILECHECK_STAGE +import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.FREE_CINTEROP_ARGS import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.IGNORE_NATIVE import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.IGNORE_NATIVE_K1 import org.jetbrains.kotlin.konan.test.blackbox.support.TestDirectives.IGNORE_NATIVE_K2 @@ -168,7 +169,9 @@ private class ExtTestDataFile( testDataFileSettings.languageSettings.sorted().mapTo(args) { "-XXLanguage:$it" } testDataFileSettings.optInsForCompiler.sorted().mapTo(args) { "-opt-in=$it" } args += "-opt-in=kotlin.native.internal.InternalForKotlinNativeTests" // for ReflectionPackageName - return TestCompilerArgs(args) + val freeCInteropArgs = structure.directives.listValues(FREE_CINTEROP_ARGS.name) + ?.flatMap { it.split(" ") } + return TestCompilerArgs(args, freeCInteropArgs ?: emptyList()) } fun createTestCase(settings: Settings, sharedModules: ThreadSafeCache): TestCase { @@ -250,6 +253,8 @@ private class ExtTestDataFile( basePackageName.child(oldPackageName) } + val packagesOfDefFiles = defFiles.map { Name.identifier(it.name.removeSuffix(".def")) } + filesToTransform.forEach { handler -> handler.accept(object : KtVisitor>() { override fun visitKtElement(element: KtElement, parentAccessibleDeclarationNames: Set) { @@ -292,6 +297,8 @@ private class ExtTestDataFile( || importedFqName.startsWith(StandardNames.BUILT_INS_PACKAGE_NAME) || importedFqName.startsWith(KOTLINX_PACKAGE_NAME) || importedFqName.startsWith(HELPERS_PACKAGE_NAME) + || importedFqName.startsWith(CNAMES_PACKAGE_NAME) + || packagesOfDefFiles.any { importedFqName.startsWith(it) } ) { return } @@ -583,6 +590,7 @@ private class ExtTestDataFile( private val OPT_IN_ANNOTATION_NAME = Name.identifier("OptIn") private val HELPERS_PACKAGE_NAME = Name.identifier("helpers") private val KOTLINX_PACKAGE_NAME = Name.identifier("kotlinx") + private val CNAMES_PACKAGE_NAME = Name.identifier("cnames") private val MANDATORY_SOURCE_TRANSFORMERS: ExternalSourceTransformers = listOf(DiagnosticsRemovingSourceTransformer) } @@ -611,23 +619,25 @@ private class ExtTestDataFileStructureFactory(parentDisposable: Disposable?) : T val directives: Directives get() = filesAndModules.directives + val defFiles: List = filesAndModules.parsedFiles.filter { it.key.name.endsWith(".def") }.map { it.value } val filesToTransform: Iterable - get() = filesAndModules.parsedFiles.map { (extTestFile, psiFile) -> - object : CurrentFileHandler { - override val packageFqName get() = psiFile.packageFqName - override val module = object : CurrentFileHandler.ModuleHandler { - override fun markAsMain() { - extTestFile.module.isMain = true + get() = filesAndModules.parsedFiles.filter { it.key.name.endsWith(".kt") } + .map { (extTestFile, psiFile) -> + object : CurrentFileHandler { + override val packageFqName get() = psiFile.packageFqName + override val module = object : CurrentFileHandler.ModuleHandler { + override fun markAsMain() { + extTestFile.module.isMain = true + } + } + override val psiFactory get() = this@ExtTestDataFileStructureFactory.psiFactory + + override fun accept(visitor: KtVisitor<*, *>): Unit = psiFile.accept(visitor) + override fun accept(visitor: KtVisitor<*, D>, data: D) { + psiFile.accept(visitor, data) } } - override val psiFactory get() = this@ExtTestDataFileStructureFactory.psiFactory - - override fun accept(visitor: KtVisitor<*, *>): Unit = psiFile.accept(visitor) - override fun accept(visitor: KtVisitor<*, D>, data: D) { - psiFile.accept(visitor, data) - } } - } fun addFileToMainModule(fileName: String, text: String): Unit = filesAndModules.addFileToMainModule(fileName, text) 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 c82164801a8..1411727338a 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 @@ -4566,6 +4566,16 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @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 aa4ac572684..86fe6c25d9a 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 @@ -4566,6 +4566,16 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest } } + @Nested + @TestMetadata("compiler/testData/codegen/box/cinterop") + @TestDataPath("$PROJECT_ROOT") + public class Cinterop { + @Test + public void testAllFilesPresentInCinterop() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/cinterop"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/classLiteral") @TestDataPath("$PROJECT_ROOT")