diff --git a/build-swift-benchmarks-with-swiftpm.txt b/build-swift-benchmarks-with-swiftpm.txt new file mode 100644 index 0000000..d8bad08 --- /dev/null +++ b/build-swift-benchmarks-with-swiftpm.txt @@ -0,0 +1,16 @@ +// Test that we can build the Swift benchmarks using SwiftPM. +// +// REQUIRES: have-swift-benchmarks +// +// RUN: rm -rf %t.dir +// RUN: mkdir -p %t.dir/ +// +// RUN: %{swift} build --package-path %{swift_benchmarks_path} --build-path %t.dir 2>&1 | tee %t.build-log +// +// Check the build log. +// +// RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s +// +// CHECK-BUILD-LOG: Linking{{.*}} {{.*}}SwiftBench +// +// RUN: %t.dir/debug/SwiftBench --num-iters=1 XorLoop diff --git a/lit.cfg b/lit.cfg index b996ed0..00927c6 100644 --- a/lit.cfg +++ b/lit.cfg @@ -152,6 +152,16 @@ if swiftpm_srcdir is None: if os.path.exists(swiftpm_srcdir): config.available_features.add("have-swiftpm") config.substitutions.append( ('%{swiftpm_srcdir}', swiftpm_srcdir) ) + +# Use the default Swift src layout if Swift the benchmark suite path is not +# provided as a param. +swift_benchmarks_path = lit_config.params.get("swift-benchmarks-path") +if swift_benchmarks_path is None: + swift_benchmarks_path = os.path.abspath(os.path.join(srcroot, "..", "swift", "benchmark")) + +if os.path.exists(swift_benchmarks_path): + config.available_features.add("have-swift-benchmarks") + config.substitutions.append( ('%{swift_benchmarks_path}', swift_benchmarks_path) ) # Find the tools we need.