From: Jason Ish Date: Tue, 21 Dec 2021 16:13:12 +0000 (-0600) Subject: runner: wrap file compare exceptions in TestError X-Git-Tag: suricata-6.0.5~50 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a56c4749cda593aa5922d2de4804ff6ec0c5c69e;p=thirdparty%2Fsuricata-verify.git runner: wrap file compare exceptions in TestError If filecmp.cmp failed with an exception due to a missing file, its exception was being lost due to another issue in the runner. For this case it makes sense to catch this exception and wrap it in a TestError exception as its most likely a missing file. --- diff --git a/run.py b/run.py index 522d953cd..d5440343d 100755 --- a/run.py +++ b/run.py @@ -378,10 +378,13 @@ class FileCompareCheck: return True; expected = os.path.join(self.directory, self.config["expected"]) filename = self.config["filename"] - if filecmp.cmp(expected, filename): - return True - else: - raise TestError("%s %s \nFAILED: verification failed" % (expected, filename)) + try: + if filecmp.cmp(expected, filename): + return True + else: + raise TestError("%s %s \nFAILED: verification failed" % (expected, filename)) + except Exception as err: + raise TestError("file-compare check failed with exception: %s" % (err)) class ShellCheck: