File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -225,17 +225,28 @@ static int runOneTest(const char *Argv0) {
225
225
Subprocesses.push_back (SP);
226
226
}
227
227
228
- if (Conf.Settings & CheckTermination) {
229
- for_each (Subprocesses, [](auto &P) {
230
- // Wait 1 second and killed the process.
231
- auto WP = sys::Wait (P, 1 );
232
- if (WP.ReturnCode && Verbose)
228
+ std::optional<unsigned > Timeout;
229
+ // Wait 1 second and killed the process if CheckTermination.
230
+ if (Conf.Settings & CheckTermination)
231
+ Timeout = 1 ;
232
+
233
+ auto HasError = any_of (Subprocesses, [&](auto &P) {
234
+ auto WP = sys::Wait (P, Timeout);
235
+ if (WP.ReturnCode == 0 )
236
+ return false ;
237
+ if ((Conf.Settings & CheckTermination) && WP.ReturnCode == -2 ) {
238
+ if (Verbose)
233
239
llvm::errs () << " subprocess killed successfully\n " ;
234
- });
235
- } else {
236
- for_each (Subprocesses, [](auto &P) { sys::Wait (P, std::nullopt); });
240
+ return false ;
241
+ }
242
+ llvm::errs () << " subprocess failed with error code (" << WP.ReturnCode
243
+ << " )\n " ;
244
+ return true ;
245
+ });
246
+ if (HasError) {
247
+ llvm::errs () << " end of stress test due to an error in subprocess\n " ;
248
+ return 1 ;
237
249
}
238
-
239
250
} else {
240
251
// in-process fill data.
241
252
fillData (CAS, AC, Conf);
You can’t perform that action at this time.
0 commit comments