From: Philippe Antoine Date: Thu, 15 Sep 2022 08:59:50 +0000 (+0200) Subject: framework: adds a timeout of 5 minutes per test X-Git-Tag: suricata-6.0.9~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d51b25e3732a00af79e6855f669ca38f8bc7aee5;p=thirdparty%2Fsuricata-verify.git framework: adds a timeout of 5 minutes per test --- diff --git a/run.py b/run.py index 523095bc0..af4ecc71d 100755 --- a/run.py +++ b/run.py @@ -51,6 +51,8 @@ LINUX = sys.platform.startswith("linux") suricata_bin = "src\suricata.exe" if WIN32 else "./src/suricata" suricata_yaml = "suricata.yaml" if WIN32 else "./suricata.yaml" +PROC_TIMEOUT=300 + if LINUX: manager = mp.Manager() lock = mp.Lock() @@ -678,11 +680,20 @@ class TestRunner: self.start_reader(p.stdout, stdout) self.start_reader(p.stderr, stderr) - for r in self.readers: - r.join() + try: + r.join(timeout=PROC_TIMEOUT) + except: + print("stdout/stderr reader timed out, terminating") + r.terminate() - r = p.wait() + try: + r = p.wait(timeout=PROC_TIMEOUT) + except: + print("Suricata timed out, terminating") + p.terminate() + raise TestError("timed out when expected exit code %d" % ( + expected_exit_code)); if r != expected_exit_code: raise TestError("got exit code %d, expected %d" % (