Skip to content

Commit 08a96db

Browse files
committed
Re-run tests serially if parallel testing failed
Use the same approach that we’ve taken in SourceKit-LSP to capture more actionable output.
1 parent fbbde36 commit 08a96db

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Utilities/build-script-helper.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,15 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
150150
print('Cleaning ' + tests)
151151
shutil.rmtree(tests, ignore_errors=True)
152152

153-
cmd = [swift_exec, 'test', '--parallel', '--test-product', 'IndexStoreDBPackageTests'] + swiftpm_args
154-
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
153+
cmd = [swift_exec, 'test', '--test-product', 'IndexStoreDBPackageTests'] + swiftpm_args
154+
try:
155+
check_call(cmd + ['--parallel'], additional_env=additional_env, verbose=args.verbose)
156+
except:
157+
print('--- Running tests in parallel failed. Re-running tests serially to capture more actionable output.')
158+
sys.stdout.flush()
159+
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
160+
# Return with non-zero exit code even if serial test execution succeeds.
161+
raise SystemExit(1)
155162

156163

157164
def handle_invocation(swift_exec: str, args: argparse.Namespace) -> None:

0 commit comments

Comments
 (0)