[Piglit] [PATCH] summary: fix support for old results file with duplicated subtests

Ilia Mirkin imirkin at alum.mit.edu
Wed May 28 19:17:55 PDT 2014

Old files have duplicated entries for each subtest, in addition to a
filled subtest dictionary. Detect that the current test name is also a
subtest and treat it as though it were a complete test. This may have
false-negatives, but they're unlikely given test/subtest naming

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>

Dylan, I'm sure you hate this, but it does seem to work for me. Not sure where
you are with your fix, but this is a tool that lots of people use, so it does
need to be addressed. And keep in mind that by now there are both the "old"
and "new" formats running around, so just slapping a version number in there
won't be enough.

Perhaps we should add some tests that check against goldens which will make it
more obvious when someone's changing the format.

 framework/summary.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index c905b98..6eb7535 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -318,8 +318,16 @@ class Summary:
                 # 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.
-                if 'subtest' in value:
+                # proceed like normal. However to be compatible with older
+                # test result files, detect the condition where subtests were
+                # repeated and treat them as normal tests. Note that some
+                # subtests actually have paths in them, so accomodate that as
+                # well, up to the second level.
+                name = path.basename(key)
+                l2name = path.basename(path.dirname(key))
+                if ('subtest' in value and
+                    name not in value['subtest'] and
+                    os.path.join(l2name, name) not in value['subtest']):
                     for (subt, subv) in value['subtest'].iteritems():
                         subt = path.join(key, subt)
                         subv = so.status_lookup(subv)

More information about the Piglit mailing list