Skip to content

Commit d3a2e71

Browse files
author
Nathan Hawes
authored
Merge pull request #42 from nathawes/add-stress-tester-tests
Add substitutions and a test for the SourceKit stress tester executables
2 parents d89c73c + 781a490 commit d3a2e71

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

lit.cfg

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,3 +232,16 @@ else:
232232
for name in ('swift-build', 'FileCheck', 'readelf'):
233233
config.substitutions.append((' {0} '.format(name),
234234
' unquoted-command-name-{0} '.format(name)))
235+
236+
# Add substitutions for SourceKit stress tester executables
237+
sk_stress_test_path = lit_config.params.get(
238+
"sk-stress-test",
239+
os.path.join(package_path, "usr", "bin", "sk-stress-test"))
240+
sk_swiftc_wrapper_path = lit_config.params.get(
241+
"sk-swiftc-wrapper",
242+
os.path.join(package_path, "usr", "bin", "sk-swiftc-wrapper"))
243+
244+
lit_config.note("testing using 'sk-stress-test': {}".format(sk_stress_test_path))
245+
lit_config.note("testing using 'sk-swiftc-wrapper': {}".format(sk_swiftc_wrapper_path))
246+
config.substitutions.append( ('%{sk-stress-test}', sk_stress_test_path) )
247+
config.substitutions.append( ('%{sk-swiftc-wrapper}', sk_swiftc_wrapper_path) )

sk-stress-test.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Trivial test for the SourceKit stress tester and compiler wrapper.
2+
//
3+
// REQUIRES: platform=Darwin
4+
//
5+
// RUN: rm -rf %t.dir
6+
// RUN: mkdir -p %t.dir
7+
// RUN: cp %s %t.dir/test.swift
8+
//
9+
// 1) Make sure both exit successfully running over a valid file
10+
// RUN: %{sk-stress-test} %t.dir/test.swift swiftc %t.dir/test.swift
11+
// RUN: %{sk-swiftc-wrapper} %t.dir/test.swift
12+
//
13+
// 2) Make sure the wrapper fails when the underlying compilation fails
14+
// RUN: echo " undefined_symbol " >> %t.dir/test.swift
15+
// RUN: %{not} %{sk-swiftc-wrapper} %t.dir/test.swift
16+
//
17+
18+
func foo() {
19+
print("hello")
20+
}

0 commit comments

Comments
 (0)