Skip to content

Commit f5c2e22

Browse files
committed
---
yaml --- r: 347509 b: refs/heads/master c: fde3510 h: refs/heads/master i: 347507: 00ac42e
1 parent e71e633 commit f5c2e22

File tree

4 files changed

+63
-50
lines changed

4 files changed

+63
-50
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9905db8c74689b5e60041f45919d2573fdaebfb2
2+
refs/heads/master: fde3510eeb0b58117b2ebfe3ed770845683ef8e7
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env python
2+
3+
from __future__ import print_function
4+
5+
import argparse
6+
import os
7+
import shutil
8+
import subprocess
9+
10+
11+
def perform_build(args, swiftbuild_path, config, binary_name, opt_flag):
12+
assert(config in ['debug', 'release'])
13+
assert(binary_name in ['Benchmark_O', 'Benchmark_Onone'])
14+
assert(opt_flag in ['-O', '-Onone'])
15+
16+
inner_build_dir = os.path.join(args.build_path, binary_name)
17+
swiftbuild_args = [
18+
swiftbuild_path,
19+
'--package-path', args.package_path,
20+
'--build-path', inner_build_dir,
21+
'--configuration', config,
22+
'-Xswiftc', '-Xllvm',
23+
'-Xswiftc', '-align-module-to-page-size',
24+
'-Xswiftc', opt_flag,
25+
]
26+
if args.verbose:
27+
swiftbuild_args.append('--verbose')
28+
subprocess.call(swiftbuild_args)
29+
30+
# Copy the benchmark file into the final ./bin directory.
31+
binpath = os.path.join(inner_build_dir, config, 'SwiftBench')
32+
finalpath = os.path.join(args.build_path, 'bin', binary_name)
33+
shutil.copy(binpath, finalpath)
34+
35+
36+
def main():
37+
parser = argparse.ArgumentParser()
38+
parser.add_argument('--verbose', '-v', action='store_true')
39+
parser.add_argument('--package-path', type=str, required=True)
40+
parser.add_argument('--build-path', type=str, required=True)
41+
parser.add_argument('--toolchain', type=str, required=True)
42+
43+
args = parser.parse_args()
44+
45+
# Create our bin directory so we can copy in the binaries.
46+
bin_dir = os.path.join(args.build_path, 'bin')
47+
if not os.path.isdir(bin_dir):
48+
os.makedirs(bin_dir)
49+
50+
swiftbuild_path = os.path.join(args.toolchain, 'usr', 'bin', 'swift-build')
51+
perform_build(args, swiftbuild_path, 'debug', 'Benchmark_Onone', '-Onone')
52+
perform_build(args, swiftbuild_path, 'release', 'Benchmark_O', '-O')
53+
54+
55+
if __name__ == "__main__":
56+
main()

trunk/benchmark/utils/build_script_helper.py

Lines changed: 0 additions & 44 deletions
This file was deleted.

trunk/utils/swift_build_support/swift_build_support/products/benchmarks.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def test(self, host_target):
3636
.release.
3737
"""
3838
cmdline = ['--num-iters=1', 'XorLoop']
39-
debug_bench = os.path.join(self.build_dir, 'debug', 'SwiftBench')
40-
shell.call([debug_bench] + cmdline)
39+
bench_Onone = os.path.join(self.build_dir, 'bin', 'Benchmark_Onone')
40+
shell.call([bench_Onone] + cmdline)
4141

42-
release_bench = os.path.join(self.build_dir, 'release', 'SwiftBench')
43-
shell.call([release_bench] + cmdline)
42+
bench_O = os.path.join(self.build_dir, 'bin', 'Benchmark_O')
43+
shell.call([bench_O] + cmdline)
4444

4545

4646
def run_build_script_helper(host_target, product, args):
@@ -59,7 +59,8 @@ def run_build_script_helper(host_target, product, args):
5959

6060
# We use a separate python helper to enable quicker iteration when working
6161
# on this by avoiding going through build-script to test small changes.
62-
helper_path = os.path.join(package_path, 'utils', 'build_script_helper.py')
62+
helper_path = os.path.join(package_path, 'scripts',
63+
'build_script_helper.py')
6364

6465
build_cmd = [
6566
helper_path,

0 commit comments

Comments
 (0)