Skip to content
This repository has been archived by the owner on Aug 10, 2021. It is now read-only.

Commit

Permalink
[test] fix and workaround for windows and linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Ivanov committed Sep 25, 2020
1 parent 3862795 commit deb3cbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions backend.native/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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") {
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 5 additions & 1 deletion backend.native/tests/interop/concurrentTerminate/async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::future<void>> 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,
Expand Down

0 comments on commit deb3cbc

Please sign in to comment.