From e325dc36e4c3956098a1e677b6bc1a306fd5ca96 Mon Sep 17 00:00:00 2001 From: canterburym Date: Fri, 2 Oct 2020 13:19:28 +0200 Subject: [PATCH] Update testing --- testing/check_asn1.py | 2 ++ testing/compile_asn.py | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/testing/check_asn1.py b/testing/check_asn1.py index df9771c..c87a226 100644 --- a/testing/check_asn1.py +++ b/testing/check_asn1.py @@ -3,6 +3,8 @@ from compile_asn import * if __name__ == '__main__': + log = logging.getLogger() + log.setLevel(logging.INFO) parseErrors, compileErrors, parser = validateAllASN1FilesInPath("./") parseErrorCount = 0 print ("ASN.1 Parser checks:") diff --git a/testing/compile_asn.py b/testing/compile_asn.py index a7a531a..33fea50 100644 --- a/testing/compile_asn.py +++ b/testing/compile_asn.py @@ -114,17 +114,21 @@ def compileASN1Files (fileList): except CompileError as ex: logging.info (f"Compiler error: {ex}") errors.append(ex) + return errors, None except ParseError as ex: logging.info (f"Parse error: {ex}") errors.append(ex) + return errors, None logging.info ("Compiled OK") return errors, c def validateASN1Files (fileList): parseErrors = parseASN1Files(fileList) - if len(parseErrors) > 0: - logging.info ("Abandonding compile due to parse errors") + errorCount = sum([len(v) for k,v in parseErrors.items()]) + if errorCount > 0: + logging.info ("Abandoning compile due to parse errors") + return parseErrors, [], None compileErrors, parser = compileASN1Files(fileList) return parseErrors, compileErrors, parser -- GitLab