-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from swiftwasm/katei/format-test-patches
Format StdlibUnittest patches
- Loading branch information
Showing
6 changed files
with
77 additions
and
232 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
schemes/main/swift/0002-build-Fix-cmake-config-for-reflection-test-without-d.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
From cd0bac9cf59ab923c6e0d79638c7c6cfbb5a2b50 Mon Sep 17 00:00:00 2001 | ||
From: Yuta Saito <[email protected]> | ||
Date: Thu, 29 Jun 2023 08:22:44 +0000 | ||
Subject: [PATCH] [build] Fix cmake config for reflection test without dynamic | ||
stdlib | ||
|
||
Build SwiftReflectionTest only if swift-reflection-test is available | ||
because it depends on the tool and the tool is not available when no | ||
dynamic stdlib is built | ||
--- | ||
stdlib/private/SwiftReflectionTest/CMakeLists.txt | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/stdlib/private/SwiftReflectionTest/CMakeLists.txt b/stdlib/private/SwiftReflectionTest/CMakeLists.txt | ||
index 27a7013f42f..45615e5c959 100644 | ||
--- a/stdlib/private/SwiftReflectionTest/CMakeLists.txt | ||
+++ b/stdlib/private/SwiftReflectionTest/CMakeLists.txt | ||
@@ -1,5 +1,5 @@ | ||
|
||
-if (SWIFT_INCLUDE_TESTS) | ||
+if (SWIFT_INCLUDE_TESTS AND SWIFT_BUILD_DYNAMIC_STDLIB) | ||
add_swift_target_library(swiftSwiftReflectionTest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB | ||
SwiftReflectionTest.swift | ||
SWIFT_COMPILE_FLAGS ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS} | ||
-- | ||
2.40.0 | ||
|
44 changes: 0 additions & 44 deletions
44
schemes/main/swift/0002-wasm-cmake-HACK-Skip-building-swift-reflection-test-.patch
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
schemes/main/swift/0004-wasm-cmake-HACK-link-wasi-emulated-mman-to-host-exec.patch
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From c280b47c86434d33512b8c48c1868777971dbad2 Mon Sep 17 00:00:00 2001 | ||
From 77f85831ce3025717f349cd5e28fd290e8bdf114 Mon Sep 17 00:00:00 2001 | ||
From: Yuta Saito <[email protected]> | ||
Date: Tue, 20 Jun 2023 07:50:16 +0000 | ||
Subject: [PATCH] [wasm][cmake] Add WASI specific stdlib dependencies | ||
|
@@ -7,51 +7,25 @@ Currently WASI target doesn't support SwiftPrivateThreadExtras, so we | |
need to remove it from the common dependencies. Also WASI target has its | ||
own libc module WASILibc, so we need to add it as well as other libc modules. | ||
--- | ||
stdlib/private/StdlibUnittest/CMakeLists.txt | 27 ++++++++++--------- | ||
stdlib/private/SwiftPrivate/CMakeLists.txt | 1 + | ||
.../SwiftPrivateLibcExtras/CMakeLists.txt | 1 + | ||
.../SwiftPrivateThreadExtras/CMakeLists.txt | 1 + | ||
stdlib/public/Differentiation/CMakeLists.txt | 1 + | ||
5 files changed, 18 insertions(+), 13 deletions(-) | ||
stdlib/private/StdlibUnittest/CMakeLists.txt | 1 + | ||
stdlib/private/SwiftPrivate/CMakeLists.txt | 1 + | ||
stdlib/private/SwiftPrivateLibcExtras/CMakeLists.txt | 1 + | ||
stdlib/private/SwiftPrivateThreadExtras/CMakeLists.txt | 1 + | ||
stdlib/public/Differentiation/CMakeLists.txt | 1 + | ||
5 files changed, 5 insertions(+) | ||
|
||
diff --git a/stdlib/private/StdlibUnittest/CMakeLists.txt b/stdlib/private/StdlibUnittest/CMakeLists.txt | ||
index a8a3f17b60b..714cca193cf 100644 | ||
index a8a3f17b60b..574b4aeea36 100644 | ||
--- a/stdlib/private/StdlibUnittest/CMakeLists.txt | ||
+++ b/stdlib/private/StdlibUnittest/CMakeLists.txt | ||
@@ -49,19 +49,20 @@ add_swift_target_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} | ||
TestHelpers.swift | ||
TypeIndexed.swift | ||
|
||
- SWIFT_MODULE_DEPENDS SwiftPrivate SwiftPrivateThreadExtras SwiftPrivateLibcExtras ${swift_stdlib_unittest_modules} | ||
- SWIFT_MODULE_DEPENDS_IOS Darwin | ||
- SWIFT_MODULE_DEPENDS_OSX Darwin | ||
- SWIFT_MODULE_DEPENDS_TVOS Darwin | ||
- SWIFT_MODULE_DEPENDS_WATCHOS Darwin | ||
- SWIFT_MODULE_DEPENDS_MACCATALYST Darwin | ||
- SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}" | ||
- SWIFT_MODULE_DEPENDS_LINUX Glibc | ||
- SWIFT_MODULE_DEPENDS_FREEBSD Glibc | ||
- SWIFT_MODULE_DEPENDS_OPENBSD Glibc | ||
- SWIFT_MODULE_DEPENDS_CYGWIN Glibc | ||
- SWIFT_MODULE_DEPENDS_HAIKU Glibc | ||
- SWIFT_MODULE_DEPENDS_WINDOWS CRT WinSDK | ||
+ SWIFT_MODULE_DEPENDS SwiftPrivate SwiftPrivateLibcExtras ${swift_stdlib_unittest_modules} | ||
+ SWIFT_MODULE_DEPENDS_IOS Darwin SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_OSX Darwin SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_TVOS Darwin SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_WATCHOS Darwin SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_MACCATALYST Darwin SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_FREESTANDING "${SWIFT_FREESTANDING_TEST_DEPENDENCIES}" SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_LINUX Glibc SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_FREEBSD Glibc SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_OPENBSD Glibc SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_CYGWIN Glibc SwiftPrivateThreadExtras | ||
+ SWIFT_MODULE_DEPENDS_HAIKU Glibc SwiftPrivateThreadExtras | ||
@@ -61,6 +61,7 @@ add_swift_target_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} | ||
SWIFT_MODULE_DEPENDS_OPENBSD Glibc | ||
SWIFT_MODULE_DEPENDS_CYGWIN Glibc | ||
SWIFT_MODULE_DEPENDS_HAIKU Glibc | ||
+ SWIFT_MODULE_DEPENDS_WASI WASILibc | ||
+ SWIFT_MODULE_DEPENDS_WINDOWS CRT WinSDK SwiftPrivateThreadExtras | ||
SWIFT_MODULE_DEPENDS_WINDOWS CRT WinSDK | ||
C_COMPILE_FLAGS -I${SWIFT_SOURCE_DIR}/stdlib/include | ||
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS} | ||
INSTALL_IN_COMPONENT stdlib-experimental | ||
diff --git a/stdlib/private/SwiftPrivate/CMakeLists.txt b/stdlib/private/SwiftPrivate/CMakeLists.txt | ||
index a1fc412a156..f1e7d461d0e 100644 | ||
--- a/stdlib/private/SwiftPrivate/CMakeLists.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 4d83bfcd0f66f92911be7d29ab4a61dac84f7ff6 Mon Sep 17 00:00:00 2001 | ||
From 75f7971a35691d0e296818bd9951c146cf202335 Mon Sep 17 00:00:00 2001 | ||
From: Yuta Saito <[email protected]> | ||
Date: Tue, 20 Jun 2023 07:53:38 +0000 | ||
Subject: [PATCH] [wasm][test] Fix build of StdlibUnittest on WASI | ||
|
@@ -8,16 +8,29 @@ threads/processes. So this patch disables interception support and | |
subprocess spawning. The later patch will disable crash tests in each | ||
test case. | ||
--- | ||
.../private/StdlibUnittest/InterceptTraps.cpp | 6 +++--- | ||
stdlib/private/StdlibUnittest/RaceTest.swift | 2 ++ | ||
.../StdlibUnittest/StdlibUnittest.swift | 20 +++++++++++++++++-- | ||
3 files changed, 23 insertions(+), 5 deletions(-) | ||
stdlib/private/StdlibUnittest/InterceptTraps.cpp | 12 ++---------- | ||
stdlib/private/StdlibUnittest/StdlibUnittest.swift | 12 ++++++++++-- | ||
2 files changed, 12 insertions(+), 12 deletions(-) | ||
|
||
diff --git a/stdlib/private/StdlibUnittest/InterceptTraps.cpp b/stdlib/private/StdlibUnittest/InterceptTraps.cpp | ||
index 80c3fa59795..cf81e872556 100644 | ||
index 80c3fa59795..363d37ea725 100644 | ||
--- a/stdlib/private/StdlibUnittest/InterceptTraps.cpp | ||
+++ b/stdlib/private/StdlibUnittest/InterceptTraps.cpp | ||
@@ -50,8 +50,6 @@ static void CrashCatcher(int Sig) { | ||
@@ -10,12 +10,10 @@ | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
-// No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166. | ||
-#if !defined(__wasi__) | ||
#include <stdio.h> | ||
#include <signal.h> | ||
#include <string.h> | ||
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) | ||
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__wasi__) | ||
#include <unistd.h> | ||
#endif | ||
#if defined(_WIN32) | ||
@@ -50,8 +48,6 @@ static void CrashCatcher(int Sig) { | ||
_exit(0); | ||
} | ||
|
||
|
@@ -26,46 +39,29 @@ index 80c3fa59795..cf81e872556 100644 | |
#if defined(_WIN32) | ||
static LONG WINAPI | ||
VectoredCrashHandler(PEXCEPTION_POINTERS ExceptionInfo) { | ||
@@ -92,6 +90,8 @@ void installTrapInterceptor() { | ||
@@ -74,9 +70,6 @@ void installTrapInterceptor() { | ||
// Disable buffering on stdout so that everything is printed before crashing. | ||
setbuf(stdout, 0); | ||
|
||
-// No signals support on WASI yet, see https://github.com/WebAssembly/WASI/issues/166. | ||
-#if !defined(__wasi__) | ||
- | ||
#if defined(_WIN32) | ||
_set_abort_behavior(0, _WRITE_ABORT_MSG); | ||
#endif | ||
@@ -92,6 +85,5 @@ void installTrapInterceptor() { | ||
signal(SIGBUS, CrashCatcher); | ||
signal(SIGSYS, CrashCatcher); | ||
#endif | ||
-} | ||
|
||
#endif // !defined(__wasi__) | ||
-#endif // !defined(__wasi__) | ||
+} | ||
+ | ||
+#endif // !defined(__wasi__) | ||
\ No newline at end of file | ||
diff --git a/stdlib/private/StdlibUnittest/RaceTest.swift b/stdlib/private/StdlibUnittest/RaceTest.swift | ||
index 008f17a5200..368f49d7000 100644 | ||
--- a/stdlib/private/StdlibUnittest/RaceTest.swift | ||
+++ b/stdlib/private/StdlibUnittest/RaceTest.swift | ||
@@ -38,7 +38,9 @@ | ||
|
||
import SwiftPrivate | ||
import SwiftPrivateLibcExtras | ||
+#if !os(WASI) | ||
import SwiftPrivateThreadExtras | ||
+#endif | ||
#if canImport(Darwin) | ||
import Darwin | ||
#elseif canImport(Glibc) | ||
diff --git a/stdlib/private/StdlibUnittest/StdlibUnittest.swift b/stdlib/private/StdlibUnittest/StdlibUnittest.swift | ||
index 9cb21b7d6d1..56aea542128 100644 | ||
index 9cb21b7d6d1..71762d59988 100644 | ||
--- a/stdlib/private/StdlibUnittest/StdlibUnittest.swift | ||
+++ b/stdlib/private/StdlibUnittest/StdlibUnittest.swift | ||
@@ -12,7 +12,9 @@ | ||
|
||
|
||
import SwiftPrivate | ||
+#if !os(WASI) | ||
import SwiftPrivateThreadExtras | ||
+#endif | ||
import SwiftPrivateLibcExtras | ||
|
||
#if canImport(Darwin) | ||
@@ -22,6 +24,8 @@ import Foundation | ||
@@ -22,6 +22,8 @@ import Foundation | ||
import Darwin | ||
#elseif canImport(Glibc) | ||
import Glibc | ||
|
@@ -74,7 +70,7 @@ index 9cb21b7d6d1..56aea542128 100644 | |
#elseif os(Windows) | ||
import CRT | ||
import WinSDK | ||
@@ -35,6 +39,12 @@ import ObjectiveC | ||
@@ -35,6 +37,12 @@ import ObjectiveC | ||
import _Concurrency | ||
#endif | ||
|
||
|
@@ -87,38 +83,7 @@ index 9cb21b7d6d1..56aea542128 100644 | |
extension String { | ||
/// Returns the lines in `self`. | ||
public var _lines : [String] { | ||
@@ -855,8 +865,10 @@ var _testSuiteNameToIndex: [String : Int] = [:] | ||
let _stdlibUnittestStreamPrefix = "__STDLIB_UNITTEST__" | ||
let _crashedPrefix = "CRASHED:" | ||
|
||
+#if !os(WASI) | ||
@_silgen_name("installTrapInterceptor") | ||
func _installTrapInterceptor() | ||
+#endif | ||
|
||
#if _runtime(_ObjC) | ||
@objc protocol _StdlibUnittestNSException { | ||
@@ -867,7 +879,9 @@ func _installTrapInterceptor() | ||
// Avoid serializing references to objc_setUncaughtExceptionHandler in SIL. | ||
@inline(never) | ||
func _childProcess() { | ||
+#if !os(WASI) | ||
_installTrapInterceptor() | ||
+#endif | ||
|
||
#if _runtime(_ObjC) | ||
objc_setUncaughtExceptionHandler { | ||
@@ -923,7 +937,9 @@ func _childProcess() { | ||
@available(SwiftStdlib 5.1, *) | ||
@inline(never) | ||
func _childProcessAsync() async { | ||
+#if !os(WASI) | ||
_installTrapInterceptor() | ||
+#endif | ||
|
||
#if _runtime(_ObjC) | ||
objc_setUncaughtExceptionHandler { | ||
@@ -1724,7 +1740,7 @@ public func runAllTests() { | ||
@@ -1724,7 +1732,7 @@ public func runAllTests() { | ||
if _isChildProcess { | ||
_childProcess() | ||
} else { | ||
|
@@ -127,7 +92,7 @@ index 9cb21b7d6d1..56aea542128 100644 | |
var filter: String? | ||
var args = [String]() | ||
var i = 0 | ||
@@ -1794,7 +1810,7 @@ public func runAllTestsAsync() async { | ||
@@ -1794,7 +1802,7 @@ public func runAllTestsAsync() async { | ||
if _isChildProcess { | ||
await _childProcessAsync() | ||
} else { | ||
|
50 changes: 0 additions & 50 deletions
50
schemes/main/swift/0034-wasm-test-HACK-Disable-objc-interop-and-lldb-related.patch
This file was deleted.
Oops, something went wrong.