@@ -41,6 +41,8 @@ def check_call(cmd: List[str], additional_env: Dict[str, str] = {}, verbose: boo
41
41
if verbose :
42
42
print_cmd (cmd = cmd , additional_env = additional_env )
43
43
44
+ sys .stdout .flush ()
45
+ sys .stderr .flush ()
44
46
subprocess .check_call (cmd , env = env_with_additional_env (additional_env ), stderr = subprocess .STDOUT )
45
47
46
48
@@ -51,6 +53,8 @@ def check_output(cmd: List[str], additional_env: Dict[str, str] = {}, capture_st
51
53
stderr = subprocess .STDOUT
52
54
else :
53
55
stderr = subprocess .DEVNULL
56
+ sys .stdout .flush ()
57
+ sys .stderr .flush ()
54
58
return subprocess .check_output (cmd , env = env_with_additional_env (additional_env ), stderr = stderr , encoding = 'utf-8' )
55
59
56
60
# -----------------------------------------------------------------------------
@@ -150,8 +154,14 @@ def run_tests(swift_exec: str, args: argparse.Namespace) -> None:
150
154
print ('Cleaning ' + tests )
151
155
shutil .rmtree (tests , ignore_errors = True )
152
156
153
- cmd = [swift_exec , 'test' , '--parallel' , '--test-product' , 'IndexStoreDBPackageTests' ] + swiftpm_args
154
- check_call (cmd , additional_env = additional_env , verbose = args .verbose )
157
+ cmd = [swift_exec , 'test' , '--test-product' , 'IndexStoreDBPackageTests' ] + swiftpm_args
158
+ try :
159
+ check_call (cmd + ['--parallel' ], additional_env = additional_env , verbose = args .verbose )
160
+ except :
161
+ print ('--- Running tests in parallel failed. Re-running tests serially to capture more actionable output.' )
162
+ check_call (cmd , additional_env = additional_env , verbose = args .verbose )
163
+ # Return with non-zero exit code even if serial test execution succeeds.
164
+ raise SystemExit (1 )
155
165
156
166
157
167
def handle_invocation (swift_exec : str , args : argparse .Namespace ) -> None :
0 commit comments