|
46 | 46 |
|
47 | 47 | # Go through all the files in 'data-expected' and read them. For each, make sure there is a
|
48 | 48 | # corresponding file in 'data-output'. Open that file and make sure that the information matches.
|
49 |
| -for _, _, fnames in sorted(os.walk('data-expected')): |
| 49 | +for _, _, fnames in sorted(os.walk('data-expected')): # type: ignore |
50 | 50 | for fname in sorted(fnames):
|
51 | 51 | outname = fname.replace('DRAM_', 'DRAM_out_')
|
52 | 52 | if not os.path.isfile(os.path.join('data-output', outname)):
|
|
66 | 66 | sys.exit(-3)
|
67 | 67 |
|
68 | 68 | try:
|
69 |
| - addr = int(addr[1:], base=16) |
| 69 | + addr = int(addr[1:], base=16) # type: ignore |
70 | 70 | val = val.strip().lower()
|
71 | 71 | mask = ''
|
72 |
| - for _, m in enumerate(val): |
| 72 | + for _, m in enumerate(val): # type: ignore |
73 | 73 | mask += '0' if m == 'x' else 'f'
|
74 |
| - mask = int(mask, base=16) |
75 |
| - val = int(val.replace('x', '0'), base=16) |
| 74 | + mask = int(mask, base=16) # type: ignore |
| 75 | + val = int(val.replace('x', '0'), base=16) # type: ignore |
76 | 76 | except ValueError:
|
77 | 77 | log.error('Malformed line %s in file data-expected/%s!', e.strip(), fname)
|
78 | 78 | sys.exit(-3)
|
79 | 79 |
|
80 |
| - if addr > len(data): |
| 80 | + if addr > len(data): # type: ignore |
81 | 81 | log.error('Address from %s not present in file data-output/%s!',
|
82 | 82 | e.strip(), outname)
|
83 | 83 | failures += 1
|
84 | 84 | else:
|
85 |
| - result = data[addr].strip().lower() |
| 85 | + result = data[addr].strip().lower() # type: ignore |
86 | 86 | if result == 'x' * len(result):
|
87 | 87 | log.error('Output is %s at address %04x in file data-output/%s!',
|
88 | 88 | result, addr, outname)
|
|
93 | 93 | resultf = int(result.replace('x', 'f'), base=16)
|
94 | 94 | except ValueError:
|
95 | 95 | log.error('Malformed line %04x: %s in file data-output/%s!',
|
96 |
| - addr, data[addr].strip(), fname) |
| 96 | + addr, data[addr].strip(), fname) # type: ignore |
97 | 97 | sys.exit(-3)
|
98 | 98 |
|
99 | 99 | log.debug('Found address %04x, val %08x, comp %s', addr, val, result)
|
100 |
| - if result0 & mask != val & mask or resultf & mask != val & mask: |
| 100 | + if ( |
| 101 | + result0 & mask != val & mask # type: ignore |
| 102 | + or resultf & mask != val & mask # type: ignore |
| 103 | + ): |
101 | 104 | log.error('Data mismatch at address %04x in file data-output/%s. '
|
102 | 105 | 'Expected: %08x, got %s (mask %08x)!',
|
103 | 106 | addr, outname, val, result, mask)
|
|
0 commit comments