From: Jason Ish Date: Tue, 16 Jan 2018 01:19:24 +0000 (-0600) Subject: runner: add setup X-Git-Tag: suricata-6.0.4~538 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1c0379c69ba639b594f2e8c17d151d2e500b397c;p=thirdparty%2Fsuricata-verify.git runner: add setup A test.yaml can now have a setup section that is run before Suricata is executed. --- diff --git a/run.py b/run.py index cc345c785..b46a415bc 100755 --- a/run.py +++ b/run.py @@ -266,6 +266,16 @@ class TestRunner: # List of thread readers. self.readers = [] + def setup(self, config): + if "setup" in config: + for setup in config["setup"]: + for command in setup: + if command == "script": + subprocess.check_call( + "%s" % setup[command], + shell=True, + cwd=self.directory) + def run(self): sys.stdout.write("===> %s: " % os.path.basename(self.directory)) @@ -278,7 +288,13 @@ class TestRunner: else: test_config = TestConfig({}, self.suricata_config) + # Cleanup the output directory. + if os.path.exists(self.output): + shutil.rmtree(self.output) + os.makedirs(self.output) + test_config.check_requires() + self.setup(test_config.config) shell = False @@ -296,11 +312,6 @@ class TestRunner: "ASAN_OPTIONS": "detect_leaks=0", } - # Cleanup the output directory. - if os.path.exists(self.output): - shutil.rmtree(self.output) - os.makedirs(self.output) - stdout = open(os.path.join(self.output, "stdout"), "w") stderr = open(os.path.join(self.output, "stderr"), "w")