]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
runner: add --valgrind opt
authorVictor Julien <victor@inliniac.net>
Sun, 21 Jan 2018 21:03:30 +0000 (22:03 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 22 Jan 2018 11:12:53 +0000 (12:12 +0100)
Runs the tests inside valgrind. Uses the default suppressions from
the Suricata git tree.

run.py

diff --git a/run.py b/run.py
index 9e55000093359347be78c6f0bd2f4610058718d5..227688689095bc52865fb945e339dea6e27e7884 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -425,7 +425,12 @@ class TestRunner:
             os.chdir(pdir)
 
     def default_args(self):
-        args = [
+        args = []
+        if self.suricata_config.valgrind:
+            suppression_opt = "--suppressions=%s" % os.path.join(self.cwd, "qa/valgrind.suppress")
+            args += [ "valgrind", "-v", "--error-exitcode=255", suppression_opt ]
+
+        args += [
             os.path.join(self.cwd, "src/suricata"),
         ]
 
@@ -512,6 +517,8 @@ def main():
                         help="Runs tests from custom directory")
     parser.add_argument("--outdir", action="store",
                         help="Outputs to custom directory")
+    parser.add_argument("--valgrind", dest="valgrind", action="store_true",
+                        help="Run tests in with valgrind")
     parser.add_argument("patterns", nargs="*", default=[])
     args = parser.parse_args()
 
@@ -532,6 +539,7 @@ def main():
 
     # Create a SuricataConfig object that is passed to all tests.
     suricata_config = SuricataConfig(get_suricata_version())
+    suricata_config.valgrind = args.valgrind
 
     tdir = os.path.join(TOPDIR, "tests")
     if args.testdir: