[Piglit] [PATCH 15/16] summary.py: Remove all of the old summary backend

Dylan Baker baker.dylan.c at gmail.com
Thu Jun 13 08:36:22 PDT 2013


Since nothing now depends on the old summary backend, delete it. This
first eliminates dead code, but also ensures that no new functionality
becomes dependent on this code.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py | 232 +--------------------------------------------------
 1 file changed, 1 insertion(+), 231 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 7ea11f3..2b5a62b 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -21,7 +21,6 @@
 
 import os
 import os.path as path
-import string
 from itertools import izip_longest
 from shutil import copy
 from json import loads
@@ -30,239 +29,10 @@ from mako.template import Template
 import core
 
 __all__ = [
-    'Summary',
-    'NewSummary',
+    'NewSummary'
 ]
 
 
-class PassVector:
-    """
-    Vector indicting the number of tests that have a particular status,
-    pass/fail/skip/etc.
-    """
-
-    def __init__(self, p, w, f, s, c):
-        self.passnr = p
-        self.warnnr = w
-        self.failnr = f
-        self.skipnr = s
-        self.crashnr = c
-
-    def add(self, o):
-        self.passnr += o.passnr
-        self.warnnr += o.warnnr
-        self.failnr += o.failnr
-        self.skipnr += o.skipnr
-        self.crashnr += o.crashnr
-
-
-class TestSummary:
-    """
-    Summarize the results for one test across a number of testruns
-    """
-    def isRegression(self, statiList):
-        # Regression is:
-        # - if an item is neither 'pass' nor 'skip'
-        # - and if any item on the left side thereof is 'pass' or 'skip'
-        for i in range(1, len(statiList)):
-            if statiList[i-1] == 'pass' or statiList[i-1] == 'skip':
-                for j in range(i, len(statiList)):
-                    if statiList[j] != 'pass' and statiList[j] != 'skip':
-                        return True
-        return False
-
-    def __init__(self, summary, path, name, results):
-        """\
-summary is the root summary object
-path is the path to the group (e.g. shaders/glean-fragProg1)
-name is the display name of the group (e.g. glean-fragProg1)
-results is an array of TestResult instances, one per testrun
-"""
-        self.summary = summary
-        self.path = path
-        self.name = name
-        self.results = results[:]
-
-        for j in range(len(self.results)):
-            result = self.results[j]
-            result.testrun = self.summary.testruns[j]
-            result.status = ''
-            if 'result' in result:
-                result.status = result['result']
-
-            vectormap = {
-                    'pass': PassVector(1,0,0,0,0),
-                    'warn': PassVector(0,1,0,0,0),
-                    'fail': PassVector(0,0,1,0,0),
-                    'skip': PassVector(0,0,0,1,0),
-                    'crash': PassVector(0,0,0,0,1)
-            }
-
-            if result.status not in vectormap:
-                result.status = 'warn'
-
-            result.passvector = vectormap[result.status]
-
-        statiList = [result.status for result in results]
-        statiSet = set(statiList)
-        self.changes = len(statiSet) > 1
-        self.problems = len(statiSet - set(['pass', 'skip'])) > 0
-        self.regressions = self.isRegression(statiList)
-        statiList.reverse()
-        self.fixes = self.isRegression(statiList)
-        self.skipped = 'skip' in statiSet
-
-    def allTests(self):
-        return [self]
-
-
-class GroupSummary:
-    """
-    Summarize a group of tests
-    """
-    def createDummyGroup(self, result, test_name):
-        new_group = core.GroupResult()
-        new_group[' ' + test_name + '(All Tests)'] = result[test_name]
-        result[test_name] = new_group
-
-    def __init__(self, summary, path, name, results):
-        """\
-summary is the root summary object
-path is the path to the group (e.g. shaders/glean-fragProg1)
-name is the display name of the group (e.g. glean-fragProg1)
-results is an array of GroupResult instances, one per testrun
-"""
-        self.summary = summary
-        self.path = path
-        self.name = name
-        self.results = results[:]
-        self.changes = False
-        self.problems = False
-        self.regressions = False
-        self.fixes = False
-        self.skipped = False
-        self.children = {}
-
-        # Perform some initial annotations
-        for j in range(len(self.results)):
-            result = self.results[j]
-            result.passvector = PassVector(0, 0, 0, 0, 0)
-            result.testrun = self.summary.testruns[j]
-
-        # Collect, create and annotate children
-        for result in self.results:
-            for name in result:
-                if name in self.children:
-                    continue
-
-                childpath = name
-                if len(self.path) > 0:
-                    childpath = self.path + '/' + childpath
-
-                if isinstance(result[name], core.GroupResult):
-                    # This loop checks to make sure that all results
-                    # with the same 'name' are of the same type.
-                    # This is necessary to handle the case where
-                    # a testname in an earlier result (an earlier
-                    # result in this case means a result that
-                    # comes before the current result in self.results)
-                    # denotes a test group but in a later
-                    # result it denotes a single test case, for example:
-                    #
-                    # result 0:
-                    #       test/group/a PASS
-                    #       test/group/b PASS
-                    #       test/group/c PASS
-                    # result 1:
-                    #       test/group PASS
-                    for r in self.results:
-                        if name in r and not isinstance(r[name], core.GroupResult):
-                            self.createDummyGroup(r, name)
-
-                    childresults = [r.get(name, core.GroupResult())
-                                    for r in self.results]
-
-                    self.children[name] = GroupSummary(
-                            summary,
-                            childpath,
-                            name,
-                            childresults
-                    )
-                else:
-                    # We need to check and handle the reversed case
-                    # described in the above comment e.g.:
-                    # result 0:
-                    #       test/group PASS
-                    # result 1:
-                    #       test/group/a PASS
-                    #       test/group/b PASS
-                    #       test/group/c PASS
-                    need_group = 0
-                    for r in self.results:
-                        if name in r and not isinstance(r[name], core.TestResult):
-                            need_group = 1
-                    if need_group:
-                        for r in self.results:
-                            if name in r and isinstance(r[name], core.TestResult):
-                                self.createDummyGroup(r, name)
-                        childresults = [r.get(name, core.GroupResult())
-                                        for r in self.results]
-
-                        self.children[name] = GroupSummary(
-                                summary,
-                                childpath,
-                                name,
-                                childresults
-                        )
-                    else:
-                        childresults = [r.get(name, core.TestResult({ 'result': 'skip' }))
-                                        for r in self.results]
-                        self.children[name] = TestSummary(
-                                summary,
-                                childpath,
-                                name,
-                                childresults
-                        )
-
-                for j in range(len(self.results)):
-                    self.results[j].passvector.add(childresults[j].passvector)
-
-                self.changes = self.changes or self.children[name].changes
-                self.problems = self.problems or self.children[name].problems
-                self.regressions = self.regressions or self.children[name].regressions
-                self.fixes = self.fixes or self.children[name].fixes
-                self.skipped = self.skipped or self.children[name].skipped
-
-    def allTests(self):
-        """\
-Returns an array of all child TestSummary instances.
-"""
-        return [t for name in self.children for t in self.children[name].allTests()]
-
-
-class Summary:
-    """
-    Summarize an array of testruns
-    """
-    def __init__(self, testruns):
-        """\
-testruns is an array of TestrunResult instances
-"""
-        groups = [
-                core.GroupResult.make_tree(testrun.tests)
-                for testrun in testruns
-                ]
-        self.testruns = testruns
-        self.root = GroupSummary(self, '', 'All', groups)
-
-    def allTests(self):
-        """\
-Returns an array of all child TestSummary instances.
-"""
-        return self.root.allTests()
-
-## New Summary
-
 class Result(core.TestrunResult):
     """
     Object that opens, reads, and stores the data in a resultfile.
-- 
1.8.1.4



More information about the Piglit mailing list