Skip to content

Flush stdout after issuing message that we re-run tests in serial #1376

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
merged 1 commit into from
May 31, 2024
Merged
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
7 changes: 4 additions & 3 deletions Utilities/build-script-helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
"""
swiftpm_args = get_swiftpm_options(swift_exec, args, suppress_verbose=True)
additional_env = get_swiftpm_environment_variables(swift_exec, args)
# 'swift test' doesn't print os_log output to the command line. Use the
# `NonDarwinLogger` that prints to stderr so we can view the log output in CI test
# 'swift test' doesn't print os_log output to the command line. Use the
# `NonDarwinLogger` that prints to stderr so we can view the log output in CI test
# runs.
additional_env['SOURCEKITLSP_FORCE_NON_DARWIN_LOGGER'] = '1'

Expand All @@ -233,6 +233,7 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
check_call(cmd + ['--parallel'], additional_env=additional_env, verbose=args.verbose)
except:
print('--- Running tests in parallel failed. Re-running tests serially to capture more actionable output.')
sys.stdout.flush()
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
# Return with non-zero exit code even if serial test execution succeeds.
raise SystemExit(1)
Expand All @@ -249,7 +250,7 @@ def install(swift_exec: str, args: argparse.Namespace) -> None:
swiftpm_args = get_swiftpm_options(swift_exec, args)
additional_env = get_swiftpm_environment_variables(swift_exec, args)
bin_path = swiftpm_bin_path(swift_exec, swiftpm_args=swiftpm_args, additional_env=additional_env)

for prefix in args.install_prefixes:
install_binary('sourcekit-lsp', bin_path, os.path.join(prefix, 'bin'), verbose=args.verbose)

Expand Down