Commit c5cf79d6 authored by Nicolai Hähnle's avatar Nicolai Hähnle

Add piglit-create-summary.py to create summary files after the fact.

parent ad03bd4d
......@@ -175,7 +175,7 @@ class TestrunResult:
self.results.write(file,'')
def parse(self, path, PreferSummary):
def parseFile(self, file):
def arrayparser(a):
def cb(line):
if line == '!':
......@@ -230,6 +230,14 @@ class TestrunResult:
else:
raise Exception("Line %d: Unknown key %s" % (linenr, key))
stack = [toplevel]
linenr = 1
for line in file:
if line[-1] == '\n':
stack[-1](line[0:-1])
linenr = linenr + 1
def parseDir(self,path,PreferSummary):
main = None
filelist = [path + '/main', path + '/summary']
if PreferSummary:
......@@ -242,16 +250,10 @@ class TestrunResult:
pass
if not main:
raise Exception("Failed to open %(path)s" % locals())
stack = [toplevel]
linenr = 1
for line in main:
if line[-1] == '\n':
stack[-1](line[0:-1])
linenr = linenr + 1
self.parseFile(main)
main.close()
#############################################################################
##### Generic Test classes
#############################################################################
......@@ -372,28 +374,13 @@ def loadTestProfile(filename):
def loadTestResults(path,PreferSummary=False):
try:
mode = os.stat(path)[stat.ST_MODE]
testrun = TestrunResult()
if stat.S_ISDIR(mode):
testrun = TestrunResult()
testrun.parse(path,PreferSummary)
testrun.parseDir(path,PreferSummary)
else:
# BACKWARDS COMPATIBILITY
ns = {
'__file__': path,
'GroupResult': GroupResult,
'TestResult': TestResult,
'TestrunResult': TestrunResult
}
execfile(path, ns)
if 'testrun' not in ns:
testrun = TestrunResult()
testrun.results.update(ns['results'])
if 'name' in ns:
testrun.name = ns['name']
ns['testrun'] = testrun
testrun = ns['testrun']
# END BACKWARDS COMPATIBILITY
file = open(path, 'r')
testrun.parseFile(file)
file.close()
if len(testrun.name) == 0:
if path[-1] == '/':
......
#!/usr/bin/env python
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# This permission notice shall be included in all copies or
# substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
from getopt import getopt, GetoptError
import os
import os.path
import re
import sys
import framework.core as core
#############################################################################
##### Main program
#############################################################################
def usage():
USAGE = """\
Usage: %(progName)s [options] [main results file]
Options:
-h, --help Show this message
Example:
%(progName)s results/main > results/summary
"""
print USAGE % {'progName': sys.argv[0]}
sys.exit(1)
def main():
env = core.Environment()
try:
options, args = getopt(sys.argv[1:], "h", [ "help" ])
except GetoptError:
usage()
OptionName = ''
for name,value in options:
if name in ('-h', '--help'):
usage()
if len(args) != 1:
usage()
resultsFilename = args[0]
results = core.loadTestResults(resultsFilename)
for testname,result in results.allTestResults().items():
if 'info' in result:
if len(result['info']) > 4096:
result['info'] = result['info'][0:4096]
results.write(sys.stdout)
if __name__ == "__main__":
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment