annotate zcompare.py @ 884:252dfd29831d

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