Skip to content

Commit 52a0043

Browse files
authored
Merge pull request swiftlang#9025 from norio-nomura/enable-sourcekit-test-on-linux
Enable SourceKit tests if building SourceKit other than ubuntu 14.04
2 parents c3a0ad2 + 459c18d commit 52a0043

19 files changed

+117
-32
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ endif()
381381
option(SWIFT_BUILD_SOURCEKIT
382382
"Build SourceKit"
383383
${SWIFT_BUILD_SOURCEKIT_default})
384+
option(SWIFT_ENABLE_SOURCEKIT_TESTS
385+
"Enable running SourceKit tests"
386+
${SWIFT_BUILD_SOURCEKIT_default})
384387

385388
#
386389
# Assume a new enough ar to generate the index at construction time. This avoids

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ normalize_boolean_spelling(LLVM_ENABLE_ASSERTIONS)
128128
normalize_boolean_spelling(SWIFT_STDLIB_ASSERTIONS)
129129
normalize_boolean_spelling(SWIFT_AST_VERIFIER)
130130
normalize_boolean_spelling(SWIFT_ASAN_BUILD)
131+
normalize_boolean_spelling(SWIFT_ENABLE_SOURCEKIT_TESTS)
131132
is_build_type_optimized("${SWIFT_STDLIB_BUILD_TYPE}" SWIFT_OPTIMIZED)
132133

133134
set(profdata_merge_worker

test/SourceKit/CodeComplete/complete_moduleimportdepth.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ func test() {
66
}
77

88
// XFAIL: broken_std_regex
9+
// REQUIRES: objc_interop
910
// RUN: %complete-test -hide-none -group=none -tok=A %s -raw -- -I %S/Inputs -F %S/../Inputs/libIDE-mock-sdk > %t
1011
// RUN: %FileCheck %s < %t
1112

test/SourceKit/CodeComplete/complete_sort_order.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ func test() {
77

88
}
99

10-
// XFAIL: broken_std_regex
10+
// XFAIL: broken_std_regex, linux
1111
// RUN: %sourcekitd-test -req=complete -req-opts=hidelowpriority=0 -pos=7:1 %s -- %s > %t.orig
1212
// RUN: %FileCheck -check-prefix=NAME %s < %t.orig
1313
// Make sure the order is as below, foo(Int) should come before foo(String).

test/SourceKit/CursorInfo/cursor_info.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ struct HasLocalizationKey {}
214214
/// - LocalizationKey: ABC
215215
func hasLocalizationKey2() {}
216216

217+
// REQUIRES: objc_interop
217218
// RUN: rm -rf %t.tmp
218219
// RUN: mkdir -p %t.tmp
219220
// RUN: %swiftc_driver -emit-module -o %t.tmp/FooSwiftModule.swiftmodule %S/Inputs/FooSwiftModule.swift

test/SourceKit/CursorInfo/cursor_stdlib.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func foo2(_ a : inout [S1]) {
2121
import Swift
2222
func foo3(a: Float, b: Bool) {}
2323

24+
// REQUIRES: objc_interop
2425
// RUN: %sourcekitd-test -req=cursor -pos=3:18 %s -- %s %mcp_opt %clang-importer-sdk | %FileCheck -check-prefix=CHECK-OVERLAY %s
2526
// CHECK-OVERLAY: source.lang.swift.ref.var.global
2627
// CHECK-OVERLAY-NEXT: NSUTF8StringEncoding

test/SourceKit/CursorInfo/cursor_usr.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct S1 {}
88

99
func foo(x: FooStruct1) -> S1 {}
1010

11+
// REQUIRES: objc_interop
1112
// RUN: rm -rf %t
1213
// RUN: mkdir -p %t
1314
// RUN: %swiftc_driver -emit-module -o %t/FooSwiftModule.swiftmodule %S/Inputs/FooSwiftModule.swift

test/SourceKit/DocumentStructure/structure.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@
66

77
// RUN: %sourcekitd-test -req=structure %S/../Inputs/placeholders.swift | %sed_clean > %t.placeholders.response
88
// RUN: diff -u %s.placeholders.response %t.placeholders.response
9-

test/SourceKit/Indexing/index_is_test_candidate.swift.response

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{
3737
key.kind: source.lang.swift.decl.class,
3838
key.name: "XCTestCase",
39-
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
39+
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
4040
key.line: 15,
4141
key.column: 7
4242
},
@@ -50,7 +50,7 @@
5050
{
5151
key.kind: source.lang.swift.ref.class,
5252
key.name: "XCTestCase",
53-
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
53+
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
5454
key.line: 16,
5555
key.column: 32
5656
}
@@ -59,7 +59,7 @@
5959
{
6060
key.kind: source.lang.swift.ref.class,
6161
key.name: "XCTestCase",
62-
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
62+
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
6363
key.line: 16,
6464
key.column: 32
6565
},
@@ -68,9 +68,11 @@
6868
key.name: "test_startsWithTest_takesNoParams_returnsVoid_butIsPrivate()",
6969
key.usr: "s:23index_is_test_candidate14MyPrivateClass33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLC0c47_startsWithTest_takesNoParams_returnsVoid_butIsF0yyF",
7070
key.line: 17,
71-
key.column: 8
71+
key.column: 8,
72+
key.is_dynamic: 1
7273
}
73-
]
74+
],
75+
key.is_test_candidate: 1
7476
},
7577
{
7678
key.kind: source.lang.swift.decl.class,
@@ -82,7 +84,7 @@
8284
{
8385
key.kind: source.lang.swift.ref.class,
8486
key.name: "XCTestCase",
85-
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
87+
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
8688
key.line: 20,
8789
key.column: 24
8890
}
@@ -91,7 +93,7 @@
9193
{
9294
key.kind: source.lang.swift.ref.class,
9395
key.name: "XCTestCase",
94-
key.usr: "s:C28index_is_test_candidate_objc10XCTestCase",
96+
key.usr: "s:23index_is_test_candidate10XCTestCaseC",
9597
key.line: 20,
9698
key.column: 24
9799
},
@@ -100,14 +102,16 @@
100102
key.name: "doesNotStartWithTest()",
101103
key.usr: "s:23index_is_test_candidate7MyClassC20doesNotStartWithTestyyF",
102104
key.line: 21,
103-
key.column: 8
105+
key.column: 8,
106+
key.is_dynamic: 1
104107
},
105108
{
106109
key.kind: source.lang.swift.decl.function.method.instance,
107110
key.name: "test_startsWithTest_butTakesAParam(param:)",
108111
key.usr: "s:23index_is_test_candidate7MyClassC0C30_startsWithTest_butTakesAParamySi5param_tF",
109112
key.line: 22,
110113
key.column: 8,
114+
key.is_dynamic: 1,
111115
key.entities: [
112116
{
113117
key.kind: source.lang.swift.ref.struct,
@@ -124,6 +128,7 @@
124128
key.usr: "s:23index_is_test_candidate7MyClassC0C50_startsWithTest_andTakesNoParams_butReturnsNonVoidSiyF",
125129
key.line: 23,
126130
key.column: 8,
131+
key.is_dynamic: 1,
127132
key.entities: [
128133
{
129134
key.kind: source.lang.swift.ref.struct,
@@ -139,14 +144,16 @@
139144
key.name: "test_startsWithTest_takesNoParams_andReturnsVoid_butIsPrivate()",
140145
key.usr: "s:23index_is_test_candidate7MyClassC0C57_startsWithTest_takesNoParams_andReturnsVoid_butIsPrivate33_E06F4E7BC5F577AB6E2EC6D3ECA1C8B9LLyyF",
141146
key.line: 24,
142-
key.column: 16
147+
key.column: 16,
148+
key.is_dynamic: 1
143149
},
144150
{
145151
key.kind: source.lang.swift.decl.function.method.instance,
146152
key.name: "test_startsWithTest_takesNoParams_returnsVoid()",
147153
key.usr: "s:23index_is_test_candidate7MyClassC0C41_startsWithTest_takesNoParams_returnsVoidyyF",
148154
key.line: 25,
149155
key.column: 8,
156+
key.is_dynamic: 1,
150157
key.is_test_candidate: 1
151158
},
152159
{
@@ -155,9 +162,11 @@
155162
key.usr: "s:23index_is_test_candidate7MyClassC0C51_startsWithTest_takesNoParams_returnsVoid_andThrowsyyKF",
156163
key.line: 26,
157164
key.column: 8,
165+
key.is_dynamic: 1,
158166
key.is_test_candidate: 1
159167
}
160-
]
168+
],
169+
key.is_test_candidate: 1
161170
}
162171
]
163172
}

test/SourceKit/lit.local.cfg

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
if 'OS=macosx' not in config.available_features:
1+
if 'sourcekit' not in config.available_features:
2+
config.unsupported = True
3+
4+
elif 'OS=linux-gnu' in config.available_features and 'LinuxDistribution=Ubuntu-14.04' in config.available_features:
25
config.unsupported = True
36

47
else:

0 commit comments

Comments
 (0)