From dd3906caab49c92e909ddd33d8aceb307a703271 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Thu, 28 Sep 2023 12:11:15 -0600 Subject: [PATCH] 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 --- run.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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")) -- 2.47.2