diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-06 00:09:45 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2017-06-06 01:43:44 +0200 |
commit | b59c504ecda1693417932878a8c92bab80f9635c (patch) | |
tree | 4d8b32914a123d4590bf16216a16845b2c2c5e9c /decoder/pdtest | |
parent | 954e04d9f9f1d68644d7d8b4e5d13adfd05c1a3a (diff) | |
download | sigrok-test-b59c504ecda1693417932878a8c92bab80f9635c.tar.gz sigrok-test-b59c504ecda1693417932878a8c92bab80f9635c.zip |
Add support for initial pin settings.
Adapt all tests that require it to use the old behaviour of assuming an
initial pin value of 0 (or whatever was previously hardcoded in the PD).
for now (this will likely see some changes later).
Diffstat (limited to 'decoder/pdtest')
-rwxr-xr-x | decoder/pdtest | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/decoder/pdtest b/decoder/pdtest index 1cc071f..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']) @@ -486,6 +495,8 @@ def show_tests(tests): print(" Channel %s=%d" % (label, channel)) for option, value in pd['options']: 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']) |