From: Jeff Lucovsky Date: Tue, 25 Jan 2022 19:14:50 +0000 (-0500) Subject: test/yaml: Improve YAML parsing error messages X-Git-Tag: suricata-6.0.9~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=259fc2533007f7dccc92cae75c8988cdfdb90573;p=thirdparty%2Fsuricata-verify.git test/yaml: Improve YAML parsing error messages Without this commit, a YAML syntactic error is silently ignored. This patch displays the YAML exception, if any, that occurs while loading the YAML config file. --- diff --git a/run.py b/run.py index ce3615f78..523095bc0 100755 --- a/run.py +++ b/run.py @@ -524,8 +524,11 @@ class TestRunner: def load_config(self): if os.path.exists(os.path.join(self.directory, "test.yaml")): - self.config = yaml.safe_load( - open(os.path.join(self.directory, "test.yaml"), "rb")) + try: + self.config = yaml.safe_load( + open(os.path.join(self.directory, "test.yaml"), "rb")) + except yaml.scanner.ScannerError as e: + print(str(e)) if self.config is None: self.config = {}