summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2013-02-06 10:00:55 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2013-02-11 15:22:36 +1000
commit5af089fedbb1a27fea3ff27e966aa28d8545a153 (patch)
treeef0b7838601fd3c887c3b790e0db319e550b8e29
parentb0bcd02cb01c18cfc2d0673b45bbc006a1f477a8 (diff)
registry: hook up verify to multiple registries handling
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rwxr-xr-xregistry/xit-bug-registry-test11
-rw-r--r--registry/xit.py20
2 files changed, 24 insertions, 7 deletions
diff --git a/registry/xit-bug-registry-test b/registry/xit-bug-registry-test
index 7668d48..3087189 100755
--- a/registry/xit-bug-registry-test
+++ b/registry/xit-bug-registry-test
@@ -329,7 +329,7 @@ class TestXITTestRegistry(unittest.TestCase):
class TestXITTestRegistryCLI(unittest.TestCase):
EXIT_GENERAL_FAILURE = 1
EXIT_TOO_FEW_ARGS_ERROR_CODE = 2
- RESULTS_FILE = "../server-results.xml"
+ RESULTS_FILE = "../server.xml"
def setUp(self):
@@ -453,11 +453,12 @@ class TestXITTestRegistryCLI(unittest.TestCase):
self.cli.run(args + ["--auto-modversion", "rpm", self.RESULTS_FILE])
def test_verify(self):
- args = self.args
- args.append("verify")
+ self.cli.run(self.args + ["verify", self.RESULTS_FILE])
+ self.cli.run(self.args + ["verify", "--check-all", self.RESULTS_FILE])
- self.cli.run(args + [self.RESULTS_FILE])
- self.cli.run(args + ["--check-all", self.RESULTS_FILE])
+ with self.assertRaises(SystemExit) as e:
+ self.cli.run(self.args + ["-r", "evdev", "verify", "--check-all", self.RESULTS_FILE])
+ self.assertEquals(e.exception.code, self.EXIT_GENERAL_FAILURE);
if __name__ == '__main__':
unittest.main()
diff --git a/registry/xit.py b/registry/xit.py
index 2b29dc7..9b43565 100644
--- a/registry/xit.py
+++ b/registry/xit.py
@@ -623,8 +623,24 @@ class XITTestRegistryCLI:
def verify_results(self, args):
- """Verify a JUnit test result against the XIT test registry"""
- registry = self.load_one_registry(args)
+ """Verify a JUnit test result against the XIT test registry.
+ If a registry name is given, compare to that. If none is given
+ and there is more than one registry, search for one named the
+ same as the results file. Otherwise, bail out."""
+ registry = None
+ registries = self.load_registries(args)
+ if not args.regname:
+ regname = os.path.basename(args.results).split(".xml")[0]
+ for r in registries:
+ if r.name == regname:
+ registry = r
+ break
+ if registry == None:
+ logging.error("Failed to match %s with a registry." % args.results)
+ sys.exit(1)
+ else:
+ registry = registries[0]
+
results = JUnitTestResult.fromXML(args.results)
sname_len = 0