[Piglit] [PATCH 1/2] summary.py: Treat subtests as groups

Dylan Baker baker.dylan.c at gmail.com
Tue Nov 5 10:34:50 PST 2013


This patch causes tests with subtests to be treated as a group, rather
than as a test. This means that the status the test itself stores will
be overwritten by those in the subtest.

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

diff --git a/framework/summary.py b/framework/summary.py
index a587712..1a880ac 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -161,8 +161,17 @@ class HTMLIndex(list):
             # is a KeyError (a result doesn't contain a particular test),
             # return Not Run, with clas skip for highlighting
             for each in summary.results:
+                # If the "group" at the top of the key heirachy contains
+                # 'subtest' then it is really not a group, link to that page
                 try:
-                    self._testResult(each.name, key, each.tests[key]['result'])
+                    if each.tests[path.dirname(key)]['subtest']:
+                        href = path.dirname(key)
+                except KeyError:
+                    href = key
+
+                try:
+                    self._testResult(each.name, href,
+                                     summary.status[each.name][key])
                 except KeyError:
                     self.append({'type': 'other',
                                  'text': '<td class="skip">Not Run</td>'})
@@ -278,8 +287,28 @@ class Summary:
             status = self.status[results.name]
 
             for key, value in results.tests.iteritems():
-                #FIXME: Add subtest support
+                # Treat a test with subtests as if it is a group, assign the
+                # subtests' statuses and fractions down to the test, and then
+                # proceed like normal.
+                try:
+                    for (subt, subv) in value['subtest'].iteritems():
+                        subt = path.join(key, subt)
+                        subv = so.status_lookup(subv)
+
+                        # Add the subtest to the fractions and status lists
+                        fraction[subt] = subv.fraction
+                        status[subt] = subv
+
+                        fgh(subt, subv)
+                        self.tests['all'].add(subt)
+
+                    # remove the test from the 'all' list, this will cause it
+                    # to be treated as a group
+                    self.tests['all'].discard(key)
+                except KeyError:
+                    pass
 
+                result = value['result']
                 # Walk the test name as if it was a path, at each level update
                 # the tests passed over the total number of tests (fractions),
                 # and update the status of the current level if the status of
-- 
1.8.1.5



More information about the Piglit mailing list