]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
runner: reinit output dir for each run
authorVictor Julien <victor@inliniac.net>
Wed, 17 Jan 2018 08:57:59 +0000 (09:57 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 17 Jan 2018 10:18:16 +0000 (11:18 +0100)
Otherwise counting filters fail due to the default behaviour of
Suricata to 'append' to existing files.

run.py

diff --git a/run.py b/run.py
index 1addce7f6ad073a9aa4fbec507bc5fb911183eb5..088e3c296e5f396840b727ab66baf911a7d4c91b 100755 (executable)
--- a/run.py
+++ b/run.py
@@ -295,13 +295,7 @@ class TestRunner:
         sys.stdout.write("===> %s: " % os.path.basename(self.directory))
         sys.stdout.flush()
 
-        # Cleanup the output directory.
-        if os.path.exists(self.output):
-            shutil.rmtree(self.output)
-        os.makedirs(self.output)
-
         self.check_requires()
-        self.setup()
 
         shell = False
 
@@ -319,9 +313,6 @@ class TestRunner:
             "ASAN_OPTIONS": "detect_leaks=0",
         }
 
-        stdout = open(os.path.join(self.output, "stdout"), "w")
-        stderr = open(os.path.join(self.output, "stderr"), "w")
-
         if "count" in self.config:
             count = self.config["count"]
         else:
@@ -329,6 +320,15 @@ class TestRunner:
 
         for _ in range(count):
 
+            # Cleanup the output directory.
+            if os.path.exists(self.output):
+                shutil.rmtree(self.output)
+            os.makedirs(self.output)
+            self.setup()
+
+            stdout = open(os.path.join(self.output, "stdout"), "w")
+            stderr = open(os.path.join(self.output, "stderr"), "w")
+
             open(os.path.join(self.output, "cmdline"), "w").write(
                 " ".join(args))