diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 2a8091bfb5e..508ea4e4235 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -1,6 +1,8 @@ import groovy.json.JsonOutput import org.jetbrains.kotlin.* +apply plugin: NativeInteropPlugin + configurations { cli_bc } @@ -1047,3 +1049,17 @@ task inline3(type: RunKonanTest) { task vararg0(type: RunKonanTest) { source = "lower/vararg.kt" } + +kotlinNativeInterop { + sysstat { + pkg 'sysstat' + headers 'sys/stat.h' + target 'native' + } +} + +task interop0(type: RunInteropKonanTest) { + goldValue = "0\n0\n" + source = "interop/basics/0.kt" + interop = 'sysstat' +} \ No newline at end of file diff --git a/backend.native/tests/interop/basics/0.kt b/backend.native/tests/interop/basics/0.kt new file mode 100644 index 00000000000..862a4f30b33 --- /dev/null +++ b/backend.native/tests/interop/basics/0.kt @@ -0,0 +1,9 @@ +import sysstat.* +import kotlinx.cinterop.* + +fun main(args: Array) { + val statBuf = nativeHeap.alloc() + val res = stat("/", statBuf.ptr) + println(res) + println(statBuf.st_uid.value) +} \ No newline at end of file