From 781a4902a50e65f8bc7309e7375b6828b52719e3 Mon Sep 17 00:00:00 2001 From: Nathan Hawes Date: Thu, 8 Nov 2018 13:02:52 -0800 Subject: [PATCH] Add substitutions and a test for the SourceKit stress tester executables --- lit.cfg | 13 +++++++++++++ sk-stress-test.txt | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 sk-stress-test.txt diff --git a/lit.cfg b/lit.cfg index 2cd1360..4811981 100644 --- a/lit.cfg +++ b/lit.cfg @@ -232,3 +232,16 @@ else: for name in ('swift-build', 'FileCheck', 'readelf'): config.substitutions.append((' {0} '.format(name), ' unquoted-command-name-{0} '.format(name))) + +# Add substitutions for SourceKit stress tester executables +sk_stress_test_path = lit_config.params.get( + "sk-stress-test", + os.path.join(package_path, "usr", "bin", "sk-stress-test")) +sk_swiftc_wrapper_path = lit_config.params.get( + "sk-swiftc-wrapper", + os.path.join(package_path, "usr", "bin", "sk-swiftc-wrapper")) + +lit_config.note("testing using 'sk-stress-test': {}".format(sk_stress_test_path)) +lit_config.note("testing using 'sk-swiftc-wrapper': {}".format(sk_swiftc_wrapper_path)) +config.substitutions.append( ('%{sk-stress-test}', sk_stress_test_path) ) +config.substitutions.append( ('%{sk-swiftc-wrapper}', sk_swiftc_wrapper_path) ) diff --git a/sk-stress-test.txt b/sk-stress-test.txt new file mode 100644 index 0000000..db62a10 --- /dev/null +++ b/sk-stress-test.txt @@ -0,0 +1,20 @@ +// Trivial test for the SourceKit stress tester and compiler wrapper. +// +// REQUIRES: platform=Darwin +// +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir +// RUN: cp %s %t.dir/test.swift +// +// 1) Make sure both exit successfully running over a valid file +// RUN: %{sk-stress-test} %t.dir/test.swift swiftc %t.dir/test.swift +// RUN: %{sk-swiftc-wrapper} %t.dir/test.swift +// +// 2) Make sure the wrapper fails when the underlying compilation fails +// RUN: echo " undefined_symbol " >> %t.dir/test.swift +// RUN: %{not} %{sk-swiftc-wrapper} %t.dir/test.swift +// + +func foo() { + print("hello") +} \ No newline at end of file