diff options
author | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-06-12 23:18:21 +0200 |
---|---|---|
committer | Nicolai Haehnle <nhaehnle@gmail.com> | 2008-06-12 23:18:21 +0200 |
commit | eb6359d41b1c3e17d2fa03843d49dac026267a42 (patch) | |
tree | 581149796a094f5f1515363cc6792c105c9e1e45 /framework | |
parent | aa22711bf1658d30cbfc0b81e19b522a827ea35e (diff) |
Generate abbreviated results
The results files can get rather huge when tests fail, because tests like
glean/blendFunc output a lot of debugging data, which we all record.
Now, we generate an additional .../summary file, in which the info string
is simply truncated. Pretty stupid, but it should give enough info to get
an idea of the rough kind of failure.
Add a new option for piglit-summary-html.py, to choose between full or
abbreviated info when both are present.
Diffstat (limited to 'framework')
-rw-r--r-- | framework/core.py | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/framework/core.py b/framework/core.py index 53624b762..2e526a176 100644 --- a/framework/core.py +++ b/framework/core.py @@ -102,6 +102,9 @@ class TestResult(dict): 'dict': dict.__repr__(self) } + def allTestResults(self,name): + return {name: self} + def write(self,file,path): print >>file, "@test: " + encode(path) for k in self: @@ -136,12 +139,42 @@ class GroupResult(dict): 'dict': dict.__repr__(self) } + def allTestResults(self, groupName): + collection = {} + for name,sub in self.items(): + subfullname = name + if len(groupName) > 0: + subfullname = groupName + '/' + subfullname + collection.update(sub.allTestResults(subfullname)) + return collection + + def write(self, file, groupName): + for name,sub in self.items(): + subfullname = name + if len(groupName) > 0: + subfullname = groupName + '/' + subfullname + sub.write(file, subfullname) + + class TestrunResult: def __init__(self, *args): self.name = '' + self.globalkeys = ['name', 'glxinfo', 'lspci'] self.results = GroupResult() - def parse(self, path): + def allTestResults(self): + '''Return a dictionary containing (name: TestResult) mappings. + Note that writing to this dictionary has no effect.''' + return self.results.allTestResults('') + + def write(self, file): + for key in self.globalkeys: + if key in self.__dict__: + print >>file, "%s: %s" % (key, encode(self.__dict__[key])) + + self.results.write(file,'') + + def parse(self, path, PreferSummary): def arrayparser(a): def cb(line): if line == '!': @@ -179,7 +212,7 @@ class TestrunResult: key = line[:colon] value = decode(line[colon+2:]) - if key in ['name', 'glxinfo', 'lspci']: + if key in self.globalkeys: self.__dict__[key] = value elif key == '@test': comp = value.split('/') @@ -194,15 +227,27 @@ class TestrunResult: stack.append(dictparser(result)) else: - raise Exception("Line %(linenr)d: Unknown key" % locals()) + raise Exception("Line %d: Unknown key %s" % (linenr, key)) - main = open(path + '/main', 'r') + main = None + filelist = [path + '/main', path + '/summary'] + if PreferSummary: + filelist[:0] = [path + '/summary'] + for filename in filelist: + try: + main = open(filename, 'r') + break + except: + 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 + main.close() @@ -319,12 +364,12 @@ def loadTestProfile(filename): traceback.print_exc() raise Exception('Could not read tests profile') -def loadTestResults(path): +def loadTestResults(path,PreferSummary=False): try: mode = os.stat(path)[stat.ST_MODE] if stat.S_ISDIR(mode): testrun = TestrunResult() - testrun.parse(path) + testrun.parse(path,PreferSummary) else: # BACKWARDS COMPATIBILITY ns = { |