check_asn1.py 1.04 KB
Newer Older
canterburym's avatar
canterburym committed
import logging
from compile_asn import *
canterburym's avatar
canterburym committed


if __name__ == '__main__':
canterburym's avatar
canterburym committed
    log = logging.getLogger()
    log.setLevel(logging.INFO)
    parseErrors, compileErrors, parser = validateAllASN1FilesInPath("./")
canterburym's avatar
canterburym committed
    parseErrorCount = 0
    print ("ASN.1 Parser checks:")
    print ("-----------------------------")
    for filename, errors in parseErrors.items():
        if len(errors) > 0:
            parseErrorCount += len(errors)
            print (f"{filename}: {len(errors)} errors")
            for error in errors:
                print ("  " + str(error))
        else:
            print (f"{filename}: OK")
    print ("-----------------------------")
    print ("ASN.1 Compilation:")
    print ("-----------------------------")
    if len(compileErrors) > 0:
        for error in compileErrors:            
            print ("  " + str(error))
    else:
        print ("Compilation OK")
    print ("-----------------------------")
    print (f"{parseErrorCount} parse errors, {len(compileErrors)} compile errors")
    exit (parseErrorCount + len(compileErrors))