[K/N][Tests] Migrate tests forwardDeclarationsTwoLibs.kt
^KT-61259
This commit is contained in:
committed by
Space Team
parent
bd688b3ef7
commit
c286b0efd7
+40
-1
@@ -1,4 +1,41 @@
|
||||
// This test mostly checks frontend behaviour.
|
||||
// TARGET_BACKEND: NATIVE
|
||||
// MODULE: cinterop1
|
||||
// FILE: cForwardDeclarationsTwoLibs1.def
|
||||
---
|
||||
struct StructDeclaredUndeclared;
|
||||
struct StructDeclaredDeclared;
|
||||
struct StructDeclaredDefined;
|
||||
struct StructDefinedUndeclared {};
|
||||
struct StructDefinedDeclared {};
|
||||
struct StructDefinedDefined {};
|
||||
|
||||
int use1StructDeclaredUndeclared(struct StructDeclaredUndeclared* declaredUndeclared) { return -3; }
|
||||
int use1StructDeclaredDeclared(struct StructDeclaredDeclared* declaredDeclared) { return -4; }
|
||||
int use1StructDeclaredDefined(struct StructDeclaredDefined* declaredDefined) { return -5; }
|
||||
int use1StructDefinedUndeclared(struct StructDefinedUndeclared* definedUndeclared) { return -6; }
|
||||
int use1StructDefinedDeclared(struct StructDefinedDeclared* definedDeclared) { return -7; }
|
||||
int use1StructDefinedDefined(struct StructDefinedDefined* definedDefined) { return -8; }
|
||||
|
||||
// MODULE: cinterop2
|
||||
// FILE: cForwardDeclarationsTwoLibs2.def
|
||||
---
|
||||
struct StructUndeclaredDeclared;
|
||||
struct StructUndeclaredDefined {};
|
||||
struct StructDeclaredDeclared;
|
||||
struct StructDeclaredDefined {};
|
||||
struct StructDefinedDeclared;
|
||||
struct StructDefinedDefined {};
|
||||
|
||||
int use2StructUndeclaredDeclared(struct StructUndeclaredDeclared* undeclaredDeclared) { return 1; }
|
||||
int use2StructUndeclaredDefined(struct StructUndeclaredDefined* undeclaredDefined) { return 2; }
|
||||
int use2StructDeclaredDeclared(struct StructDeclaredDeclared* declaredDeclared) { return 4; }
|
||||
int use2StructDeclaredDefined(struct StructDeclaredDefined* declaredDefined) { return 5; }
|
||||
int use2StructDefinedDeclared(struct StructDefinedDeclared* definedDeclared) { return 7; }
|
||||
int use2StructDefinedDefined(struct StructDefinedDefined* definedDefined) { return 8; }
|
||||
|
||||
// MODULE: main(cinterop1, cinterop2)
|
||||
// FILE: main.kt
|
||||
@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class)
|
||||
|
||||
import cForwardDeclarationsTwoLibs1.*
|
||||
@@ -34,7 +71,7 @@ fun checkDifferentTypes(s: StructDefinedDeclared?) = 7
|
||||
fun checkDifferentTypes(s: cForwardDeclarationsTwoLibs1.StructDefinedDefined?) = 8
|
||||
fun checkDifferentTypes(s: cForwardDeclarationsTwoLibs2.StructDefinedDefined?) = 9
|
||||
|
||||
fun main() {
|
||||
fun box(): String {
|
||||
checkSubtype2<StructUndeclaredDeclared, COpaque>()
|
||||
|
||||
checkSubtype2<StructUndeclaredDefined, CStructVar>()
|
||||
@@ -88,4 +125,6 @@ fun main() {
|
||||
assertEquals(7, use2StructDefinedDeclared(cnamesDefinedDeclared?.ptr))
|
||||
assertEquals(-8, use1StructDefinedDefined(definedDefined1?.ptr))
|
||||
assertEquals(8, use2StructDefinedDefined(definedDefined2?.ptr))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1087,25 +1087,12 @@ createInterop("cppSkiaSignature") {
|
||||
it.defFile 'interop/cpp/skiaSignature.def'
|
||||
}
|
||||
|
||||
createInterop("threadStates") {
|
||||
it.defFile "interop/threadStates/threadStates.def"
|
||||
it.extraOpts "-Xcompile-source", "$projectDir/interop/threadStates/threadStates.cpp"
|
||||
}
|
||||
|
||||
createInterop("workerSignals") {
|
||||
it.defFile "interop/workerSignals/workerSignals.def"
|
||||
it.headers "$projectDir/interop/workerSignals/workerSignals.h"
|
||||
it.extraOpts "-Xcompile-source", "$projectDir/interop/workerSignals/workerSignals.cpp"
|
||||
}
|
||||
|
||||
createInterop("cForwardDeclarationsTwoLibs1") {
|
||||
it.defFile "interop/forwardDeclarationsTwoLibs/cForwardDeclarationsTwoLibs1.def"
|
||||
}
|
||||
|
||||
createInterop("cForwardDeclarationsTwoLibs2") {
|
||||
it.defFile "interop/forwardDeclarationsTwoLibs/cForwardDeclarationsTwoLibs2.def"
|
||||
}
|
||||
|
||||
if (PlatformInfo.isAppleTarget(project)) {
|
||||
createInterop("forwardDeclarationsCastA") {
|
||||
it.defFile "interop/forwardDeclarationsCast/a.def"
|
||||
@@ -1344,12 +1331,6 @@ interopTest("interop_workerSignals") {
|
||||
interop = "workerSignals"
|
||||
}
|
||||
|
||||
interopTest("interop_forwardDeclarationsTwoLibs") {
|
||||
source = "interop/forwardDeclarationsTwoLibs/forwardDeclarationsTwoLibs.kt"
|
||||
interop = "cForwardDeclarationsTwoLibs1"
|
||||
interop2 = "cForwardDeclarationsTwoLibs2"
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: This test isn't run automatically
|
||||
tasks.register("interop_echo_server", RunInteropKonanTest) {
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
---
|
||||
struct StructDeclaredUndeclared;
|
||||
struct StructDeclaredDeclared;
|
||||
struct StructDeclaredDefined;
|
||||
struct StructDefinedUndeclared {};
|
||||
struct StructDefinedDeclared {};
|
||||
struct StructDefinedDefined {};
|
||||
|
||||
int use1StructDeclaredUndeclared(struct StructDeclaredUndeclared* declaredUndeclared) { return -3; }
|
||||
int use1StructDeclaredDeclared(struct StructDeclaredDeclared* declaredDeclared) { return -4; }
|
||||
int use1StructDeclaredDefined(struct StructDeclaredDefined* declaredDefined) { return -5; }
|
||||
int use1StructDefinedUndeclared(struct StructDefinedUndeclared* definedUndeclared) { return -6; }
|
||||
int use1StructDefinedDeclared(struct StructDefinedDeclared* definedDeclared) { return -7; }
|
||||
int use1StructDefinedDefined(struct StructDefinedDefined* definedDefined) { return -8; }
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
---
|
||||
struct StructUndeclaredDeclared;
|
||||
struct StructUndeclaredDefined {};
|
||||
struct StructDeclaredDeclared;
|
||||
struct StructDeclaredDefined {};
|
||||
struct StructDefinedDeclared;
|
||||
struct StructDefinedDefined {};
|
||||
|
||||
int use2StructUndeclaredDeclared(struct StructUndeclaredDeclared* undeclaredDeclared) { return 1; }
|
||||
int use2StructUndeclaredDefined(struct StructUndeclaredDefined* undeclaredDefined) { return 2; }
|
||||
int use2StructDeclaredDeclared(struct StructDeclaredDeclared* declaredDeclared) { return 4; }
|
||||
int use2StructDeclaredDefined(struct StructDeclaredDefined* declaredDefined) { return 5; }
|
||||
int use2StructDefinedDeclared(struct StructDefinedDeclared* definedDeclared) { return 7; }
|
||||
int use2StructDefinedDefined(struct StructDefinedDefined* definedDefined) { return 8; }
|
||||
+6
@@ -4802,6 +4802,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarationsTwoLibs.kt")
|
||||
public void testForwardDeclarationsTwoLibs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarationsTwoLibs.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funptr.kt")
|
||||
public void testFunptr() throws Exception {
|
||||
|
||||
+6
@@ -4912,6 +4912,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarationsTwoLibs.kt")
|
||||
public void testForwardDeclarationsTwoLibs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarationsTwoLibs.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funptr.kt")
|
||||
public void testFunptr() throws Exception {
|
||||
|
||||
+6
@@ -4692,6 +4692,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarationsTwoLibs.kt")
|
||||
public void testForwardDeclarationsTwoLibs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarationsTwoLibs.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funptr.kt")
|
||||
public void testFunptr() throws Exception {
|
||||
|
||||
+6
@@ -4803,6 +4803,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarations.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("forwardDeclarationsTwoLibs.kt")
|
||||
public void testForwardDeclarationsTwoLibs() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/cinterop/forwardDeclarationsTwoLibs.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("funptr.kt")
|
||||
public void testFunptr() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user