Skip to content

Commit 07df806

Browse files
authored
Merge pull request #2402 from drodriguez/android-mark-link-test-as-xfail
[android] Mark link test in TestFileManager as failing for Android.
2 parents beee65b + 6417965 commit 07df806

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

TestFoundation/TestFileManager.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,7 @@ VIDEOS=StopgapVideos
17591759
("test_contentsOfDirectoryAtPath", test_contentsOfDirectoryAtPath),
17601760
("test_subpathsOfDirectoryAtPath", test_subpathsOfDirectoryAtPath),
17611761
("test_copyItemAtPathToPath", test_copyItemAtPathToPath),
1762-
("test_linkItemAtPathToPath", test_linkItemAtPathToPath),
1762+
("test_linkItemAtPathToPath", testExpectedToFailOnAndroid(test_linkItemAtPathToPath, "Android doesn't allow hard links")),
17631763
("test_homedirectoryForUser", test_homedirectoryForUser),
17641764
("test_temporaryDirectoryForUser", test_temporaryDirectoryForUser),
17651765
("test_creatingDirectoryWithShortIntermediatePath", test_creatingDirectoryWithShortIntermediatePath),

TestFoundation/TestThread.swift

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@ class TestThread : XCTestCase {
2525
("test_currentThread", test_currentThread),
2626
("test_threadStart", test_threadStart),
2727
("test_mainThread", test_mainThread),
28+
("test_callStackSymbols", testExpectedToFailOnAndroid(test_callStackSymbols, "Android doesn't support backtraces at the moment.")),
29+
("test_callStackReturnAddresses", testExpectedToFailOnAndroid(test_callStackReturnAddresses, "Android doesn't support backtraces at the moment.")),
2830
]
2931

30-
#if !os(Android)
31-
// Android doesn't support backtraces at the moment.
32-
tests.append(contentsOf: [
33-
("test_callStackSymbols", test_callStackSymbols),
34-
("test_callStackReturnAddresses", test_callStackReturnAddresses),
35-
])
36-
#endif
37-
3832
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
3933
tests.append(contentsOf: [
4034
("test_threadName", test_threadName),

TestFoundation/TestURLSession.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,6 @@ class TestURLSession : LoopbackServerTest {
313313

314314
// This test is buggy becuase the server could respond before the task is cancelled.
315315
func test_cancelTask() {
316-
#if os(Android)
317-
XCTFail("Intermittent failures on Android")
318-
#else
319316
let urlString = "http://127.0.0.1:\(TestURLSession.serverPort)/Peru"
320317
var urlRequest = URLRequest(url: URL(string: urlString)!)
321318
urlRequest.setValue("2.0", forHTTPHeaderField: "X-Pause")
@@ -324,7 +321,6 @@ class TestURLSession : LoopbackServerTest {
324321
d.run(with: urlRequest)
325322
d.cancel()
326323
waitForExpectations(timeout: 12)
327-
#endif
328324
}
329325

330326
func test_verifyRequestHeaders() {

TestFoundation/Utilities.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,14 @@ func shouldAttemptWindowsXFailTests(_ reason: String) -> Bool {
534534
#endif
535535
}
536536

537+
func shouldAttemptAndroidXFailTests(_ reason: String) -> Bool {
538+
#if os(Android)
539+
return shouldAttemptXFailTests(reason)
540+
#else
541+
return true
542+
#endif
543+
}
544+
537545
func appendTestCaseExpectedToFail<T: XCTestCase>(_ reason: String, _ allTests: [(String, (T) -> () throws -> Void)], into array: inout [XCTestCaseEntry]) {
538546
if shouldAttemptXFailTests(reason) {
539547
array.append(testCase(allTests))
@@ -548,6 +556,10 @@ func testExpectedToFailOnWindows<T>(_ test: @escaping (T) -> () throws -> Void,
548556
testExpectedToFailWithCheck(check: shouldAttemptWindowsXFailTests(_:), test, reason)
549557
}
550558

559+
func testExpectedToFailOnAndroid<T>(_ test: @escaping (T) -> () throws -> Void, _ reason: String) -> (T) -> () throws -> Void {
560+
testExpectedToFailWithCheck(check: shouldAttemptAndroidXFailTests(_:), test, reason)
561+
}
562+
551563
func testExpectedToFailWithCheck<T>(check: (String) -> Bool, _ test: @escaping (T) -> () throws -> Void, _ reason: String) -> (T) -> () throws -> Void {
552564
if check(reason) {
553565
return test

0 commit comments

Comments
 (0)