[K/N][tests] Migrate various runtime/ tests ^KT-61259

This commit is contained in:
Alexander Shabalin
2024-03-11 22:48:50 +01:00
committed by Space Team
parent 7ad4e58a7a
commit d88092aa94
99 changed files with 2102 additions and 1905 deletions
@@ -285,195 +285,6 @@ Task dynamicTest(String name, Closure<KonanDynamicTest> configureClosure) {
// source = "codegen/object/constructor.kt"
//}
standaloneTest("runtime_basic_init") {
source = "runtime/basic/init.kt"
expectedExitStatus = 0
}
standaloneTest("cleaner_basic") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_basic.kt"
flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
}
standaloneTest("cleaner_workers") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_workers.kt"
flags = ['-tr', '-opt-in=kotlin.native.internal.InternalForKotlinNative']
}
standaloneTest("cleaner_in_main_with_checker") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_in_main_with_checker.kt"
useGoldenData = true
}
standaloneTest("cleaner_in_main_without_checker") {
source = "runtime/basic/cleaner_in_main_without_checker.kt"
useGoldenData = true
}
standaloneTest("cleaner_leak_without_checker") {
source = "runtime/basic/cleaner_leak_without_checker.kt"
useGoldenData = true
}
standaloneTest("cleaner_leak_with_checker") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_leak_with_checker.kt"
expectedExitStatusChecker = { it != 0 }
outputChecker = { s -> (s =~ /Cleaner (0x)?[0-9a-fA-F]+ was disposed during program exit/).find() }
}
standaloneTest("cleaner_in_tls_main_without_checker") {
source = "runtime/basic/cleaner_in_tls_main_without_checker.kt"
}
standaloneTest("cleaner_in_tls_main_with_checker") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_in_tls_main_with_checker.kt"
expectedExitStatusChecker = { it != 0 }
outputChecker = { s -> (s =~ /Cleaner (0x)?[0-9a-fA-F]+ was disposed during program exit/).find() }
}
standaloneTest("cleaner_in_tls_worker") {
enabled = !isNoopGC
source = "runtime/basic/cleaner_in_tls_worker.kt"
flags = ['-opt-in=kotlin.native.internal.InternalForKotlinNative']
}
standaloneTest('logging') {
outputChecker = { out ->
out.toLowerCase().contains("[logging]") && // loging reports configured log levels on info level
out.toLowerCase().contains("logging = debug") &&
out.toLowerCase().contains("gc = info") &&
out.toLowerCase().contains("mm = warning") &&
out.toLowerCase().contains("tls = error") &&
out.toLowerCase().contains("[gc]") // gc reports initialization on info level
}
source = "runtime/basic/logging.kt"
flags = ['-Xruntime-logs=gc=info,mm=warning,tls=error,logging=debug']
}
standaloneTest('logging_invalid') {
outputChecker = { it.isEmpty() }
source = "runtime/basic/logging.kt"
flags = ['-Xruntime-logs=invalid=unknown,logging=debug']
}
standaloneTest('logging_override') {
outputChecker = { it.isEmpty() }
source = "runtime/basic/logging.kt"
flags = ['-Xruntime-logs=logging=info,logging=debug,logging=none']
}
standaloneTest("worker_bound_reference0") {
source = "runtime/concurrent/worker_bound_reference0.kt"
flags = ['-tr']
if (isNoopGC) {
def exclude = [
"*.testCollect",
"*.testCollectFrozen",
"*.testCollectInWorkerFrozen",
"*.collectCyclicGarbage",
"*.collectCyclicGarbageWithAtomicsFrozen",
"*.collectCrossThreadCyclicGarbageWithAtomicsFrozen"
]
arguments += ["--ktest_filter=*-${exclude.join(":")}"]
}
}
// This tests changes main thread worker queue state, so better be executed alone.
standaloneTest("worker5") {
useGoldenData = true
source = "runtime/workers/worker5.kt"
}
tasks.register("worker10", KonanLocalTest) {
enabled = !isNoopGC
useGoldenData = true
source = "runtime/workers/worker10.kt"
}
standaloneTest("worker_exceptions") {
flags = ["-tr"]
outputChecker = {
!it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error")
}
source = "runtime/workers/worker_exceptions.kt"
}
standaloneTest("worker_exceptions_terminate") {
expectedExitStatusChecker = { it != 0 }
outputChecker = {
it.contains("some error") && !it.contains("Will not happen")
}
source = "runtime/workers/worker_exceptions_terminate.kt"
}
standaloneTest("worker_exceptions_terminate_hook") {
outputChecker = {
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
}
source = "runtime/workers/worker_exceptions_terminate_hook.kt"
}
standaloneTest("worker_exceptions_terminate_current") {
expectedExitStatusChecker = { it != 0 }
outputChecker = {
it.contains("some error") && !it.contains("Will not happen")
}
source = "runtime/workers/worker_exceptions_terminate_current.kt"
}
standaloneTest("worker_exceptions_terminate_hook_current") {
outputChecker = {
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
}
source = "runtime/workers/worker_exceptions_terminate_hook_current.kt"
}
standaloneTest("worker_threadlocal_no_leak") {
source = "runtime/workers/worker_threadlocal_no_leak.kt"
}
standaloneTest("freeze_disabled") {
enabled = !isNoopGC
flags = ["-tr"]
source = "runtime/workers/freeze_disabled.kt"
testLogger = KonanTest.Logger.SILENT
}
standaloneTest("lazy2") {
useGoldenData = true
source = "runtime/workers/lazy2.kt"
}
standaloneTest("lazy3") {
enabled = !isNoopGC
source = "runtime/workers/lazy3.kt"
}
tasks.register("mutableData1", KonanLocalTest) {
source = "runtime/workers/mutableData1.kt"
}
tasks.register("enumIdentity", KonanLocalTest) {
useGoldenData = true
source = "runtime/workers/enum_identity.kt"
}
standaloneTest("leakWorker") {
source = "runtime/workers/leak_worker.kt"
expectedExitStatusChecker = { it != 0 }
outputChecker = { s -> s.contains("Unfinished workers detected, 1 workers leaked!") }
}
standaloneTest("leakMemoryWithWorkerTermination") {
source = "runtime/workers/leak_memory_with_worker_termination.kt"
}
standaloneTest("initializers_testInfrastructure") {
source = "codegen/initializers/testInfrastructure.kt"
flags = ["-tr"]
@@ -571,128 +382,6 @@ standaloneTest("throw_from_except_constr") {
source = "runtime/exceptions/throw_from_except_constr.kt"
}
tasks.register("initializers6", KonanLocalTest) {
source = "runtime/basic/initializers6.kt"
}
tasks.register("memory_var1", KonanLocalTest) {
source = "runtime/memory/var1.kt"
}
tasks.register("memory_var2", KonanLocalTest) {
source = "runtime/memory/var2.kt"
}
tasks.register("memory_var3", KonanLocalTest) {
source = "runtime/memory/var3.kt"
}
tasks.register("memory_var4", KonanLocalTest) {
source = "runtime/memory/var4.kt"
}
tasks.register("memory_throw_cleanup", KonanLocalTest) {
useGoldenData = true
source = "runtime/memory/throw_cleanup.kt"
}
tasks.register("memory_escape0", KonanLocalTest) {
source = "runtime/memory/escape0.kt"
}
tasks.register("memory_escape1", KonanLocalTest) {
useGoldenData = true
source = "runtime/memory/escape1.kt"
}
tasks.register("memory_cycles0", KonanLocalTest) {
useGoldenData = true
source = "runtime/memory/cycles0.kt"
}
tasks.register("memory_cycles1", KonanLocalTest) {
enabled = !isNoopGC
source = "runtime/memory/cycles1.kt"
}
tasks.register("memory_basic0", KonanLocalTest) {
source = "runtime/memory/basic0.kt"
}
tasks.register("memory_escape2", KonanLocalTest) {
useGoldenData = true
source = "runtime/memory/escape2.kt"
}
tasks.register("memory_weak0", KonanLocalTest) {
enabled = !isNoopGC
useGoldenData = true
source = "runtime/memory/weak0.kt"
}
tasks.register("memory_weak1", KonanLocalTest) {
useGoldenData = true
source = "runtime/memory/weak1.kt"
}
standaloneTest("memory_only_gc") {
source = "runtime/memory/only_gc.kt"
}
standaloneTest("leakMemory") {
source = "runtime/memory/leak_memory.kt"
}
standaloneTest("leakMemoryWithTestRunner") {
source = "runtime/memory/leak_memory_test_runner.kt"
flags = ['-tr']
}
standaloneTest("gcStats") {
source = "runtime/memory/gcStats.kt"
flags = ['-tr', "-Xbinary=gcSchedulerType=disabled"]
enabled = !isNoopGC && !isAggressiveGC
}
standaloneTest("stress_gc_allocations") {
// TODO: Support obtaining peak RSS on more platforms.
enabled =
(project.testTarget != "watchos_arm32") &&
(project.testTarget != "watchos_arm64") &&
(project.testTarget != "watchos_x86") &&
(project.testTarget != "watchos_x64") &&
(project.testTarget != "watchos_simulator_arm64") &&
!isNoopGC && // Requires some GC.
!isAggressiveGC && // No need to check with aggressive GC at all
!runtimeAssertionsPanic // New allocator with assertions makes this test very slow.
source = "runtime/memory/stress_gc_allocations.kt"
flags = [
'-opt-in=kotlin.native.internal.InternalForKotlinNative', // MemoryUsageInfo is internal
'-Xdisable-phases=EscapeAnalysis', // The test checks GC, we need to allocate everything on the heap.
]
}
standaloneTest("array_out_of_memory") {
// This test allocs a large array that may make Linux
// kill any process inlcuding Gradle with OOM-killer
enabled = project.target.family != Family.LINUX
source = "runtime/memory/array_out_of_memory.kt"
flags = ['-tr']
switch(project.target.architecture) {
case Architecture.X64:
case Architecture.ARM64:
break;
case Architecture.X86:
case Architecture.ARM32:
case Architecture.MIPS32:
case Architecture.MIPSEL32:
case Architecture.WASM32:
expectedExitStatusChecker = { it != 0 }
outputChecker = { s -> s.contains("Out of memory trying to allocate") }
break;
}
}
tasks.register("vararg0", KonanLocalTest) {
source = "lower/vararg.kt"
}