Skip to content

Commit 8a5723d

Browse files
authored
Merge pull request #36 from apple/build-benchmarks-with-swiftpm
Add integration test for building Swift benchmarks with SwiftPM
2 parents a846306 + ab70fea commit 8a5723d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Test that we can build the Swift benchmarks using SwiftPM.
2+
//
3+
// REQUIRES: have-swift-benchmarks
4+
//
5+
// RUN: rm -rf %t.dir
6+
// RUN: mkdir -p %t.dir/
7+
//
8+
// RUN: %{swift} build --package-path %{swift_benchmarks_path} --build-path %t.dir 2>&1 | tee %t.build-log
9+
//
10+
// Check the build log.
11+
//
12+
// RUN: %{FileCheck} --check-prefix CHECK-BUILD-LOG --input-file %t.build-log %s
13+
//
14+
// CHECK-BUILD-LOG: Linking{{.*}} {{.*}}SwiftBench
15+
//
16+
// RUN: %t.dir/debug/SwiftBench --num-iters=1 XorLoop

lit.cfg

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ if swiftpm_srcdir is None:
152152
if os.path.exists(swiftpm_srcdir):
153153
config.available_features.add("have-swiftpm")
154154
config.substitutions.append( ('%{swiftpm_srcdir}', swiftpm_srcdir) )
155+
156+
# Use the default Swift src layout if Swift the benchmark suite path is not
157+
# provided as a param.
158+
swift_benchmarks_path = lit_config.params.get("swift-benchmarks-path")
159+
if swift_benchmarks_path is None:
160+
swift_benchmarks_path = os.path.abspath(os.path.join(srcroot, "..", "swift", "benchmark"))
161+
162+
if os.path.exists(swift_benchmarks_path):
163+
config.available_features.add("have-swift-benchmarks")
164+
config.substitutions.append( ('%{swift_benchmarks_path}', swift_benchmarks_path) )
155165

156166
# Find the tools we need.
157167

0 commit comments

Comments
 (0)