From: Jason Ish Date: Thu, 28 Sep 2023 18:11:15 +0000 (-0600) Subject: runner: fail test if pcap cannot be found X-Git-Tag: suricata-6.0.15~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1402%2Fhead;p=thirdparty%2Fsuricata-verify.git runner: fail test if pcap cannot be found Will fail with an error like: FAILED: PCAP filename does not exist: ../tls/tls-certs-alert/input.pcap --- diff --git a/run.py b/run.py index 0025d5ef8..7a67738af 100755 --- a/run.py +++ b/run.py @@ -909,7 +909,14 @@ class TestRunner: # Find pcaps. if "pcap" in self.config: - args += ["-r", os.path.realpath(os.path.join(self.directory, self.config["pcap"]))] + try: + curdir = os.getcwd() + os.chdir(self.directory) + if not os.path.exists(self.config["pcap"]): + raise TestError("PCAP filename does not exist: {}".format(self.config["pcap"])) + args += ["-r", os.path.realpath(os.path.join(self.directory, self.config["pcap"]))] + finally: + os.chdir(curdir) else: pcaps = glob.glob(os.path.join(self.directory, "*.pcap")) pcaps += glob.glob(os.path.join(self.directory, "*.pcapng"))