Skip to content

Commit 8f8483f

Browse files
committed
SR-10512: TestFileManager .creationDate failed on Ubuntu 14.04
- .creationDate may not be available on all Linux platforms due to kernel version, Docker or other environment security settings etc so only check its value if it is non-nil. - Re-enable this test but allow for .creationDate possibly being nil.
1 parent b883eca commit 8f8483f

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

Tests/Foundation/Tests/TestFileManager.swift

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,10 @@ class TestFileManager : XCTestCase {
336336
XCTAssertNotNil(fileGroupOwnerAccountID)
337337

338338
#if os(Linux)
339-
/* ⚠️ */
340-
if shouldAttemptXFailTests("Checking that .creationDate is set is failing on Ubuntu 16.04 when running from a Docker image. https://bugs.swift.org/browse/SR-10512") {
341-
let requiredVersion = OperatingSystemVersion(majorVersion: 4, minorVersion: 11, patchVersion: 0)
342-
let creationDate = attrs[.creationDate] as? Date
343-
if ProcessInfo.processInfo.isOperatingSystemAtLeast(requiredVersion) {
344-
XCTAssertNotNil(creationDate)
345-
XCTAssertGreaterThan(Date().timeIntervalSince1970, try XCTUnwrap(creationDate).timeIntervalSince1970)
346-
} else {
347-
XCTAssertNil(creationDate)
348-
}
339+
// .creationDate is not not available on all Linux systems but if it is supported check the value is reasonable
340+
if let creationDate = attrs[.creationDate] as? Date {
341+
XCTAssertGreaterThan(Date().timeIntervalSince1970, creationDate.timeIntervalSince1970)
349342
}
350-
/* ⚠️ */
351343
#endif
352344

353345
if let fileOwnerAccountName = attrs[.ownerAccountName] {

0 commit comments

Comments
 (0)