[cairo-commit] test/compare-results

Bryce Harrington bryce at kemper.freedesktop.org
Fri Jul 31 19:01:31 PDT 2015


 test/compare-results |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

New commits:
commit e40806ecdf81e46aa805a9298b603233656cc931
Author: Bryce Harrington <bryce at osg.samsung.com>
Date:   Fri Jul 31 19:00:48 2015 -0700

    test: Add script to display the difference between two result sets

diff --git a/test/compare-results b/test/compare-results
new file mode 100755
index 0000000..97df824
--- /dev/null
+++ b/test/compare-results
@@ -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))


More information about the cairo-commit mailing list