[Branch,~linaro-validation/lava-test/trunk] Rev 96: fix some tests that were not parsing correctly

Message ID 20110923085813.17987.17553.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Larson Sept. 23, 2011, 8:58 a.m.
------------------------------------------------------------
revno: 96
fixes bug: https://launchpad.net/bugs/857156
committer: Paul Larson <paul.larson@canonical.com>
branch nick: lava-test
timestamp: Fri 2011-09-23 03:56:22 -0500
message:
  fix some tests that were not parsing correctly
modified:
  lava_test/test_definitions/gtkperf.py
  lava_test/test_definitions/posixtestsuite.py


--
lp:lava-test
https://code.launchpad.net/~linaro-validation/lava-test/trunk

You are subscribed to branch lp:lava-test.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-test/trunk/+edit-subscription

Patch

=== modified file 'lava_test/test_definitions/gtkperf.py'
--- lava_test/test_definitions/gtkperf.py	2011-09-12 09:19:10 +0000
+++ lava_test/test_definitions/gtkperf.py	2011-09-23 08:56:22 +0000
@@ -27,14 +27,14 @@ 
 RUNSTEPS = ["LANG=C gtkperf %s" % gtkperf_options]
 
 class GtkTestParser(TestParser):
-    def parse(self):
+    def parse(self, artifacts):
         PAT1 = "^(?P<test_case_id>\w+) - (?P<subtest>\w*\W*\w*) - time:\W+(?P<measurement>\d+\.\d+)"
         PAT2 = "^(?P<test_case_id>\w+) - time:\W+(?P<measurement>\d+\.\d+)"
         filename = "testoutput.log"
         pat1 = re.compile(PAT1)
         pat2 = re.compile(PAT2)
         with open(filename) as fd:
-            for line in fd:
+            for lineno, line in enumerate(fd, 1):
                 match = pat1.search(line)
                 if match:
                     d = match.groupdict()
@@ -42,15 +42,21 @@ 
                         d['subtest'])
                     d.pop('subtest')
                     d['test_case_id'] = d['test_case_id'].replace(" ", "_")
-                    self.results['test_results'].append(d)
+                    d["log_filename"] = filename
+                    d["log_lineno"] = lineno
+                    self.results['test_results'].append(
+                        self.analyze_test_result(d))
                 else:
                     match = pat2.search(line)
                     if match:
-                        self.results['test_results'].append(match.groupdict())
-        self.appendtoall({'units':'seconds', 'result':'pass'})
-        self.fixmeasurements()
-
-parse = GtkTestParser()
+                        d = match.groupdict()
+                        d["log_filename"] = filename
+                        d["log_lineno"] = lineno
+                        self.results['test_results'].append(
+                            self.analyze_test_result(d))
+
+
+parse = GtkTestParser(appendall={'units':'seconds', 'result':'pass'})
 inst = TestInstaller(deps=["gtkperf"])
 run = TestRunner(RUNSTEPS)
 

=== modified file 'lava_test/test_definitions/posixtestsuite.py'
--- lava_test/test_definitions/posixtestsuite.py	2011-09-12 09:19:10 +0000
+++ lava_test/test_definitions/posixtestsuite.py	2011-09-23 08:56:22 +0000
@@ -51,19 +51,21 @@ 
 
 
 class PosixParser(TestParser):
-    def parse(self):
+    def parse(self, artifacts):
         filename = "testoutput.log"
         pat = re.compile(self.pattern)
         with open(filename) as fd:
-            for line in fd:
+            for lineno, line in enumerate(fd, 1):
                 match = pat.match(line)
-                if match:
-                    results = match.groupdict()
-                    test_case_id = results['test_case_id']
-                    results['test_case_id'] = test_case_id.replace("/", ".")
-                    self.results['test_results'].append(results)
-        if self.fixupdict:
-            self.fixresults(self.fixupdict)
+                if not match:
+                    continue
+                results = match.groupdict()
+                test_case_id = results['test_case_id']
+                results['test_case_id'] = test_case_id.replace("/", ".")
+                results["log_filename"] = "testoutput.log"
+                results["log_lineno"] = lineno
+                self.results['test_results'].append(
+                    self.analyze_test_result(results))
 
 posix_inst = TestInstaller(INSTALLSTEPS, deps=DEPS,
     url=URL, md5=MD5)