diff --git a/test/stdlib/KVOKeyPaths.swift b/test/stdlib/KVOKeyPaths.swift index 00dbc67dc1f3a..26a410c60db5f 100644 --- a/test/stdlib/KVOKeyPaths.swift +++ b/test/stdlib/KVOKeyPaths.swift @@ -215,6 +215,6 @@ testObjectForOptionalKeyPath.optionalObject = nil testObjectForOptionalKeyPath.optionalObject = "foo" // CHECK-51-LABEL: observe keyPath with optional value -// CHECK-51-NEXT: oldValue = Optional(nil), newValue = {{Optional\(nil\)|nil}} -// CHECK-51-NEXT: oldValue = Optional(nil), newValue = {{Optional\(nil\)|nil}} -// CHECK-51-NEXT: oldValue = Optional(nil), newValue = Optional(Optional("foo")) +// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = {{Optional\(nil\)|nil}} +// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = {{Optional\(nil\)|nil}} +// CHECK-51-NEXT: oldValue = {{Optional\(nil\)|nil}}, newValue = Optional(Optional("foo")) diff --git a/validation-test/stdlib/ArrayTrapsObjC.swift b/validation-test/stdlib/ArrayTrapsObjC.swift index 9da81f0d09019..8a4ea3e1cc0ed 100644 --- a/validation-test/stdlib/ArrayTrapsObjC.swift +++ b/validation-test/stdlib/ArrayTrapsObjC.swift @@ -83,6 +83,18 @@ ArrayTraps.test("bounds_with_downcast") _ = da[2] } +func hasBackdeployedConcurrencyRuntime() -> Bool { + // If the stdlib we've loaded predates Swift 5.5, then we're running on a back + // deployed concurrency runtime, which has the side effect of disabling + // regular runtime exclusivity checks. + // + // This makes the two tests below fall back to older, higher-level exclusivity + // checks in the stdlib, which will still trap, but with a different message. + if #available(SwiftStdlib 5.5, *) { return false } // recent enough production stdlib + if #available(SwiftStdlib 9999, *) { return false } // dev stdlib + return true +} + var ArraySemanticOptzns = TestSuite("ArraySemanticOptzns" + testSuiteSuffix) class BaseClass { @@ -131,8 +143,11 @@ ArraySemanticOptzns.test("inout_rule_violated_isNativeBuffer") .skip(.custom( { _isFastAssertConfiguration() }, reason: "this trap is not guaranteed to happen in -Ounchecked")) - .crashOutputMatches(_isDebugAssertConfiguration() ? - "Fatal access conflict detected." : "") + .crashOutputMatches( + !_isDebugAssertConfiguration() ? "" + : hasBackdeployedConcurrencyRuntime() ? "inout rules were violated" + : "Fatal access conflict detected." + ) .code { let v = ViolateInoutSafetySwitchToObjcBuffer() expectCrashLater() @@ -174,8 +189,11 @@ ArraySemanticOptzns.test("inout_rule_violated_needsElementTypeCheck") .skip(.custom( { _isFastAssertConfiguration() }, reason: "this trap is not guaranteed to happen in -Ounchecked")) - .crashOutputMatches(_isDebugAssertConfiguration() ? - "Fatal access conflict detected." : "") + .crashOutputMatches( + !_isDebugAssertConfiguration() ? "" + : hasBackdeployedConcurrencyRuntime() ? "inout rules were violated" + : "Fatal access conflict detected." + ) .code { let v = ViolateInoutSafetyNeedElementTypeCheck() expectCrashLater() diff --git a/validation-test/stdlib/SetOperations.swift.gyb b/validation-test/stdlib/SetOperations.swift.gyb index 57a6e85fbf137..47cca4ddb812a 100644 --- a/validation-test/stdlib/SetOperations.swift.gyb +++ b/validation-test/stdlib/SetOperations.swift.gyb @@ -248,66 +248,6 @@ suite.test("symmetricDifference.${inputKind}.${argumentKind}") { % end % end -% for inputKind, inputGenerator in inputKinds.items(): -% for argumentKind, argumentGenerator in argumentKinds.items(): -% needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa" -% if needsCocoa: -#if _runtime(_ObjC) -% end -suite.test("formIntersection.${inputKind}.${argumentKind}") { - var a = ${inputGenerator}(0 ..< 10, identity: 1) - let b = ${argumentGenerator}(5 ..< 15, identity: 2) - a.formSymmetricDifference(b) - expectTrue(isNativeSet(a)) - expectEqual(a.count, 10) - // Check the resulting items and that they come from the correct input set. - for v in 5 ..< 10 { - expectFalse(a.contains(Value(v)), "Found \(v) in result") - } - for v in Array(0 ..< 5) + Array(10 ..< 15) { - guard let i = a.firstIndex(of: Value(v)) else { - expectTrue(false, "Could not find \(v) in result") - continue - } - expectEqual(a[i].identity, v < 5 ? 1 : 2) - } -} -% if needsCocoa: -#endif -% end -% end -% end - -% for inputKind, inputGenerator in inputKinds.items(): -% for argumentKind, argumentGenerator in argumentKinds.items(): -% needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa" -% if needsCocoa: -#if _runtime(_ObjC) -% end -suite.test("symmetricDifference.${inputKind}.${argumentKind}") { - let a = ${inputGenerator}(0 ..< 10, identity: 1) - let b = ${argumentGenerator}(5 ..< 15, identity: 2) - let c = a.symmetricDifference(b) - expectTrue(isNativeSet(c)) - expectEqual(c.count, 10) - // Check the resulting items and that they come from the correct input set. - for v in 5 ..< 10 { - expectFalse(c.contains(Value(v)), "Found \(v) in result") - } - for v in Array(0 ..< 5) + Array(10 ..< 15) { - guard let i = c.firstIndex(of: Value(v)) else { - expectTrue(false, "Could not find \(v) in result") - continue - } - expectEqual(c[i].identity, v < 5 ? 1 : 2) - } -} -% if needsCocoa: -#endif -% end -% end -% end - % for inputKind, inputGenerator in inputKinds.items(): % for argumentKind, argumentGenerator in argumentKinds.items(): % needsCocoa = inputKind == "cocoa" or argumentKind == "cocoa"