From c18605cf191726cd0e605fe85fa73b89f1e7ed94 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Mon, 3 Mar 2014 21:08:43 -0800 Subject: Make some small changes in trans so that it is more likely to produce the same output as mustrans when given misbehaving programs. Add lea to testcases.txt. Improve the output of comparetest.py so that known issues can easily be separated from new ones. --- comparetests.py | 52 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 7 deletions(-) (limited to 'comparetests.py') diff --git a/comparetests.py b/comparetests.py index ce62ae2..3448fd4 100755 --- a/comparetests.py +++ b/comparetests.py @@ -18,6 +18,49 @@ for i in range(1, len(argv)): else: prefixes.append(argv[i]) +def print_mismatch(path, b, m): + blines = b.split('\n') + mlines = m.split('\n') + if len(blines) != len(mlines): + print '-----------------------------' + print 'Unknown mismatch in', path + print 'blastem output:' + print b + print 'musashi output:' + print m + print '-----------------------------' + return + prevline = '' + differences = [] + flagmismatch = False + regmismatch = False + for i in xrange(0, len(blines)): + if blines[i] != mlines[i]: + if prevline == 'XNZVC': + differences.append((prevline, prevline)) + flagmismatch = True + else: + regmismatch = True + differences.append((blines[i], mlines[i])) + prevline = blines[i] + if flagmismatch and regmismatch: + mtype = 'General' + elif flagmismatch: + mtype = 'Flag' + elif regmismatch: + mtype = 'Register' + else: + mtype = 'Unknown' + print '-----------------------------' + print mtype, 'mismatch in', path + for i in xrange(0, 2): + print 'musashi' if i else 'blastem', 'output:' + for diff in differences: + print diff[i] + print '-----------------------------' + + + for path in glob('generated_tests/*/*.bin'): if path in skip: continue @@ -36,13 +79,8 @@ for path in glob('generated_tests/*/*.bin'): 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 '-----------------------------' + print_mismatch(path, b, m) + else: print path, 'passed' except subprocess.CalledProcessError as e: -- cgit v1.2.3