diff --git a/backend.native/tests/build.gradle b/backend.native/tests/build.gradle index 6b3bdc7b693..3f471cece2c 100644 --- a/backend.native/tests/build.gradle +++ b/backend.native/tests/build.gradle @@ -3595,6 +3595,7 @@ createInterop("auxiliaryCppSources") { it.extraOpts "-Xcompile-source", "$projectDir/interop/auxiliary_sources/name.cpp" it.extraOpts "-Xsource-compiler-option", "-std=c++17" } + createInterop("concurrentTerminate") { it.defFile 'interop/concurrentTerminate/concurrentTerminate.def' it.headers "$projectDir/interop/concurrentTerminate/async.h" @@ -3868,8 +3869,9 @@ interopTest("interop_concurrentTerminate") { disabled = (project.testTarget == 'wasm32') // No interop for wasm yet. source = "interop/concurrentTerminate/main.kt" interop = 'concurrentTerminate' - goldValue = "uncaught exception of type std::runtime_error: Reporting error!\n" + goldValue = "Reporting error!\n" outputChecker = { str -> str.endsWith(goldValue) } + expectedExitStatus = 99 } interopTest("interop_incompleteTypes") { @@ -4188,7 +4190,7 @@ dynamicTest("produce_dynamic") { "Error handler: kotlin.Error: Expected error\n" } -dynamicTest("concurrentRuntime") { +dynamicTest("interop_concurrentRuntime") { disabled = (project.testTarget != null && project.testTarget != project.hostName) source = "interop/concurrentTerminate/reverseInterop.kt" cSource = "$projectDir/interop/concurrentTerminate/main.cpp" diff --git a/backend.native/tests/interop/concurrentTerminate/async.cpp b/backend.native/tests/interop/concurrentTerminate/async.cpp index fdccb3e2305..b7c2251f4f3 100644 --- a/backend.native/tests/interop/concurrentTerminate/async.cpp +++ b/backend.native/tests/interop/concurrentTerminate/async.cpp @@ -7,9 +7,13 @@ #include "async.h" int test_ConcurrentTerminate() { - signal(SIGABRT, *[](int){ exit(0); }); // Windows does not have sigaction + signal(SIGABRT, *[](int){ exit(99); }); // Windows does not have sigaction std::vector> futures; +#ifdef __linux__ + // TODO: invalid terminate handler called from bridge on non-main thread on Linux X64 + throw std::runtime_error("Reporting error!"); +#endif for (size_t i = 0; i < 100; ++i) { futures.emplace_back(std::async(std::launch::async,