Skip to content

Commit 4f4ab62

Browse files
lgachespaulofaria
authored andcommitted
Fix failing compilation on Linux (#25)
* fix issue #6 compilation warnings * update travis ci scripts * missed _isDebugAssertConfiguration * add test to debugDescription * clean warning * silence warning * added missing test on Linux * fix failing code on linux
1 parent 2ed4f00 commit 4f4ab62

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

Sources/GraphQL/Instrumentation/Instrumentation.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation
12
import Dispatch
23

34
/// Provides the capability to instrument the execution steps of a GraphQL query.
@@ -62,7 +63,11 @@ extension Instrumentation {
6263
}
6364

6465
func threadId() -> Int {
65-
return Int(pthread_mach_thread_np(pthread_self()))
66+
#if os(Linux)
67+
return Int(pthread_self())
68+
#else
69+
return Int(pthread_mach_thread_np(pthread_self()))
70+
#endif
6671
}
6772

6873
func processId() -> Int {

Tests/GraphQLTests/InstrumentationTests/InstrumentationTests.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Foundation
12
import Dispatch
23
import GraphQL
34
import XCTest
@@ -105,7 +106,11 @@ class InstrumentationTests : XCTestCase, Instrumentation {
105106
}
106107

107108
func testInstrumentationCalls() throws {
109+
#if os(Linux)
110+
expectedThreadId = Int(pthread_self())
111+
#else
108112
expectedThreadId = Int(pthread_mach_thread_np(pthread_self()))
113+
#endif
109114
expectedProcessId = Int(getpid())
110115
let result = try graphql(
111116
instrumentation: self,
@@ -125,7 +130,11 @@ class InstrumentationTests : XCTestCase, Instrumentation {
125130

126131
func testDispatchQueueInstrumentationWrapper() throws {
127132
let dispatchGroup = DispatchGroup()
133+
#if os(Linux)
134+
expectedThreadId = Int(pthread_self())
135+
#else
128136
expectedThreadId = Int(pthread_mach_thread_np(pthread_self()))
137+
#endif
129138
expectedProcessId = Int(getpid())
130139
let result = try graphql(
131140
instrumentation: DispatchQueueInstrumentationWrapper(self, dispatchGroup: dispatchGroup),

Tests/GraphQLTests/LanguageTests/LexerTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,7 @@ extension LexerTests {
742742
("testRecordsLineAndColumn", testRecordsLineAndColumn),
743743
("testTokenDescription", testTokenDescription),
744744
("testSkipsWhitespace", testSkipsWhitespace),
745+
("testSkipsComments", testSkipsComments),
745746
("testSkipsCommas", testSkipsCommas),
746747
("testErrorsRespectWhitespaces", testErrorsRespectWhitespaces),
747748
("testStrings", testStrings),

Tests/GraphQLTests/LanguageTests/ParserTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ extension ParserTests {
334334
("testVariableInlineValues", testVariableInlineValues),
335335
("testKitchenSink", testKitchenSink),
336336
("testNonKeywordAsName", testNonKeywordAsName),
337+
("testAnonymousMutationOperation", testAnonymousMutationOperation),
338+
("testAnonymousSubscriptionOperation", testAnonymousSubscriptionOperation),
339+
("testNamedMutationOperation", testNamedMutationOperation),
340+
("testNamedSubscriptionOperation", testNamedSubscriptionOperation),
337341
("testCreateAST", testCreateAST),
338342
("testNoLocation", testNoLocation),
339343
("testLocationSource", testLocationSource),

Tests/GraphQLTests/StarWarsTests/StarWarsQueryTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,7 @@ extension StarWarsQueryTests {
559559
("testHeroNameAndFriendsQuery", testHeroNameAndFriendsQuery),
560560
("testNestedQuery", testNestedQuery),
561561
("testFetchLukeQuery", testFetchLukeQuery),
562+
("testOptionalVariable", testOptionalVariable),
562563
("testFetchSomeIDQuery", testFetchSomeIDQuery),
563564
("testFetchLukeAliasedQuery", testFetchLukeAliasedQuery),
564565
("testFetchLukeAndLeiaAliasedQuery", testFetchLukeAndLeiaAliasedQuery),
@@ -568,7 +569,8 @@ extension StarWarsQueryTests {
568569
("testCheckTypeOfLukeQuery", testCheckTypeOfLukeQuery),
569570
("testSecretBackstoryQuery", testSecretBackstoryQuery),
570571
("testSecretBackstoryListQuery", testSecretBackstoryListQuery),
571-
("testNonNullableFieldsQuery", testNonNullableFieldsQuery),
572+
("testSecretBackstoryAliasQuery",testSecretBackstoryAliasQuery),
573+
("testNonNullableFieldsQuery", testNonNullableFieldsQuery)
572574
]
573575
}
574576
}

0 commit comments

Comments
 (0)