comparison zcompare.py @ 600:a9dcaacdc0c5

Add Z80 test runner Python script I wrote a while back and forgot to commit
author Michael Pavone <pavone@retrodev.com>
date Fri, 26 Dec 2014 13:42:25 -0800
parents
children
comparison
equal deleted inserted replaced
599:c1cfbf1837cf 600:a9dcaacdc0c5
1 #!/usr/bin/env python
2 from glob import glob
3 import subprocess
4 from sys import exit,argv
5
6 prefixes = []
7 skip = set()
8 for i in range(1, len(argv)):
9 if '.' in argv[i]:
10 f = open(argv[i])
11 for line in f:
12 parts = line.split()
13 for part in parts:
14 if part.endswith('.bin'):
15 skip.add(part)
16 f.close()
17 print 'Skipping',len(skip),'entries from previous report.'
18 else:
19 prefixes.append(argv[i])
20
21 for path in glob('ztests/*/*.bin'):
22 if path in skip:
23 continue
24 if prefixes:
25 good = False
26 fname = path.split('/')[-1]
27 for prefix in prefixes:
28 if fname.startswith(prefix):
29 good = True
30 break
31 if not good:
32 continue
33 try:
34 b = subprocess.check_output(['./ztestrun', path])
35 try:
36 m = subprocess.check_output(['gxz80/gxzrun', path])
37 #_,_,b = b.partition('\n')
38 if b != m:
39 print '-----------------------------'
40 print 'Mismatch in ' + path
41 print 'blastem output:'
42 print b
43 print 'gxz80 output:'
44 print m
45 print '-----------------------------'
46 else:
47 print path, 'passed'
48 except subprocess.CalledProcessError as e:
49 print '-----------------------------'
50 print 'gxz80 exited with code', e.returncode, 'for test', path
51 print 'blastem output:'
52 print b
53 print '-----------------------------'
54 except subprocess.CalledProcessError as e:
55 print '-----------------------------'
56 print 'blastem exited with code', e.returncode, 'for test', path
57 print '-----------------------------'
58