backend/tests: add interop0

This commit is contained in:
Svyatoslav Scherbina
2017-02-03 16:10:26 +07:00
committed by SvyatoslavScherbina
parent 5e54c29afb
commit 56bab774f1
2 changed files with 25 additions and 0 deletions
+16
View File
@@ -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'
}
+9
View File
@@ -0,0 +1,9 @@
import sysstat.*
import kotlinx.cinterop.*
fun main(args: Array<String>) {
val statBuf = nativeHeap.alloc<statStruct>()
val res = stat("/", statBuf.ptr)
println(res)
println(statBuf.st_uid.value)
}