Skip to content

[build] ensure benchmark toolchain tests use the just built libraries #38158

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1305,9 +1305,6 @@ mixin-preset=
# SKIP LLDB TESTS (67923799)
skip-test-lldb

# SKIP testing benchmarks (79788142)
skip-test-toolchain-benchmarks

[preset: buildbot_osx_package,use_os_runtime]
mixin-preset=
buildbot_osx_package
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,31 @@ def build(self, host_target):
def should_test(self, host_target):
return self.args.test_toolchainbenchmarks

def _get_test_environment(self, host_target):
if platform.system() == 'Darwin':
# the resulting binaries would search first in /usr/lib/swift,
# we need to prefer the libraries we just built
return {'DYLD_LIBRARY_PATH': os.path.join(
_get_toolchain_path(host_target, self, self.args),
'usr', 'lib', 'swift', 'macosx')}

return None

def test(self, host_target):
"""Just run a single instance of the command for both .debug and
.release.
"""
cmdline = ['--num-iters=1', 'XorLoop']
test_environment = self._get_test_environment(host_target)

bench_Onone = os.path.join(self.build_dir, 'bin', 'Benchmark_Onone')
shell.call([bench_Onone] + cmdline)
shell.call([bench_Onone] + cmdline, env=test_environment)

bench_O = os.path.join(self.build_dir, 'bin', 'Benchmark_O')
shell.call([bench_O] + cmdline)
shell.call([bench_O] + cmdline, env=test_environment)

bench_Osize = os.path.join(self.build_dir, 'bin', 'Benchmark_Osize')
shell.call([bench_Osize] + cmdline)
shell.call([bench_Osize] + cmdline, env=test_environment)

def should_install(self, host_target):
return False
Expand All @@ -85,7 +97,11 @@ def get_dependencies(cls):
swiftpm.SwiftPM]


def run_build_script_helper(host_target, product, args):
def _get_toolchain_path(host_target, product, args):
# TODO check if we should prefer using product.install_toolchain_path
# this logic initially was inside run_build_script_helper
# and was factored out so it can be used in testing as well

toolchain_path = swiftpm.SwiftPM.get_install_destdir(args,
host_target,
product.build_dir)
Expand All @@ -94,6 +110,12 @@ def run_build_script_helper(host_target, product, args):
toolchain_path += \
targets.darwin_toolchain_prefix(args.install_prefix)

return toolchain_path


def run_build_script_helper(host_target, product, args):
toolchain_path = _get_toolchain_path(host_target, product, args)

# Our source_dir is expected to be './$SOURCE_ROOT/benchmarks'. That is due
# the assumption that each product is in its own build directory. This
# product is not like that and has its package/tools instead in
Expand Down