Skip to content

Commit 634c582

Browse files
committed
[test] Fix test regressions in backdeployment bots
Resolves rdar://71902574
1 parent 3211817 commit 634c582

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

test/PlaygroundTransform/implicit_return_never.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/main --crash" 2>&1 | %FileCheck -check-prefix=CRASH-CHECK %s
66
// REQUIRES: executable_test
77

8+
// The runtime error format changed after the 5.3 release.
9+
// UNSUPPORTED: use_os_stdlib
10+
811
// NOTE: not.py is used above instead of "not --crash" because simctl's exit
912
// status doesn't reflect whether its child process crashed or not. So "not
1013
// --crash %target-run ..." always fails when testing for the iOS Simulator.

test/PlaygroundTransform/placeholder.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
// RUN: %{python} %S/../Inputs/not.py "%target-run %t/main --crash" 2>&1 | %FileCheck -check-prefix=CRASH-CHECK %s
77
// REQUIRES: executable_test
88

9+
// The runtime error format changed after the 5.3 release.
10+
// UNSUPPORTED: use_os_stdlib
11+
912
// NOTE: not.py is used above instead of "not --crash" because simctl's exit
1013
// status doesn't reflect whether its child process crashed or not. So "not
1114
// --crash %target-run ..." always fails when testing for the iOS Simulator.

test/stdlib/Error.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66

77
import StdlibUnittest
88

9+
func shouldCheckErrorLocation() -> Bool {
10+
// Location information for runtime traps is only emitted in debug builds.
11+
guard _isDebugAssertConfiguration() else { return false }
12+
// The runtime error location format changed after the 5.3 release.
13+
// (https://github.com/apple/swift/pull/34665)
14+
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
15+
return true
16+
} else {
17+
return false
18+
}
19+
}
20+
921
var ErrorTests = TestSuite("Error")
1022

1123
var NoisyErrorLifeCount = 0
@@ -108,7 +120,7 @@ enum SillyError: Error { case JazzHands }
108120
ErrorTests.test("try!")
109121
.skip(.custom({ _isFastAssertConfiguration() },
110122
reason: "trap is not guaranteed to happen in -Ounchecked"))
111-
.crashOutputMatches(_isDebugAssertConfiguration()
123+
.crashOutputMatches(shouldCheckErrorLocation()
112124
? "'try!' expression unexpectedly raised an error: "
113125
+ "main.SillyError.JazzHands"
114126
: "")
@@ -120,8 +132,8 @@ ErrorTests.test("try!")
120132
ErrorTests.test("try!/location")
121133
.skip(.custom({ _isFastAssertConfiguration() },
122134
reason: "trap is not guaranteed to happen in -Ounchecked"))
123-
.crashOutputMatches(_isDebugAssertConfiguration()
124-
? "main/Error.swift:128"
135+
.crashOutputMatches(shouldCheckErrorLocation()
136+
? "main/Error.swift:140"
125137
: "")
126138
.code {
127139
expectCrashLater()

test/stdlib/OptionalTraps.swift

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ func returnNil() -> AnyObject? {
2020

2121
var OptionalTraps = TestSuite("OptionalTraps")
2222

23+
func shouldCheckErrorLocation() -> Bool {
24+
// Location information for runtime traps is only emitted in debug builds.
25+
guard _isDebugAssertConfiguration() else { return false }
26+
// The runtime error location format changed after the 5.3 release.
27+
// (https://github.com/apple/swift/pull/34665)
28+
if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) {
29+
return true
30+
} else {
31+
return false
32+
}
33+
}
34+
2335
OptionalTraps.test("UnwrapNone")
2436
.skip(.custom(
2537
{ _isFastAssertConfiguration() },
@@ -35,8 +47,8 @@ OptionalTraps.test("UnwrapNone/location")
3547
.skip(.custom(
3648
{ _isFastAssertConfiguration() },
3749
reason: "this trap is not guaranteed to happen in -Ounchecked"))
38-
.crashOutputMatches(_isDebugAssertConfiguration()
39-
? "OptionalTraps.swift:45:"
50+
.crashOutputMatches(shouldCheckErrorLocation()
51+
? "OptionalTraps.swift:57:"
4052
: "")
4153
.code {
4254
expectCrashLater()

0 commit comments

Comments
 (0)