From 6b540bf02c1dbc4be6d03bebc34ae6a1d774387a Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Fri, 20 Apr 2012 00:17:21 -0700 Subject: json hackery WIP --- framework/suites.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/framework/suites.py b/framework/suites.py index b7b4555..abd968c 100644 --- a/framework/suites.py +++ b/framework/suites.py @@ -26,7 +26,7 @@ import re #import framework.test -#__all__ = ['TestSuite', 'TestType'] +#__all__ = ['TestSuite', 'TestKind'] class TestSuite: """ @@ -35,7 +35,7 @@ class TestSuite: For now, this contains the following information: - Name - Description - - List of registered TestTypes + - List of registered TestKinds - Absolute path to the JSON test list file - Dictionary of tests """ @@ -44,11 +44,13 @@ class TestSuite: self.name = js['name'] self.description = js['description'] - self.types = map(TestType, js['types'].items()) + self.types = map(TestKind, js['types'].items()) self.testlist_file = path.abspath(path.join(path.dirname(jsonFile.name), js['tests'])) self.tests = {} -class TestType: +kinds = {} + +class TestKind: """ Description of a class of tests (e.g. Piglit's ExecTest, GleanTest, ...). @@ -61,13 +63,23 @@ class TestType: JSON test list, the "type" tag indicates what kind of test it is. """ def __init__(self, name, desc): - # XXX: register tag constructor - self.tag = name self.default_result = desc['default_result'] self.regexs = {} for status, exp in desc['regexp'].items(): self.regexs[status] = re.compile(exp) + # Register this Kind so it's available + # XXX: may want to move this into the caller...or caller's caller + assert name not in kinds + kinds[name] = self + + def interpretResult(self): + for status, re in self.regexs.items(): + if re.search(out) is not None: + result = status + break + result = self.default_result + def availableSuites(): """ Read the ~/.robynrc file and fetch a list of available test suites. @@ -112,6 +124,7 @@ def loadTestList(suite): with open(suite.testlist_file) as fp: js = json.load(fp) + for file in tests suite.tests = js return None -- cgit v1.2.3