Skip to content

Commit c86c176

Browse files
committed
[benchmarks] Add support to the build-script swiftpm benchmarks for building the benchmarks in -Osize.
1 parent 6ea773e commit c86c176

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

benchmark/scripts/build_script_helper.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
def perform_build(args, swiftbuild_path, config, binary_name, opt_flag):
1212
assert(config in ['debug', 'release'])
13-
assert(binary_name in ['Benchmark_O', 'Benchmark_Onone'])
14-
assert(opt_flag in ['-O', '-Onone'])
13+
assert(binary_name in ['Benchmark_O', 'Benchmark_Osize',
14+
'Benchmark_Onone'])
15+
assert(opt_flag in ['-O', '-Osize', '-Onone'])
1516

1617
inner_build_dir = os.path.join(args.build_path, binary_name)
1718
swiftbuild_args = [
@@ -49,6 +50,8 @@ def main():
4950

5051
swiftbuild_path = os.path.join(args.toolchain, 'usr', 'bin', 'swift-build')
5152
perform_build(args, swiftbuild_path, 'debug', 'Benchmark_Onone', '-Onone')
53+
perform_build(args, swiftbuild_path, 'release', 'Benchmark_Osize',
54+
'-Osize')
5255
perform_build(args, swiftbuild_path, 'release', 'Benchmark_O', '-O')
5356

5457

utils/swift_build_support/swift_build_support/products/benchmarks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def test(self, host_target):
4242
bench_O = os.path.join(self.build_dir, 'bin', 'Benchmark_O')
4343
shell.call([bench_O] + cmdline)
4444

45+
bench_Osize = os.path.join(self.build_dir, 'bin', 'Benchmark_Osize')
46+
shell.call([bench_Osize] + cmdline)
47+
4548

4649
def run_build_script_helper(host_target, product, args):
4750
toolchain_path = args.install_destdir

0 commit comments

Comments
 (0)