[test] Tweak class_getImageName to correctly handle 2018 OS betas (#18091)
Merge pull request #18089 from jrose-apple/unfamiliar-environment
(cherry picked from commit cdc7fb4a8ffe16457f7fb01c20046471f7135ef6)
rdar://problem/42398849
diff --git a/test/Interpreter/SDK/class_getImageName.swift b/test/Interpreter/SDK/class_getImageName.swift
index 6ab3af0..5a10fe7 100644
--- a/test/Interpreter/SDK/class_getImageName.swift
+++ b/test/Interpreter/SDK/class_getImageName.swift
@@ -22,18 +22,16 @@
"wrong library for \(cls)")
}
-var cannotUseObjCRuntimeHook = false
-#if targetEnvironment(device) && !os(macOS)
-if #available(iOS 12, tvOS 12, watchOS 5, *) {
+var newOSButCannotUseObjCRuntimeHook = false
+if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
// The only place these tests will fail is on early versions of the 2018 OSs.
// The final versions will have 'objc_setHook_getImageName'; anything earlier
// will be handled by manually overwriting the original implementation of
// 'class_getImageName'.
- cannotUseObjCRuntimeHook =
+ newOSButCannotUseObjCRuntimeHook =
(nil == dlsym(UnsafeMutableRawPointer(bitPattern: -2),
"objc_setHook_getImageName"))
}
-#endif // targetEnvironment(device) && !os(macOS)
var testSuite = TestSuite("class_getImageName")
@@ -43,7 +41,7 @@
}
testSuite.test("Generic")
- .xfail(.custom({ cannotUseObjCRuntimeHook },
+ .skip(.custom({ newOSButCannotUseObjCRuntimeHook },
reason: "hook for class_getImageName not present"))
.code {
check(GenericSwiftObject<Int>.self, in: "libGetImageNameHelper.dylib")
@@ -54,7 +52,7 @@
}
testSuite.test("GenericAncestry")
- .xfail(.custom({ cannotUseObjCRuntimeHook },
+ .skip(.custom({ newOSButCannotUseObjCRuntimeHook },
reason: "hook for class_getImageName not present"))
.code {
check(GenericAncestrySwiftObject.self, in: "libGetImageNameHelper.dylib")