X-Git-Url: https://sigrok.org/gitweb/?p=sigrok-test.git;a=blobdiff_plain;f=decoder%2Fpdtest;h=e3509b967176730588183ac9c8388675c96bdb36;hp=da548e3c73ecd2bf4857bf7d6836b0dad5781bcc;hb=d265c4719f2aa27896ce53ea79a301fc6c97cfca;hpb=810494f47bc946119c10b3d1cd0c9b4834cb9b07 diff --git a/decoder/pdtest b/decoder/pdtest index da548e3..e3509b9 100755 --- a/decoder/pdtest +++ b/decoder/pdtest @@ -113,6 +113,7 @@ def parse_testfile(path, pd, tc, op_type, op_class): 'name': f.pop(0), 'channels': [], 'options': [], + 'initial_pins': [], } while len(f): if len(f) == 1: @@ -131,6 +132,12 @@ def parse_testfile(path, pd, tc, op_type, op_class): pd_spec['channels'].append([opt, val]) elif a == 'option': pd_spec['options'].append([opt, val]) + elif a == 'initial_pin': + try: + val = int(val) + except: + raise E_syntax + pd_spec['initial_pins'].append([opt, val]) else: raise E_syntax tclist[-1]['pdlist'].append(pd_spec) @@ -319,6 +326,8 @@ def run_tests(tests, fix=False): args.extend(['-p', "%s=%d" % (label, channel)]) for option, value in spd['options']: args.extend(['-o', "%s=%s" % (option, value)]) + for label, initial_pin in spd['initial_pins']: + args.extend(['-N', "%s=%d" % (label, initial_pin)]) args.extend(['-i', os.path.join(dumps_dir, tc['input'])]) for op in tc['output']: name = "%s/%s/%s" % (pd, tc['name'], op['type']) @@ -485,7 +494,9 @@ def show_tests(tests): for label, channel in pd['channels']: print(" Channel %s=%d" % (label, channel)) for option, value in pd['options']: - print(" Option %s=%d" % (option, value)) + print(" Option %s=%s" % (option, value)) + for label, initial_pin in pd['initial_pins']: + print(" Initial pin %s=%d" % (label, initial_pin)) if 'stack' in tc: print(" Stack: %s" % ' '.join(tc['stack'])) print(" Input: %s" % tc['input']) @@ -561,7 +572,7 @@ ret = 0 try: if args: testlist = get_tests(args) - elif opt_all: + elif opt_all or opt_list: testlist = get_tests(os.listdir(tests_dir)) else: usage("Specify either -a or tests.")