diff mx/outputparser.py @ 4215:a2caa019ba3a

Fix mx : commands' scripts mx_init hook should be called before parsing command line arguments. Fix mx : call the mx_post_parse_cmd_line hook from commands' scripts OutputParser : cosmetic changes to logged output, return the retcode along yith the parsed output Add a new Test class representing a sanity check and/or a benchmark Port dacapo command to use this class, begning work on benchmarks
author Gilles Duboscq <gilles.m.duboscq@gmail.com>
date Wed, 04 Jan 2012 13:52:46 +0100
parents cb22fcb2e2fc
children 47f7d91d34cf
line wrap: on
line diff
--- a/mx/outputparser.py	Tue Jan 03 18:47:27 2012 -0800
+++ b/mx/outputparser.py	Wed Jan 04 13:52:46 2012 +0100
@@ -10,26 +10,25 @@
     def addMatcher(self, matcher):
         self.matchers.append(matcher)
     
-    def parse(self, cmd, cwd=None):
+    def parse(self, vm, cmd, cwd=None):
         ret = [{}]
         
         def parseLine(line):
-            line = line.strip()
             anyMatch = False
             for matcher in self.matchers:
-                parsed = matcher.parse(line)
+                parsed = matcher.parse(line.strip())
                 if parsed:
                     anyMatch = True
                     if matcher.startNewLine and len(ret[0]) > 0:
                         ret.append({})
                     ret[len(ret)-1].update(parsed)
             if anyMatch :
-                mx.log(line)
+                mx.log('>' + line.rstrip())
             else :
-                mx.log('# ' + line)
+                mx.log( line.rstrip())
         
-        commands.vm(cmd, nonZeroIsFatal=self.nonZeroIsFatal, out=parseLine, err=parseLine, cwd=cwd)
-        return ret
+        retcode = commands.vm(cmd, nonZeroIsFatal=self.nonZeroIsFatal, out=parseLine, err=parseLine, cwd=cwd)
+        return {'parsed' : ret, 'retcode' : retcode}
 
 class Matcher: