Mercurial > repos > blastem
annotate comparetests.py @ 367:f20562f2a570
Fix P condition in Z80 core
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 31 May 2013 20:46:56 -0700 |
parents | f7ff02eeec2f |
children | 306986209cba |
rev | line source |
---|---|
214
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
2 from glob import glob |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 import subprocess |
220
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
4 from sys import exit,argv |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
5 |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
6 prefixes = [] |
224
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
7 skip = set() |
220
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
8 for i in range(1, len(argv)): |
224
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
9 if '.' in argv[i]: |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
10 f = open(argv[i]) |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
11 for line in f: |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
12 parts = line.split() |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
13 for part in parts: |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
14 if part.endswith('.bin'): |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
15 skip.add(part) |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
16 f.close() |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
17 print 'Skipping',len(skip),'entries from previous report.' |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
18 else: |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
19 prefixes.append(argv[i]) |
214
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 |
224
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
21 for path in glob('generated_tests/*/*.bin'): |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
22 if path in skip: |
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
23 continue |
220
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
24 if prefixes: |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
25 good = False |
224
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
26 fname = path.split('/')[-1] |
220
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
27 for prefix in prefixes: |
224
f7ff02eeec2f
Added testcases for move and roxl/roxr. Made some small improvements to test tools.
Mike Pavone <pavone@retrodev.com>
parents:
220
diff
changeset
|
28 if fname.startswith(prefix): |
220
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
29 good = True |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
30 break |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
31 if not good: |
cb72780e17b1
Add support for picking random numbers in a larger range in test generator. Add support for running a subset of tests in runner. Added testcases for bit and rotate instructions.
Mike Pavone <pavone@retrodev.com>
parents:
217
diff
changeset
|
32 continue |
214
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 try: |
217
acd29e2664c6
Added testcases file. Some fixes to test generator for dealing with indexed mode with base and index reg the same. Added support for blastem headless mode in test runner.
Mike Pavone <pavone@retrodev.com>
parents:
214
diff
changeset
|
34 b = subprocess.check_output(['./blastem', path, '-v']) |
214
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 try: |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 m = subprocess.check_output(['musashi/mustrans', path]) |
217
acd29e2664c6
Added testcases file. Some fixes to test generator for dealing with indexed mode with base and index reg the same. Added support for blastem headless mode in test runner.
Mike Pavone <pavone@retrodev.com>
parents:
214
diff
changeset
|
37 #_,_,b = b.partition('\n') |
214
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 if b != m: |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 print 'Mismatch in ' + path |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 print 'blastem output:' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 print b |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 print 'musashi output:' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 print m |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 else: |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 print path, 'passed' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 except subprocess.CalledProcessError as e: |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 print 'musashi exited with code', e.returncode, 'for test', path |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 print 'blastem output:' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 print b |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 except subprocess.CalledProcessError as e: |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
55 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 print 'blastem exited with code', e.returncode, 'for test', path |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 print '-----------------------------' |
9126c33cc33c
Add test generator, builder and runner
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 |