Skip to content

Commit 396dd73

Browse files
authored
Merge pull request #27437 from mikeash/fix-9999-available-testing-against-os
2 parents 91e4c0e + 9ae7141 commit 396dd73

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)