From 40b01756c2e826d7ffb238e727b1e6d9b51551ba Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Sat, 16 Jun 2018 15:46:33 +0900 Subject: [PATCH 1/2] Update CwlPreconditionTesting and utilize _swift_reportFatalErrorsToDebugger --- .travis.yml | 12 ++++++++++++ Cartfile.private | 2 +- Cartfile.resolved | 2 +- .../Mach/CwlPreconditionTesting.h | 2 ++ .../Posix/CwlPreconditionTesting_POSIX.h | 2 ++ Sources/Nimble/Adapters/NimbleXCTestHandler.swift | 8 ++++++++ 6 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 20d7f7de3..23ce15900 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,18 @@ matrix: - os: osx env: TYPE=macos osx_image: xcode9 + - os: osx + env: TYPE=macos + osx_image: xcode9.1 + - os: osx + env: TYPE=macos + osx_image: xcode9.2 + - os: osx + env: TYPE=macos + osx_image: xcode9.3 + - os: osx + env: TYPE=macos + osx_image: xcode9.4 - os: osx env: TYPE=swiftpm - os: osx diff --git a/Cartfile.private b/Cartfile.private index 8e95dd603..23d7e1177 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1 +1 @@ -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Cartfile.resolved b/Cartfile.resolved index 3984e096b..32a1c25f8 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ github "mattgallagher/CwlCatchException" "b14c111e9b33cd142bd4bc75c482cfd5c3490923" -github "mattgallagher/CwlPreconditionTesting" "cb7ab89273cfd0725a7a2f865cc6fc560a9b9083" +github "mattgallagher/CwlPreconditionTesting" "1e62a726d54c743f4585233f08fcaac7307319b5" diff --git a/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h b/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h index f9dbedda8..7c50da11b 100644 --- a/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h +++ b/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Mach/CwlPreconditionTesting.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTestingVersionNumber; diff --git a/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h b/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h index 3434a7179..4e28f9514 100644 --- a/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h +++ b/Carthage/Checkouts/CwlPreconditionTesting/Sources/CwlPreconditionTesting/Posix/CwlPreconditionTesting_POSIX.h @@ -20,6 +20,8 @@ #import +extern bool _swift_reportFatalErrorsToDebugger; + //! Project version number for CwlUtils. FOUNDATION_EXPORT double CwlPreconditionTesting_POSIXVersionNumber; diff --git a/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 0ad85909b..259aa31e4 100644 --- a/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -43,11 +43,19 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private(set) var currentTestCase: XCTestCase? @objc func testCaseWillStart(_ testCase: XCTestCase) { + #if swift(>=3.2) + _swift_reportFatalErrorsToDebugger = false + #endif + currentTestCase = testCase } @objc func testCaseDidFinish(_ testCase: XCTestCase) { currentTestCase = nil + + #if swift(>=3.2) + _swift_reportFatalErrorsToDebugger = true + #endif } } #endif From 13f2cc8a22d28e81e9ce67992065dc40483e875f Mon Sep 17 00:00:00 2001 From: Sho Ikeda Date: Mon, 25 Jun 2018 21:06:52 +0900 Subject: [PATCH 2/2] Stash the original `_swift_reportFatalErrorsToDebugger` value --- Sources/Nimble/Adapters/NimbleXCTestHandler.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Sources/Nimble/Adapters/NimbleXCTestHandler.swift index 259aa31e4..c8d32adcf 100644 --- a/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ b/Sources/Nimble/Adapters/NimbleXCTestHandler.swift @@ -42,8 +42,11 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { private(set) var currentTestCase: XCTestCase? + private var stashed_swift_reportFatalErrorsToDebugger: Bool = false + @objc func testCaseWillStart(_ testCase: XCTestCase) { #if swift(>=3.2) + stashed_swift_reportFatalErrorsToDebugger = _swift_reportFatalErrorsToDebugger _swift_reportFatalErrorsToDebugger = false #endif @@ -54,7 +57,7 @@ class NimbleXCTestUnavailableHandler: AssertionHandler { currentTestCase = nil #if swift(>=3.2) - _swift_reportFatalErrorsToDebugger = true + _swift_reportFatalErrorsToDebugger = stashed_swift_reportFatalErrorsToDebugger #endif } }