Skip to content

Commit 6c69c8d

Browse files
authored
Merge pull request #25135 from porglezomp-misc/fix/stdlib-unittest-over-release
FIx an overrelease in StdlibUnittest's getSystemVersionPlistProperty
2 parents e5e4f2a + b7c1798 commit 6c69c8d

File tree

4 files changed

+16
-45
lines changed

4 files changed

+16
-45
lines changed

stdlib/private/StdlibUnittest/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ add_swift_target_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES}
2929
StringConvertible.swift
3030
TestHelpers.swift
3131
TypeIndexed.swift
32-
GetOSVersion.mm
3332

3433
SWIFT_MODULE_DEPENDS SwiftPrivate SwiftPrivateThreadExtras SwiftPrivateLibcExtras
3534
SWIFT_MODULE_DEPENDS_IOS Darwin Foundation

stdlib/private/StdlibUnittest/GetOSVersion.mm

Lines changed: 0 additions & 38 deletions
This file was deleted.

stdlib/private/StdlibUnittest/StdlibUnittest.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import SwiftPrivateThreadExtras
1616
import SwiftPrivateLibcExtras
1717

1818
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
19+
import Foundation
1920
import Darwin
2021
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
2122
import Glibc
@@ -1714,13 +1715,8 @@ public final class TestSuite {
17141715
}
17151716

17161717
#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
1717-
@_silgen_name("getSystemVersionPlistProperty")
1718-
func _getSystemVersionPlistPropertyImpl(
1719-
_ propertyName: UnsafePointer<CChar>) -> UnsafePointer<CChar>?
1720-
17211718
func _getSystemVersionPlistProperty(_ propertyName: String) -> String? {
1722-
let cs = _getSystemVersionPlistPropertyImpl(propertyName)
1723-
return cs.map(String.init(cString:))
1719+
return NSDictionary(contentsOfFile: "/System/Library/CoreServices/SystemVersion.plist")?[propertyName] as? String
17241720
}
17251721
#endif
17261722

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// RUN: %target-run-simple-swift
2+
// REQUIRES: executable_test
3+
// REQUIRES: foundation
4+
5+
import Foundation
6+
import StdlibUnittest
7+
8+
var Suite = TestSuite("Overrelease")
9+
10+
Suite.test("doesntfail").xfail(.never).code { }
11+
12+
autoreleasepool {
13+
runAllTests()
14+
}

0 commit comments

Comments
 (0)