summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-04-20 00:17:21 -0700
committerKenneth Graunke <kenneth@whitecape.org>2012-04-20 00:17:21 -0700
commit6b540bf02c1dbc4be6d03bebc34ae6a1d774387a (patch)
treeb38136121039dc2012111b6292c7d1461f6d36c8
parentb512f1417631a8f548e9971f74d1d3820a987ea7 (diff)
json hackery WIP
-rw-r--r--framework/suites.py25
1 files 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