Add a test-case for KT-43502
This commit is contained in:
committed by
Vasily Levchenko
parent
5a18a565b7
commit
0a33d9d2fc
@@ -3759,6 +3759,22 @@ createInterop("kt43265") {
|
||||
it.defFile 'interop/kt43265/kt43265.def'
|
||||
}
|
||||
|
||||
createInterop("kt43502") {
|
||||
it.defFile 'interop/kt43502/kt43502.def'
|
||||
it.headers "$projectDir/interop/kt43502/kt43502.h"
|
||||
// Note: also hardcoded in def file.
|
||||
final String libDir = "$buildDir/kt43502/"
|
||||
// Construct library that contains actual symbol definition.
|
||||
it.getByTarget(target.name).doFirst {
|
||||
UtilsKt.buildStaticLibrary(
|
||||
project,
|
||||
[file("$projectDir/interop/kt43502/kt43502.c")],
|
||||
file("$libDir/kt43502.a"),
|
||||
file("$libDir/kt43502.objs"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
createInterop("leakMemoryWithRunningThread") {
|
||||
it.defFile 'interop/leakMemoryWithRunningThread/leakMemory.def'
|
||||
it.headers "$projectDir/interop/leakMemoryWithRunningThread/leakMemory.h"
|
||||
@@ -4080,6 +4096,14 @@ interopTest("interop_kt43265") {
|
||||
source = "interop/kt43265/usage.kt"
|
||||
}
|
||||
|
||||
dynamicTest("interop_kt43502") {
|
||||
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
|
||||
interop = "kt43502"
|
||||
source = "interop/kt43502/main.kt"
|
||||
cSource = "$projectDir/interop/kt43502/main.c"
|
||||
goldValue = "null\n"
|
||||
}
|
||||
|
||||
interopTest("interop_leakMemoryWithRunningThreadUnchecked") {
|
||||
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
|
||||
interop = 'leakMemoryWithRunningThread'
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
char **externPtr = 0;
|
||||
@@ -0,0 +1,2 @@
|
||||
libraryPaths = backend.native/tests/build/kt43502
|
||||
staticLibraries = kt43502.a
|
||||
@@ -0,0 +1 @@
|
||||
extern char **externPtr;
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "libinterop_kt43502_api.h"
|
||||
|
||||
int main() {
|
||||
libinterop_kt43502_symbols()->kotlin.root.printExternPtr();
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import kt43502.*
|
||||
|
||||
fun printExternPtr() {
|
||||
println(externPtr)
|
||||
}
|
||||
Reference in New Issue
Block a user