Skip to content

Commit 4f3bdf9

Browse files
authored
Merge pull request #991 from ahoppen/ahoppen/parallel-tests-unless-failure
Execute sourcekit-lsp tests in parallel and re-run them serially only if a test fails
2 parents c71ab1a + 313e46e commit 4f3bdf9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Utilities/build-script-helper.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,15 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
226226
'--disable-testable-imports',
227227
'--test-product', 'SourceKitLSPPackageTests'
228228
] + swiftpm_args
229-
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
229+
230+
# Try running tests in parallel. If that fails, run tests in serial to get capture more readable output.
231+
try:
232+
check_call(cmd + ['--parallel'], additional_env=additional_env, verbose=args.verbose)
233+
except:
234+
print('--- Running tests in parallel failed. Re-running tests serially to capture more actionable output.')
235+
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
236+
# Return with non-zero exit code even if serial test execution succeeds.
237+
raise SystemExit(1)
230238

231239

232240
def install_binary(exe: str, source_dir: str, install_dir: str, verbose: bool) -> None:

0 commit comments

Comments
 (0)