[K/N] Move cinterop tests from standalone to codegen/box
^KT-61259
This commit is contained in:
committed by
Space Team
parent
0b0ba3160f
commit
c09e8909d4
+1
-1
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+3
-1
@@ -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"
|
||||
}
|
||||
+4
-3
@@ -1,3 +1,4 @@
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// FREE_CINTEROP_ARGS: -header auxiliaryCppSources.h
|
||||
|
||||
// MODULE: cinterop
|
||||
@@ -20,7 +21,7 @@ extern "C" {
|
||||
#include <string>
|
||||
#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()
|
||||
}
|
||||
+3
-1
@@ -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<String>) {
|
||||
fun box(): String {
|
||||
memScoped {
|
||||
val s = alloc<S>()
|
||||
for (x1 in -1L..0L)
|
||||
@@ -133,4 +134,5 @@ fun main(args: Array<String>) {
|
||||
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"
|
||||
}
|
||||
+4
-1
@@ -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() {
|
||||
+3
-1
@@ -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.Var>()
|
||||
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"
|
||||
}
|
||||
+4
-1
@@ -1,5 +1,6 @@
|
||||
// This test mostly checks frontend behaviour.
|
||||
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// MODULE: cinterop
|
||||
// FILE: cForwardDeclarations.def
|
||||
---
|
||||
@@ -37,7 +38,7 @@ fun <T1 : T2, T2> checkSubtype2() {}
|
||||
fun checkDifferentTypes(s: StructDeclared?) = 1
|
||||
fun checkDifferentTypes(s: StructDefined?) = 2
|
||||
|
||||
fun main() {
|
||||
fun box(): String {
|
||||
checkSubtype2<StructDeclared, COpaque>()
|
||||
|
||||
checkSubtype2<StructDefined, CStructVar>()
|
||||
@@ -50,4 +51,6 @@ fun main() {
|
||||
|
||||
assertEquals(-1, useStructDeclared(declared?.ptr))
|
||||
assertEquals(-2, useStructDefined(defined?.ptr))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+5
-2
@@ -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<String>) {
|
||||
fun box(): String {
|
||||
val atoiPtr = getAtoiPtr()!!
|
||||
|
||||
val getPrintIntPtrPtr = getGetPrintIntPtrPtr()!!
|
||||
@@ -144,6 +145,8 @@ fun main(args: Array<String>) {
|
||||
val notSoLongSignaturePtr: CPointer<CFunction<NotSoLongSignatureFunction>>? = 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
|
||||
+5
-2
@@ -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<String>) {
|
||||
fun box(): String {
|
||||
assert(g1__ == 42)
|
||||
|
||||
assert(g2 == 17)
|
||||
@@ -71,4 +72,6 @@ fun main(args: Array<String>) {
|
||||
|
||||
assert(g8.toLong() == 0x1L)
|
||||
assert(g9.toLong() == 0x2L)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+10
-8
@@ -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 <string>
|
||||
#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"
|
||||
}
|
||||
+4
-1
@@ -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"
|
||||
}
|
||||
+4
-1
@@ -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<CValue<TestStruct>, 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"
|
||||
}
|
||||
+4
-1
@@ -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"
|
||||
}
|
||||
+4
-1
@@ -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"
|
||||
}
|
||||
+4
-1
@@ -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"
|
||||
}
|
||||
+4
-2
@@ -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"
|
||||
}
|
||||
+4
-1
@@ -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"
|
||||
}
|
||||
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+13
@@ -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)
|
||||
|
||||
+8
-2
@@ -323,11 +323,17 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
|
||||
}
|
||||
|
||||
testClass<AbstractLLFirBlackBoxCodegenBasedTest> {
|
||||
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<AbstractLLFirReversedBlackBoxCodegenBasedTest> {
|
||||
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<AbstractLLFirBlackBoxCodegenBasedTest>(suiteTestClassName = "LLFirBlackBoxModernJdkCodegenBasedTestGenerated") {
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
Generated
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+10
@@ -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")
|
||||
|
||||
+109
@@ -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")
|
||||
|
||||
+111
@@ -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")
|
||||
|
||||
-111
@@ -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")
|
||||
|
||||
+107
@@ -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")
|
||||
|
||||
+109
@@ -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")
|
||||
|
||||
-109
@@ -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")
|
||||
|
||||
+24
-14
@@ -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<String, TestModule.Shared?>): 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<Unit, Set<Name>>() {
|
||||
override fun visitKtElement(element: KtElement, parentAccessibleDeclarationNames: Set<Name>) {
|
||||
@@ -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<KtFile> = filesAndModules.parsedFiles.filter { it.key.name.endsWith(".def") }.map { it.value }
|
||||
val filesToTransform: Iterable<CurrentFileHandler>
|
||||
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 <D> 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 <D> accept(visitor: KtVisitor<*, D>, data: D) {
|
||||
psiFile.accept(visitor, data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun addFileToMainModule(fileName: String, text: String): Unit = filesAndModules.addFileToMainModule(fileName, text)
|
||||
|
||||
|
||||
Generated
+10
@@ -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")
|
||||
|
||||
Generated
+10
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user