[K/N] Deprecate -Xworker-exception-handling ^KT-65170

Also deprecate legacy option with error (was a warning since 1.9.20-Beta)
This commit is contained in:
Alexander Shabalin
2024-01-22 11:12:54 +01:00
committed by Space Team
parent 06095e86ca
commit 48f5e1d05c
4 changed files with 5 additions and 78 deletions
@@ -383,23 +383,14 @@ tasks.register("worker10", KonanLocalTest) {
}
standaloneTest("worker_exceptions") {
flags = ["-tr", "-Xworker-exception-handling=use-hook"]
flags = ["-tr"]
outputChecker = {
!it.contains("testExecuteAfterStartQuiet error") && it.contains("testExecuteStart error") && !it.contains("testExecuteStartQuiet error")
}
source = "runtime/workers/worker_exceptions.kt"
}
standaloneTest("worker_exceptions_legacy") {
flags = ["-tr", "-Xworker-exception-handling=legacy"]
outputChecker = {
it.contains("testExecuteAfterStartLegacy error") && it.contains("testExecuteStartLegacy error")
}
source = "runtime/workers/worker_exceptions_legacy.kt"
}
standaloneTest("worker_exceptions_terminate") {
flags = ["-Xworker-exception-handling=use-hook"]
expectedExitStatusChecker = { it != 0 }
outputChecker = {
it.contains("some error") && !it.contains("Will not happen")
@@ -407,32 +398,14 @@ standaloneTest("worker_exceptions_terminate") {
source = "runtime/workers/worker_exceptions_terminate.kt"
}
standaloneTest("worker_exceptions_terminate_legacy") {
flags = ["-Xworker-exception-handling=legacy"]
outputChecker = {
it.contains("some error") && it.contains("Will not happen")
}
source = "runtime/workers/worker_exceptions_terminate.kt"
}
standaloneTest("worker_exceptions_terminate_hook") {
flags = ["-Xworker-exception-handling=use-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_hook_legacy") {
flags = ["-Xworker-exception-handling=legacy"]
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") {
flags = ["-Xworker-exception-handling=use-hook"]
expectedExitStatusChecker = { it != 0 }
outputChecker = {
it.contains("some error") && !it.contains("Will not happen")
@@ -440,30 +413,13 @@ standaloneTest("worker_exceptions_terminate_current") {
source = "runtime/workers/worker_exceptions_terminate_current.kt"
}
standaloneTest("worker_exceptions_terminate_current_legacy") {
flags = ["-Xworker-exception-handling=legacy"]
outputChecker = {
it.contains("some error") && it.contains("Will not happen")
}
source = "runtime/workers/worker_exceptions_terminate_current.kt"
}
standaloneTest("worker_exceptions_terminate_hook_current") {
flags = ["-Xworker-exception-handling=use-hook"]
outputChecker = {
it.contains("hook called") && !it.contains("some error") && it.contains("Will happen")
}
source = "runtime/workers/worker_exceptions_terminate_hook_current.kt"
}
standaloneTest("worker_exceptions_terminate_hook_current_legacy") {
flags = ["-Xworker-exception-handling=legacy"]
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"
}
@@ -1,28 +0,0 @@
@file:OptIn(FreezingIsDeprecated::class, ObsoleteWorkersApi::class)
package runtime.workers.worker_exceptions_legacy
import kotlin.test.*
import kotlin.native.concurrent.*
@Test
fun testExecuteAfterStartLegacy() {
val worker = Worker.start()
worker.executeAfter(0L, {
throw Error("testExecuteAfterStartLegacy error")
}.freeze())
worker.requestTermination().result
}
@Test
fun testExecuteStartLegacy() {
val worker = Worker.start()
val future = worker.execute(TransferMode.SAFE, {}) {
throw Error("testExecuteStartLegacy error")
}
assertFailsWith<Throwable> {
future.result
}
worker.requestTermination().result
}