[K/N][test] Improve available processors test
Pass expected number of processors as arguments. Don't check it on linux-arm32/64 which run remotely
This commit is contained in:
@@ -4423,10 +4423,8 @@ standaloneTest("interop_objc_allocException") {
|
||||
interopTest("interop_available_processors") {
|
||||
disabled = (project.testTarget == 'wasm32') // No interop for wasm yet.
|
||||
source = 'interop/basics/available_processors.kt'
|
||||
arguments = [Runtime.getRuntime().availableProcessors().toString()]
|
||||
interop = 'cstdlib'
|
||||
outputChecker = {
|
||||
s -> Integer.parseInt(s.trim()) == Runtime.getRuntime().availableProcessors()
|
||||
}
|
||||
}
|
||||
|
||||
interopTest("interop0") {
|
||||
|
||||
@@ -10,10 +10,18 @@ import kotlinx.cinterop.*
|
||||
|
||||
|
||||
@OptIn(kotlin.ExperimentalStdlibApi::class)
|
||||
fun main() {
|
||||
val x = Platform.getAvailableProcessors()
|
||||
println(x)
|
||||
fun main(args: Array<String>) {
|
||||
require(args.size == 1) {
|
||||
"An expected anount of processors should be specified as program argument"
|
||||
}
|
||||
val x: Int = Platform.getAvailableProcessors()
|
||||
println("Got available processors: $x")
|
||||
assertTrue(x > 0)
|
||||
if (!(Platform.osFamily == OsFamily.LINUX && (Platform.cpuArchitecture == CpuArchitecture.ARM32 ||
|
||||
Platform.cpuArchitecture == CpuArchitecture.ARM64))) {
|
||||
assertEquals(args[0].trim().toInt(), x)
|
||||
}
|
||||
|
||||
setenv("KOTLIN_NATIVE_AVAILABLE_PROCESSORS", "12345", 1)
|
||||
assertEquals(Platform.getAvailableProcessors(), 12345)
|
||||
setenv("KOTLIN_NATIVE_AVAILABLE_PROCESSORS", Long.MAX_VALUE.toString(), 1)
|
||||
|
||||
Reference in New Issue
Block a user