File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
stdlib/private/StdlibUnittest Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 10
10
//
11
11
// ===----------------------------------------------------------------------===//
12
12
13
- // No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166.
14
- #if !defined(__wasi__)
15
13
#include < stdio.h>
16
14
#include < signal.h>
17
15
#include < string.h>
18
- #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
16
+ #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__wasi__)
19
17
#include < unistd.h>
20
18
#endif
21
19
#if defined(_WIN32)
@@ -50,8 +48,6 @@ static void CrashCatcher(int Sig) {
50
48
_exit (0 );
51
49
}
52
50
53
- #endif // __wasi__
54
-
55
51
#if defined(_WIN32)
56
52
static LONG WINAPI
57
53
VectoredCrashHandler (PEXCEPTION_POINTERS ExceptionInfo) {
@@ -74,9 +70,6 @@ void installTrapInterceptor() {
74
70
// Disable buffering on stdout so that everything is printed before crashing.
75
71
setbuf (stdout, 0 );
76
72
77
- // No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166.
78
- #if !defined(__wasi__)
79
-
80
73
#if defined(_WIN32)
81
74
_set_abort_behavior (0 , _WRITE_ABORT_MSG);
82
75
#endif
@@ -92,6 +85,5 @@ void installTrapInterceptor() {
92
85
signal (SIGBUS, CrashCatcher);
93
86
signal (SIGSYS, CrashCatcher);
94
87
#endif
95
- }
96
88
97
- # endif // !defined(__wasi__)
89
+ }
Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ import Darwin
24
24
import Glibc
25
25
#elseif canImport(Musl)
26
26
import Musl
27
+ #elseif os(WASI)
28
+ import WASILibc
27
29
#elseif os(Windows)
28
30
import CRT
29
31
import WinSDK
@@ -37,6 +39,12 @@ import ObjectiveC
37
39
import _Concurrency
38
40
#endif
39
41
42
+ #if os(WASI)
43
+ let platformSupportSpawnChild = false
44
+ #else
45
+ let platformSupportSpawnChild = true
46
+ #endif
47
+
40
48
extension String {
41
49
/// Returns the lines in `self`.
42
50
public var _lines : [ String ] {
@@ -1726,7 +1734,7 @@ public func runAllTests() {
1726
1734
if _isChildProcess {
1727
1735
_childProcess ( )
1728
1736
} else {
1729
- var runTestsInProcess : Bool = false
1737
+ var runTestsInProcess : Bool = !platformSupportSpawnChild
1730
1738
var filter : String ?
1731
1739
var args = [ String] ( )
1732
1740
var i = 0
@@ -1796,7 +1804,7 @@ public func runAllTestsAsync() async {
1796
1804
if _isChildProcess {
1797
1805
await _childProcessAsync ( )
1798
1806
} else {
1799
- var runTestsInProcess : Bool = false
1807
+ var runTestsInProcess : Bool = !platformSupportSpawnChild
1800
1808
var filter : String ?
1801
1809
var args = [ String] ( )
1802
1810
var i = 0
You can’t perform that action at this time.
0 commit comments