21
21
22
22
class TestThread : XCTestCase {
23
23
static var allTests : [ ( String , ( TestThread ) -> ( ) throws -> Void ) ] {
24
- #if os(Android)
25
- return [ ]
26
- #endif
27
-
28
24
var tests : [ ( String , ( TestThread ) -> ( ) throws -> Void ) ] = [
29
- ( " test_currentThread " , test_currentThread ) ,
25
+ ( " test_currentThread " , test_currentThread) ,
30
26
( " test_threadStart " , test_threadStart) ,
31
27
( " test_mainThread " , test_mainThread) ,
32
- ( " test_callStackSymbols " , test_callStackSymbols) ,
33
- ( " test_callStackReurnAddresses " , test_callStackReturnAddresses) ,
34
28
]
35
29
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
+
36
38
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
37
39
tests. append ( contentsOf: [
38
40
( " test_threadName " , test_threadName) ,
@@ -68,7 +70,7 @@ class TestThread : XCTestCase {
68
70
69
71
#if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
70
72
func test_threadName( ) {
71
- #if os(Linux) // Linux sets the initial thread name to the process name.
73
+ #if os(Linux) || os(Android) // Linux sets the initial thread name to the process name.
72
74
XCTAssertEqual ( Thread . current. name, " TestFoundation " )
73
75
XCTAssertEqual ( Thread . current. _name, " TestFoundation " )
74
76
#else
@@ -94,7 +96,7 @@ class TestThread : XCTestCase {
94
96
XCTAssertEqual ( Thread . current. name, " 12345678901234567890 " )
95
97
#if os(macOS) || os(iOS)
96
98
XCTAssertEqual ( Thread . current. _name, Thread . current. name)
97
- #elseif os(Linux)
99
+ #elseif os(Linux) || os(Android)
98
100
// pthread_setname_np() only allows 15 characters on Linux, so setting it fails
99
101
// and the previous name will still be there.
100
102
XCTAssertEqual ( Thread . current. _name, " Thread2-2 " )
0 commit comments