summaryrefslogtreecommitdiff
path: root/piglit-summary.py
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2013-05-22 01:48:08 -0700
committerDylan Baker <baker.dylan.c@gmail.com>2013-07-02 12:10:41 -0700
commit19f901c5ff1eaf86da8f124469b3b6a5ae2d7fd3 (patch)
tree082d487f1ffa6a3c60da9a9a0bfee50f9b2a8fe7 /piglit-summary.py
parentd3727b3e977c1a0e16d50dbd973203e88139b570 (diff)
piglit-summary.py: Use NewSummary for text generation
This changes piglit-summary.py to use the new text generation of the summary backend, instead of the old. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com>
Diffstat (limited to 'piglit-summary.py')
-rwxr-xr-xpiglit-summary.py64
1 files changed, 10 insertions, 54 deletions
diff --git a/piglit-summary.py b/piglit-summary.py
index 29efc3a9d..70c74dcba 100755
--- a/piglit-summary.py
+++ b/piglit-summary.py
@@ -32,11 +32,9 @@
import argparse
import os.path
import sys
-import string
sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0])))
-import framework.core as core
-import framework.summary
+import framework.summary as summary
def parse_listfile(filename):
@@ -66,61 +64,19 @@ def main():
"results file")
args = parser.parse_args()
+ # Throw an error if -d/--diff is called, but only one results file is
+ # provided
+ if args.diff and len(args.results) < 2:
+ parser.error('-d/--diff cannot be specified unless two or more '
+ 'results files are specified')
+
# make list of results
if args.list:
args.results.extend(parse_listfile(args.list))
- results = [core.loadTestResults(i) for i in args.results]
-
- summary = framework.summary.Summary(results)
-
- # possible test outcomes
- possible_results = [ "pass", "fail", "crash", "skip", "warn" ]
- if len(args.results) > 1:
- possible_results.append("changes")
-
- # init the summary counters
- counts = {}
- for result in possible_results:
- counts[result] = 0
-
- # get all results
- all = summary.allTests()
-
- # sort the results list by path
- all = sorted(all, key=lambda test: test.path)
-
- # loop over the tests
- for test in all:
- results = []
- anyChange = False
- # loop over the results for multiple runs
- for j in range(len(summary.testruns)):
- outcome = test.results[j]['result'] # 'pass', 'fail', etc.
- # check for different results between multiple runs
- if len(results) >= 1 and not outcome in results:
- # something changed
- counts["changes"] += 1
- anyChange = True
- results.append(outcome)
-
- # if all test runs had the same outcome:
- if not anyChange:
- counts[outcome] += 1
-
- # print the individual test result line
- if args.diff:
- if anyChange:
- print "%s: %s" % (test.path, string.join(results," "))
- elif not args.summary:
- print "%s: %s" % (test.path, string.join(results," "))
- # print the summary info
- print "summary:"
- total = 0
- for result in possible_results:
- print " %7s: %5d" % (result, counts[result])
- total += counts[result]
- print " total: %5d" % total
+ # Generate the output
+ output = summary.NewSummary(args.results)
+ output.generateText(args.diff, args.summary)
if __name__ == "__main__":