From: Jason Ish Date: Tue, 1 Oct 2019 21:39:28 +0000 (-0600) Subject: run: handle moved classificaton/reference config X-Git-Tag: suricata-6.0.4~378 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5faed0cf84d12e8ba9b7c26f6daae54d8ae81a97;p=thirdparty%2Fsuricata-verify.git run: handle moved classificaton/reference config First look for these configuration files in ./etc, then in the top directory to handle the change of location in Suricata 5.0, as well as work with older versions. --- diff --git a/run.py b/run.py index 17721e431..111b4bc4d 100755 --- a/run.py +++ b/run.py @@ -683,12 +683,32 @@ class TestRunner: for arg in self.config["args"]: args += re.split("\s", arg) + # In Suricata 5.0 the classification.config and + # reference.config were moved into the etc/ directory. For now + # check there and the top level directory to still support + # 4.1. + classification_configs = [ + os.path.join(self.cwd, "etc", "classification.config"), + os.path.join(self.cwd, "classification.config"), + ] + + for config in classification_configs: + if os.path.exists(config): + args += ["--set", "classification-file=%s" % config] + break + + reference_configs = [ + os.path.join(self.cwd, "etc", "reference.config"), + os.path.join(self.cwd, "reference.config"), + ] + + for config in reference_configs: + if os.path.exists(config): + args += ["--set", "reference-config-file=%s" % config] + break + # Add other fixed arguments. args += [ - "--set", "classification-file=%s" % os.path.join( - self.cwd, "classification.config"), - "--set", "reference-config-file=%s" % os.path.join( - self.cwd, "reference.config"), "--init-errors-fatal", "-l", self.output, ]