[llvm-commits] [zorg] r147996 - in /zorg/trunk/lnt: lnt/server/db/testsuitedb.py tests/server/db/ImportV4TestSuiteInstance.py tests/server/db/Inputs/sample-a-small.plist

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


Author: ddunbar
Date: Wed Jan 11 19:27:33 2012
New Revision: 147996

URL: http://llvm.org/viewvc/llvm-project?rev=147996&view=rev
Log:
[lnt/v0.4] lnt.server.db.testsuitedb: Fix a serious bug importing runs with multiple samples per test.
 - In turns out my assumption that we didn't use one way of reporting multiple samples was completely bogus. We want to support both ways, at least for now. See the comments for more information.
 - <rdar://problem/10669625> [lnt/v0.4] failure to import multiple samples with multisampling (N=3)

Modified:
    zorg/trunk/lnt/lnt/server/db/testsuitedb.py
    zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py
    zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist

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=147996&r1=147995&r2=147996&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Wed Jan 11 19:27:33 2012
@@ -508,15 +508,11 @@
         test_cache = dict((test.name, test)
                           for test in self.query(self.Test))
 
-        # We build a map of test name to sample values, by scanning all the
-        # tests. This is complicated by the interchange's support of multiple
-        # values, which we cannot properly aggregate. We handle this by keying
-        # off of the test name and the sample index.
-        #
-        # Note that the above strategy only works if reports don't report the
-        # same test name multiple times. That was possible in the schema, but I
-        # believe never used.
-        sample_records = {}
+        # First, we aggregate all of the samples by test name. The schema allows
+        # reporting multiple values for a test in two ways, one by multiple
+        # samples and the other by multiple test entries with the same test
+        # name. We need to handle both.
+        tests_values = {}
         for test_data in tests_data:
             if test_data['Info']:
                 raise ValueError,"""\
@@ -529,6 +525,19 @@
                     name, tag)
             name = name[tag_dot_len:]
 
+            # Add all the values.
+            values = tests_values.get(name)
+            if values is None:
+                tests_values[name] = values = []
+
+            values.extend(test_data['Data'])
+
+        # Next, build a map of test name to sample values, by scanning all the
+        # tests. This is complicated by the interchange's support of multiple
+        # values, which we cannot properly aggregate. We handle this by keying
+        # off of the test name and the sample index.
+        sample_records = {}
+        for name,test_samples in tests_values.items():
             # Map this reported test name into a test name and a sample field.
             #
             # FIXME: This is really slow.
@@ -549,10 +558,10 @@
                 test_cache[test_name] = test = self.Test(test_name)
                 self.add(test)
 
-            for i,value in enumerate(test_data['Data']):
+            for i,value in enumerate(test_samples):
                 record_key = (test_name, i)
-                record = sample_records.get(record_key)
-                if record is None:
+                sample = sample_records.get(record_key)
+                if sample is None:
                     sample_records[record_key] = sample = self.Sample(run, test)
                     self.add(sample)
 

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=147996&r1=147995&r2=147996&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py (original)
+++ zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py Wed Jan 11 19:27:33 2012
@@ -12,7 +12,7 @@
 # IMPORT-A-1: Added Machines: 1
 # IMPORT-A-1: Added Runs : 1
 # IMPORT-A-1: Added Tests : 1
-# IMPORT-A-1: Added Samples : 1
+# IMPORT-A-1: Added Samples : 2
 
 # Import the second test set.
 # RUN: lnt import %t.install %S/Inputs/sample-b-small.plist \
@@ -102,16 +102,25 @@
 
 # Validate the samples.
 samples = list(ts.query(ts.Sample))
-assert len(samples) == 2
-sample_a,sample_b = samples
-assert sample_a.run is run_a
+assert len(samples) == 3
+sample_a_0,sample_a_1,sample_b = samples
+assert sample_a_0.run is run_a
+assert sample_a_1.run is run_a
 assert sample_b.run is run_b
-assert sample_a.test is test
+assert sample_a_0.test is test
+assert sample_a_1.test is test
 assert sample_b.test is test
-assert sample_a.compile_time == 0.019
-assert sample_a.compile_status == lnt.testing.PASS
-assert sample_a.execution_time == 0.3
-assert sample_a.execution_status == lnt.testing.PASS
+print sample_a_0
+print sample_a_1
+print sample_b
+assert sample_a_0.compile_time == 0.019
+assert sample_a_0.compile_status == lnt.testing.PASS
+assert sample_a_0.execution_time == 0.3
+assert sample_a_0.execution_status == lnt.testing.PASS
+assert sample_a_1.compile_time == 0.0189
+assert sample_a_1.compile_status == lnt.testing.PASS
+assert sample_a_1.execution_time == 0.29
+assert sample_a_1.execution_status == lnt.testing.PASS
 assert sample_b.compile_time == 0.022
 assert sample_b.compile_status == lnt.testing.PASS
 assert sample_b.execution_time == 0.32

Modified: zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist?rev=147996&r1=147995&r2=147996&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist (original)
+++ zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist Wed Jan 11 19:27:33 2012
@@ -76,6 +76,29 @@
 			<key>Name</key>
 			<string>nts.sampletest.exec</string>
 		</dict>
+
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.0189</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nts.sampletest.compile</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.29</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nts.sampletest.exec</string>
+		</dict>
 	</array>
 </dict>
 </plist>





More information about the llvm-commits mailing list