diff comparetests.py @ 214:9126c33cc33c

Add test generator, builder and runner
author Mike Pavone <pavone@retrodev.com>
date Fri, 19 Apr 2013 09:29:37 -0700
parents
children acd29e2664c6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/comparetests.py	Fri Apr 19 09:29:37 2013 -0700
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+from glob import glob
+import subprocess
+from sys import exit
+
+for path in glob('generated_tests/*.bin'):
+	try:
+		b = subprocess.check_output(['./blastem', path])
+		try:
+			m = subprocess.check_output(['musashi/mustrans', path])
+			_,_,b = b.partition('\n')
+			if b != m:
+				print '-----------------------------'
+				print 'Mismatch in ' + path
+				print 'blastem output:'
+				print b
+				print 'musashi output:'
+				print m
+				print '-----------------------------'
+			else:
+				print path, 'passed'
+		except subprocess.CalledProcessError as e:
+			print '-----------------------------'
+			print 'musashi exited with code', e.returncode, 'for test', path
+			print 'blastem output:'
+			print b
+			print '-----------------------------'
+	except subprocess.CalledProcessError as e:
+		print '-----------------------------'
+		print 'blastem exited with code', e.returncode, 'for test', path
+		print '-----------------------------'
+