]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test.yaml: allow expected exit code to be set
authorJason Ish <ish@unx.ca>
Thu, 18 Jan 2018 15:23:18 +0000 (09:23 -0600)
committerJason Ish <ish@unx.ca>
Thu, 18 Jan 2018 15:23:18 +0000 (09:23 -0600)
run.py

diff --git a/run.py b/run.py
index 90ad96ea6802ea9103aa5930478e765bacfd9871..6b75897a5387b7d990a145a75b8af784e7b9b397 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -320,6 +320,11 @@ class TestRunner:
         else:
             count = 1
 
+        if "exit-code" in self.config:
+            expected_exit_code = self.config["exit-code"]
+        else:
+            expected_exit_code = 0
+
         for _ in range(count):
 
             # Cleanup the output directory.
@@ -346,9 +351,9 @@ class TestRunner:
 
             r = p.wait()
 
-            if r != 0:
-                print("FAIL: process returned with non-0 exit code: %d" % r)
-                return False
+            if r != expected_exit_code:
+                raise TestError("got exit code %d, expected %d" % (
+                    r, expected_exit_code));
 
             if not self.check():
                 return False