Skip to content

[android] Mark link test in TestFileManager as failing for Android. #2402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion TestFoundation/TestFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ VIDEOS=StopgapVideos
("test_contentsOfDirectoryAtPath", test_contentsOfDirectoryAtPath),
("test_subpathsOfDirectoryAtPath", test_subpathsOfDirectoryAtPath),
("test_copyItemAtPathToPath", test_copyItemAtPathToPath),
("test_linkItemAtPathToPath", test_linkItemAtPathToPath),
("test_linkItemAtPathToPath", testExpectedToFailOnAndroid(test_linkItemAtPathToPath, "Android doesn't allow hard links")),
("test_homedirectoryForUser", test_homedirectoryForUser),
("test_temporaryDirectoryForUser", test_temporaryDirectoryForUser),
("test_creatingDirectoryWithShortIntermediatePath", test_creatingDirectoryWithShortIntermediatePath),
Expand Down
10 changes: 2 additions & 8 deletions TestFoundation/TestThread.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,10 @@ class TestThread : XCTestCase {
("test_currentThread", test_currentThread),
("test_threadStart", test_threadStart),
("test_mainThread", test_mainThread),
("test_callStackSymbols", testExpectedToFailOnAndroid(test_callStackSymbols, "Android doesn't support backtraces at the moment.")),
("test_callStackReturnAddresses", testExpectedToFailOnAndroid(test_callStackReturnAddresses, "Android doesn't support backtraces at the moment.")),
]

#if !os(Android)
// Android doesn't support backtraces at the moment.
tests.append(contentsOf: [
("test_callStackSymbols", test_callStackSymbols),
("test_callStackReturnAddresses", test_callStackReturnAddresses),
])
#endif

#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
tests.append(contentsOf: [
("test_threadName", test_threadName),
Expand Down
4 changes: 0 additions & 4 deletions TestFoundation/TestURLSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,6 @@ class TestURLSession : LoopbackServerTest {

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

func test_verifyRequestHeaders() {
Expand Down
12 changes: 12 additions & 0 deletions TestFoundation/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,14 @@ func shouldAttemptWindowsXFailTests(_ reason: String) -> Bool {
#endif
}

func shouldAttemptAndroidXFailTests(_ reason: String) -> Bool {
#if os(Android)
return shouldAttemptXFailTests(reason)
#else
return true
#endif
}

func appendTestCaseExpectedToFail<T: XCTestCase>(_ reason: String, _ allTests: [(String, (T) -> () throws -> Void)], into array: inout [XCTestCaseEntry]) {
if shouldAttemptXFailTests(reason) {
array.append(testCase(allTests))
Expand All @@ -548,6 +556,10 @@ func testExpectedToFailOnWindows<T>(_ test: @escaping (T) -> () throws -> Void,
testExpectedToFailWithCheck(check: shouldAttemptWindowsXFailTests(_:), test, reason)
}

func testExpectedToFailOnAndroid<T>(_ test: @escaping (T) -> () throws -> Void, _ reason: String) -> (T) -> () throws -> Void {
testExpectedToFailWithCheck(check: shouldAttemptAndroidXFailTests(_:), test, reason)
}

func testExpectedToFailWithCheck<T>(check: (String) -> Bool, _ test: @escaping (T) -> () throws -> Void, _ reason: String) -> (T) -> () throws -> Void {
if check(reason) {
return test
Expand Down