[llvm-commits] [zorg] r147992 - in /zorg/trunk/lnt: lnt/server/db/testsuitedb.py tests/server/db/ImportV4TestSuiteInstance.py

Daniel Dunbar daniel at zuster.org
Wed Jan 11 17:27:21 PST 2012


Author: ddunbar
Date: Wed Jan 11 19:27:21 2012
New Revision: 147992

URL: http://llvm.org/viewvc/llvm-project?rev=147992&view=rev
Log:
[lnt/v0.4] lnt.server.db.testsuitedb: Fix import to properly remove mangled
schema name in tests.
 - <rdar://problem/10676737> [lnt/v0.4] Fix imports to properly strip leading
   mangled schema name

Modified:
    zorg/trunk/lnt/lnt/server/db/testsuitedb.py
    zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py

Modified: zorg/trunk/lnt/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuitedb.py?rev=147992&r1=147991&r2=147992&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Wed Jan 11 19:27:21 2012
@@ -506,10 +506,12 @@
 
             return run,True
 
-    def _importSampleValues(self, tests_data, run):
+    def _importSampleValues(self, tests_data, run, tag):
         # We now need to transform the old schema data (composite samples split
-        # into multiple tests) into the V4DB format where each sample is a
-        # complete record.
+        # into multiple tests with mangling) into the V4DB format where each
+        # sample is a complete record.
+        tag_dot = "%s." % tag
+        tag_dot_len = len(tag_dot)
 
         # Load a map of all the tests, which we will extend when we find tests
         # that need to be added.
@@ -531,6 +533,11 @@
 test parameter sets are not supported by V4DB databases"""
 
             name = test_data['Name']
+            if not name.startswith(tag_dot):
+                raise ValueError,"""\
+test %r is misnamed for reporting under schema %r""" % (
+                    name, tag)
+            name = name[tag_dot_len:]
 
             # Map this reported test name into a test name and a sample field.
             #
@@ -578,12 +585,15 @@
         # Construct the run entry.
         run,inserted = self._getOrCreateRun(data['Run'], machine)
 
+        # Get the schema tag.
+        tag = data['Run']['Info']['tag']
+
         # If we didn't construct a new run, this is a duplicate
         # submission. Return the prior Run.
         if not inserted:
             return False, run
 
-        self._importSampleValues(data['Tests'], run)
+        self._importSampleValues(data['Tests'], run, tag)
 
         return True, run
 

Modified: zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py?rev=147992&r1=147991&r2=147992&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py (original)
+++ zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py Wed Jan 11 19:27:21 2012
@@ -53,7 +53,7 @@
 assert xfail_kind.name == "XFAIL"
 
 # Load the imported test suite.
-ts = db.testsuite['nt']
+ts = db.testsuite['nts']
 
 # Validate the machine.
 machines = list(ts.query(ts.Machine))
@@ -70,7 +70,7 @@
 tests = list(ts.query(ts.Test))
 assert len(tests) == 1
 test = tests[0]
-assert tests[0].name == 'nts.sampletest'
+assert tests[0].name == 'sampletest'
 
 # Validate the orders.
 orders = list(ts.query(ts.Order).order_by(ts.Order.ordinal))





More information about the llvm-commits mailing list