From: Victor Julien Date: Wed, 17 Jan 2018 08:57:59 +0000 (+0100) Subject: runner: reinit output dir for each run X-Git-Tag: suricata-6.0.4~531 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b92073450d31fd837ace064f76597b178730f4be;p=thirdparty%2Fsuricata-verify.git runner: reinit output dir for each run Otherwise counting filters fail due to the default behaviour of Suricata to 'append' to existing files. --- diff --git a/run.py b/run.py index 1addce7f6..088e3c296 100755 --- 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))