backend/tests: add interop0
This commit is contained in:
committed by
SvyatoslavScherbina
parent
5e54c29afb
commit
56bab774f1
@@ -1,6 +1,8 @@
|
|||||||
import groovy.json.JsonOutput
|
import groovy.json.JsonOutput
|
||||||
import org.jetbrains.kotlin.*
|
import org.jetbrains.kotlin.*
|
||||||
|
|
||||||
|
apply plugin: NativeInteropPlugin
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
cli_bc
|
cli_bc
|
||||||
}
|
}
|
||||||
@@ -1047,3 +1049,17 @@ task inline3(type: RunKonanTest) {
|
|||||||
task vararg0(type: RunKonanTest) {
|
task vararg0(type: RunKonanTest) {
|
||||||
source = "lower/vararg.kt"
|
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'
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user