Skip to content

Commit 9ae7141

Browse files
committed
[Test] Modify Runtime.swift.gyb to only test 9999 availability when running against a runtime that isn't part of the OS.
rdar://problem/55727341
1 parent dcf607d commit 9ae7141

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/stdlib/Runtime.swift.gyb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,8 +800,14 @@ AvailabilityVersionsTestSuite.test("_stdlib_isOSVersionAtLeast") {
800800
expectTrue(isAtLeastOS(0, 1066, 0))
801801
expectTrue(isAtLeastOS(0, 0, 1066))
802802

803-
// 9999 is a special version that's always available
804-
expectTrue(isAtLeastOS(9999, 0, 0))
803+
// When using a runtime that's not part of the OS, 9999 is a special version
804+
// that's always available. The _swift_classIsSwiftMask symbol is absent in OS
805+
// libraries, so detect based on that.
806+
let RTLD_DEFAULT = UnsafeMutableRawPointer(bitPattern: -2)
807+
let _swift_classIsSwiftMaskPtr = dlsym(RTLD_DEFAULT, "_swift_classIsSwiftMask")
808+
if _swift_classIsSwiftMaskPtr != nil {
809+
expectTrue(isAtLeastOS(9999, 0, 0))
810+
}
805811
#endif
806812
}
807813

0 commit comments

Comments
 (0)