diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 453: [Bug #1079642] Fix for test definitions which does not have a parse pattern.

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

Commit Message

Senthil Kumaran Nov. 19, 2012, 1:44 p.m. UTC
Merge authors:
  Senthil Kumaran S (stylesen)
Related merge proposals:
  https://code.launchpad.net/~stylesen/lava-dispatcher/fix-empty-parse-pattern/+merge/134646
  proposed by: Senthil Kumaran S (stylesen)
  review: Approve - Andy Doan (doanac)
------------------------------------------------------------
revno: 453 [merge]
committer: Senthil Kumaran <senthil.kumaran@linaro.org>
branch nick: trunk
timestamp: Mon 2012-11-19 19:12:37 +0530
message:
  [Bug #1079642] Fix for test definitions which does not have a parse pattern.
modified:
  lava_dispatcher/lava_test_shell.py


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

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

Patch

=== modified file 'lava_dispatcher/lava_test_shell.py'
--- lava_dispatcher/lava_test_shell.py	2012-11-15 22:11:54 +0000
+++ lava_dispatcher/lava_test_shell.py	2012-11-19 13:38:33 +0000
@@ -117,12 +117,19 @@ 
 
 def _get_test_results(testdef, stdout):
     results = []
-
-    pattern = re.compile(testdef['parse']['pattern'])
-
     fixupdict = {}
-    if 'fixupdict' in testdef['parse']:
-        fixupdict = testdef['parse']['fixupdict']
+
+    if 'parse' in testdef:
+        if 'fixupdict' in testdef['parse']:
+            fixupdict = testdef['parse']['fixupdict']
+        if 'pattern' in testdef['parse']:
+            pattern = re.compile(testdef['parse']['pattern'])
+    else:
+        defpat = "(?P<test_case_id>.*-*)\\s+:\\s+(?P<result>(PASS|pass|FAIL|fail|SKIP|skip|UNKNOWN|unknown))"
+        pattern = re.compile(defpat)
+        fixupdict = {'PASS': 'pass', 'FAIL': 'fail', 'SKIP': 'skip',
+                     'UNKNOWN': 'unknown'}
+        logging.warning("""Using a default pattern to parse the test result. This may lead to empty test result in certain cases.""")
 
     for line in stdout.split('\n'):
         match = pattern.match(line.strip())