From 161cd9e6da4284ae680d0743216e62cee9a308d6 Mon Sep 17 00:00:00 2001 From: Christopher Haster Date: Sat, 16 Dec 2023 14:57:13 -0600 Subject: [PATCH] Fixed race condition killing test processes in test/bench.py Note sure why we weren't hitting this earlier, but I've been hitting this race condition a bunch recently and it's annoying. Now every failed process kills the other test processes unconditionally. It's not clear if this actually _fixes_ the race condition or just makes it less likely, but it's good enough to keep the test script user friendly. --- scripts/bench.py | 17 ++++++++--------- scripts/test.py | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/scripts/bench.py b/scripts/bench.py index 68a12a64..39733013 100755 --- a/scripts/bench.py +++ b/scripts/bench.py @@ -1134,16 +1134,15 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args): except BenchFailure as failure: # race condition for multiple failures? - if failures and not args.get('keep_going'): - break + if not failures or args.get('keep_going'): + # keep track of how many failed + failed_perms += 1 - # keep track of how many failed - failed_perms += 1 - - # do not store more failures than we need to, otherwise we - # quickly explode RAM when a common bug fails a bunch of cases - if len(failures) < args.get('failures', 3): - failures.append(failure) + # do not store more failures than we need to, otherwise + # we quickly explode RAM when a common bug fails a bunch + # of cases + if len(failures) < args.get('failures', 3): + failures.append(failure) if args.get('keep_going') and not killed: # resume after failed bench diff --git a/scripts/test.py b/scripts/test.py index 4a610eff..5167ee5a 100755 --- a/scripts/test.py +++ b/scripts/test.py @@ -1113,16 +1113,15 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args): **defines}) # race condition for multiple failures? - if failures and not args.get('keep_going'): - break + if not failures or args.get('keep_going'): + # keep track of how many failed + failed_perms += 1 - # keep track of how many failed - failed_perms += 1 - - # do not store more failures than we need to, otherwise we - # quickly explode RAM when a common bug fails a bunch of cases - if len(failures) < args.get('failures', 3): - failures.append(failure) + # do not store more failures than we need to, otherwise + # we quickly explode RAM when a common bug fails a bunch + # of cases + if len(failures) < args.get('failures', 3): + failures.append(failure) if args.get('keep_going') and not killed: # resume after failed test