summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-04-21 00:42:41 -0700
committerKenneth Graunke <kenneth@whitecape.org>2012-04-21 00:42:56 -0700
commitfb20d2346e18185104a2d934a9c707d4cd2d8d31 (patch)
tree87ae3b28561d7648e6e206cbaae90fcc138e2117
parentad157035fc1ee33c14c0523626559894b2961de0 (diff)
Eliminate all the TestKinds
Suites now only have one testkind
-rw-r--r--framework/suites.py75
1 files changed, 34 insertions, 41 deletions
diff --git a/framework/suites.py b/framework/suites.py
index f85a84f..5b892c5 100644
--- a/framework/suites.py
+++ b/framework/suites.py
@@ -27,9 +27,11 @@ import re
#import framework.test
-#__all__ = ['TestSuite', 'TestKind']
+#__all__ = ['TestSuite']
-kinds = {}
+#############################################################################
+##### Test suite descriptions
+#############################################################################
class TestSuite:
"""
@@ -38,59 +40,49 @@ class TestSuite:
For now, this contains the following information:
- Name
- Description
- - List of registered TestKinds
- Absolute path to the XML test list file
+ - How to invoke tests
+ - How to interpret tests results
+ - How to pass specific flags such as platform, quick mode, and so on.
- Dictionary of tests
"""
def __init__(self, xmlFile):
tree = ET.parse(xmlFile)
- xmlSuite = tree.getroot()
+ suiteElem = tree.getroot()
- self.name = xmlSuite.attrib['name']
- self.description = xmlSuite.attrib['description']
- self.testlist_file = path.abspath(path.join(path.dirname(xmlFile.name), xmlSuite.attrib['tests']))
- self.kinds = {}
- for xmlKind in xmlSuite[0]:
- self.kinds[xmlKind.attrib['tag']] = TestKind(xmlKind)
+ self.name = suiteElem.attrib['name']
+ self.description = suiteElem.attrib['description']
+ self.testlist_file = path.abspath(path.join(path.dirname(xmlFile.name), suiteElem.attrib['tests']))
- # Register the kinds...
- kinds.update(self.kinds)
+ resultElem = suiteElem.find('result')
- self.tests = {}
+ self.status_default = resultElem.attrib['default']
+ self.status_re = {}
+ for rx in resultElem:
+ self.status_re[rx.attrib['status']] = re.compile(rx.text)
-class TestKind:
- """
- Description of a class of tests (e.g. Piglit's ExecTest, GleanTest, ...).
+ # XXX: parse <platforms> and <quick>
- Robyn needs to know several facts about tests:
- - How to invoke them
- - How to interpret results
- - How to pass specific flags such as platform, quick mode, and so on.
+ self.tests = {}
- Test suites may register several different types of tests. In the
- JSON test list, the "type" tag indicates what kind of test it is.
- """
- def __init__(self, xmlKind):
- xmlResult = xmlKind.find('result')
+ def interpretResult(self, output):
+ """
+ Interpret a test's output and return its result status.
- self.default_result = xmlResult.attrib['default']
- self.regexs = {}
- for rx in xmlResult:
- self.regexs[rx.attrib['status']] = re.compile(rx.text)
+ Applies the suite's regular expressions to the output, seeing which
+ one matches. If none match, returns the suite's default status.
- # XXX: parse <platforms> and <quick>
+ The result will be either 'pass', 'fail', or 'skip'.
+ """
+ for status, re in self.status_re.items():
+ if re.search(output) is not None:
+ return status
- # 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
+ return self.status_default
- def interpretResult(self):
- #for status, re in self.regexs.items():
- #if re.search(out) is not None:
- #result = status
- #break
- result = self.default_result
+#############################################################################
+##### Configuration file reading
+#############################################################################
def availableSuites():
"""
@@ -102,7 +94,8 @@ def availableSuites():
Does not create TestSuite objects and populate the test suite information.
"""
# XXX: load list of available suites from ~/.robynrc or such
- return {'piglit': '/home/kwg/Projects/piglit/robyn-suite.xml'}
+ return {'piglit': '/home/kwg/Projects/piglit/robyn-piglit.xml',
+ 'glean': '/home/kwg/Projects/piglit/robyn-glean.xml'}
### [str] x bool -> {str -> TestSuite}
def loadSuiteInfo(desiredSuites, loadTests):