Skip to content

Commit

Permalink
runner: fail test if pcap cannot be found
Browse files Browse the repository at this point in the history
Will fail with an error like:
FAILED: PCAP filename does not exist: ../tls/tls-certs-alert/input.pcap
  • Loading branch information
jasonish authored and victorjulien committed Sep 29, 2023
1 parent 65a187e commit dd3906c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,14 @@ def default_args(self):

# 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"))
Expand Down

0 comments on commit dd3906c

Please sign in to comment.