Skip to content

Commit 2947fd5

Browse files
committed
[test] Tweak class_getImageName to correctly handle 2018 OS betas
I messed up the condition here---'targetEnvironment(device)' is ignored and should be written '!targetEnvironment(simulator)'---but even besides that I didn't actually have the right conditions for which iOS devices this passes on and which it doesn't. Rather than trying to perfectly match this with an XFAIL, just skip the parts of the test that depend on having a new enough 2018 OS build if we, well, don't have it. rdar://problem/42398849
1 parent 7f105e4 commit 2947fd5

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/Interpreter/SDK/class_getImageName.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,16 @@ func check(_ cls: AnyClass, in library: String) {
2222
"wrong library for \(cls)")
2323
}
2424

25-
var cannotUseObjCRuntimeHook = false
26-
#if targetEnvironment(device) && !os(macOS)
27-
if #available(iOS 12, tvOS 12, watchOS 5, *) {
25+
var newOSButCannotUseObjCRuntimeHook = false
26+
if #available(macOS 10.14, iOS 12, tvOS 12, watchOS 5, *) {
2827
// The only place these tests will fail is on early versions of the 2018 OSs.
2928
// The final versions will have 'objc_setHook_getImageName'; anything earlier
3029
// will be handled by manually overwriting the original implementation of
3130
// 'class_getImageName'.
32-
cannotUseObjCRuntimeHook =
31+
newOSButCannotUseObjCRuntimeHook =
3332
(nil == dlsym(UnsafeMutableRawPointer(bitPattern: -2),
3433
"objc_setHook_getImageName"))
3534
}
36-
#endif // targetEnvironment(device) && !os(macOS)
3735

3836
var testSuite = TestSuite("class_getImageName")
3937

@@ -43,7 +41,7 @@ testSuite.test("Simple") {
4341
}
4442

4543
testSuite.test("Generic")
46-
.xfail(.custom({ cannotUseObjCRuntimeHook },
44+
.skip(.custom({ newOSButCannotUseObjCRuntimeHook },
4745
reason: "hook for class_getImageName not present"))
4846
.code {
4947
check(GenericSwiftObject<Int>.self, in: "libGetImageNameHelper.dylib")
@@ -54,7 +52,7 @@ testSuite.test("Generic")
5452
}
5553

5654
testSuite.test("GenericAncestry")
57-
.xfail(.custom({ cannotUseObjCRuntimeHook },
55+
.skip(.custom({ newOSButCannotUseObjCRuntimeHook },
5856
reason: "hook for class_getImageName not present"))
5957
.code {
6058
check(GenericAncestrySwiftObject.self, in: "libGetImageNameHelper.dylib")

0 commit comments

Comments
 (0)