-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add script to display the difference between two result sets
- Loading branch information
Bryce Harrington
committed
Aug 1, 2015
1 parent
60c2f69
commit e40806e
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/python | ||
|
||
# Print the difference between two results.txt files from cairo tests | ||
|
||
import sys | ||
|
||
old_filename = sys.argv[1] | ||
new_filename = sys.argv[2] | ||
|
||
results = { } | ||
|
||
f = open(old_filename, "r") | ||
for line in f.readlines(): | ||
if 'RESULT:' not in line: | ||
continue | ||
|
||
items = line.split(" ") | ||
testcase = dict(zip(items[0::2], items[1::2])) | ||
|
||
try: | ||
k = "%s.%s.%s" %( | ||
testcase['TEST:'], | ||
testcase['TARGET:'], | ||
testcase.get('FORMAT:', '')) | ||
results[k] = testcase['RESULT:'] | ||
except: | ||
print line | ||
raise | ||
|
||
f = open(new_filename, "r") | ||
for line in f.readlines(): | ||
if 'RESULT:' not in line: | ||
# Not a results line. Skip | ||
continue | ||
|
||
items = line.split(" ") | ||
testcase = dict(zip(items[0::2], items[1::2])) | ||
try: | ||
k = "%s.%s.%s" %( | ||
testcase['TEST:'], | ||
testcase['TARGET:'], | ||
testcase.get('FORMAT:','')) | ||
except: | ||
print line | ||
raise | ||
|
||
if k not in results.keys(): | ||
# New test? Skip | ||
continue | ||
|
||
old_val = results[k].strip() | ||
new_val = testcase['RESULT:'].strip() | ||
if old_val == new_val: | ||
# Test didn't change. Skip | ||
continue | ||
|
||
print("%s -> %s # %s" % (old_val, new_val, k)) |