From: Jason Ish Date: Thu, 4 Aug 2022 15:51:59 +0000 (-0600) Subject: runner: error out on errors from the runner X-Git-Tag: suricata-6.0.8~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f0c7948c62277610e0cf856d473dcb4ed35971b;p=thirdparty%2Fsuricata-verify.git runner: error out on errors from the runner Currently exceptions from tests that are not explicitly handled are lost due to the way Python's multiprocessing module works. This means that programming errors in the runner are silently ignore with the test not being run or counted. Instead, log the traceback for any unexpected exception and terminate the runner, as this is programming error in the runner and should always be fatal. --- diff --git a/run.py b/run.py index 2126b03fb..2a039b1bf 100755 --- a/run.py +++ b/run.py @@ -43,6 +43,7 @@ import threading import filecmp import subprocess import yaml +import traceback VALIDATE_EVE = False WIN32 = sys.platform == "win32" @@ -896,6 +897,15 @@ def run_test(dirpath, args, cwd, suricata_config): check_args_fail() with lock: count_dict["failed"] += 1 + except Exception as err: + print("===> {}: FAILED: Unexpected exception: {}".format(os.path.basename(dirpath), err)) + traceback.print_exc() + + # Always terminate the runner on this type of error, as its an error in the framework. + with lock: + check_args['fail'] = 1 + count_dict["failed"] += 1 + raise TerminatePoolError() def run_mp(jobs, tests, dirpath, args, cwd, suricata_config): print("Number of concurrent jobs: %d" % jobs)