check_asn1.py 441 Bytes
Newer Older
canterburym's avatar
canterburym committed
1
2
3
4
5
6
7
8
9
from asn1tools import parse_files, ParseError
import sys
from glob import glob
from pathlib import Path


schemaFileGlob = glob("*.asn1")
for schemaFile in schemaFileGlob:
    try:
canterburym's avatar
canterburym committed
10
        print("Checking file: {0}".format(schemaFile), end="")
canterburym's avatar
canterburym committed
11
        parse_files(schemaFile)
canterburym's avatar
canterburym committed
12
        print(" OK")
canterburym's avatar
canterburym committed
13
14
15
    except ParseError as ex:
        sys.exit("ASN1 parser error: " + str(ex))

canterburym's avatar
canterburym committed
16
print ("{0} ASN.1 schemas checked".format(len(schemaFileGlob)))