changeset 4219:47f7d91d34cf

Fix javac build issues with classpath WIP for benchmarks
author Gilles Duboscq <gilles.m.duboscq@gmail.com>
date Wed, 04 Jan 2012 22:54:27 +0100
parents 03eaec130ed1
children 26336f60ec7a
files mx/commands.py mx/outputparser.py mx/sanitycheck.py mxtool/mx.py
diffstat 4 files changed, 53 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/mx/commands.py	Wed Jan 04 19:58:51 2012 +0100
+++ b/mx/commands.py	Wed Jan 04 22:54:27 2012 +0100
@@ -313,10 +313,10 @@
         os.environ.update(ARCH_DATA_MODEL='64', LANG='C', HOTSPOT_BUILD_JOBS='3', ALT_BOOTDIR=jdk, INSTALL='y')
         mx.run([mx.gmake_cmd(), build + 'graal'], cwd=join(_graal_home, 'make'), err=filterXusage)
     
-def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None):
+def vm(args, vm='-graal', nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
     """run the GraalVM"""
-  
-    build = _vmbuild if _vmSourcesAvailable else 'product'
+
+    build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
     if mx.java().debug:
         args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000'] + args
     exe = join(_jdk(build), 'bin', mx.exe_suffix('java'))
@@ -570,9 +570,17 @@
     mx.log(time.strftime('%d %b %Y %H:%M:%S - Gate done (duration - ' + str(duration) + ')'))
 
 def bench(args):
+    results = {}
+    #DaCapo
+    benchmarks = sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Benchmark)
+    #Bootstrap
+    benchmarks += sanitycheck.getBootstraps()
     
-    for test in sanitycheck.getDacapos(level=sanitycheck.SanityCheckLevel.Fast):
-        print test.bench('-graal')
+    for test in benchmarks:
+        if not results.has_key(test.group):
+            results[test.group] = {}
+        results[test.group].update(test.bench('-graal'))
+    print results
     
 def mx_init():
     _vmbuild = 'product'
--- a/mx/outputparser.py	Wed Jan 04 19:58:51 2012 +0100
+++ b/mx/outputparser.py	Wed Jan 04 22:54:27 2012 +0100
@@ -10,7 +10,7 @@
     def addMatcher(self, matcher):
         self.matchers.append(matcher)
     
-    def parse(self, vm, cmd, cwd=None):
+    def parse(self, vm, cmd, cwd=None, vmbuild=None):
         ret = [{}]
         
         def parseLine(line):
@@ -27,7 +27,7 @@
             else :
                 mx.log( line.rstrip())
         
-        retcode = commands.vm(cmd, nonZeroIsFatal=self.nonZeroIsFatal, out=parseLine, err=parseLine, cwd=cwd)
+        retcode = commands.vm(cmd, vm, nonZeroIsFatal=self.nonZeroIsFatal, out=parseLine, err=parseLine, cwd=cwd, vmbuild=vmbuild)
         return {'parsed' : ret, 'retcode' : retcode}
 
 class Matcher:
--- a/mx/sanitycheck.py	Wed Jan 04 19:58:51 2012 +0100
+++ b/mx/sanitycheck.py	Wed Jan 04 22:54:27 2012 +0100
@@ -6,24 +6,28 @@
 from os.path import isfile
 
 dacapoSanityWarmup = {
-    'avrora': [0, 0, 3, 6],
-    'batik': [0 , 0, 5, 5],
-    'eclipse': [2 , 4, 5, 10],
-    'fop': [4 , 8, 10, 20],
-    'h2': [0 , 0, 5, 5],
-    'jython': [0 , 0, 5, 10],
-    'luindex': [0 , 0, 5, 10],
-    'lusearch': [0 , 4, 5, 10],
-    'pmd': [0 , 0, 5, 10],
-    'sunflow': [0 , 0, 5, 10],
-    'tomcat': [0 , 0, 5, 10],
-    'tradebeans': [0 , 0, 5, 10],
-    'tradesoap': [2 , 4, 5, 10],
-    'xalan': [0 , 0, 5, 10],
+    'avrora': [0, 0, 3, 6, 10],
+    'batik': [0 , 0, 5, 5, 20],
+    'eclipse': [2 , 4, 5, 10, 13],
+    'fop': [4 , 8, 10, 20, 30],
+    'h2': [0 , 0, 5, 5, 5],
+    'jython': [0 , 0, 5, 10, 10],
+    'luindex': [0 , 0, 5, 10, 10],
+    'lusearch': [0 , 4, 5, 5, 5],
+    'pmd': [0 , 0, 5, 10, 10],
+    'sunflow': [0 , 0, 5, 10, 15],
+    'tomcat': [0 , 0, 5, 10, 10],
+    'tradebeans': [0 , 0, 5, 10, 10],
+    'tradesoap': [2 , 4, 5, 10, 10],
+    'xalan': [0 , 0, 5, 10, 15],
 }
 
 class SanityCheckLevel:
-    Fast, Gate, Normal, Extensive = range(4)
+    Fast, Gate, Normal, Extensive, Benchmark = range(5)
+    
+def getSPECjvm2008():
+    score = re.compile(r"^((Score on|Noncompliant) )?(?P<benchmark>[a-zA-Z0-9\.-]+)( result)?: (?P<score>[0-9]+,[0-9]+)( SPECjvm2008 Base)? ops/m$")
+    matcher = Matcher(score, {'const:name' : 'benchmark', 'const:score' : 'score'})
 
 def getDacapos(level=SanityCheckLevel.Normal, dacapoArgs=[]):
     checks = []
@@ -50,6 +54,14 @@
     
     return Test("DaCapo-" + name, "DaCapo", ['-jar', dacapo, name, '-n', str(n), ] + dacapoArgs, [dacapoSuccess], [dacapoFail], [dacapoMatcher], ['-Xms1g', '-Xmx2g', '-XX:MaxPermSize=256m'])
 
+def getBootstraps():
+    time = re.compile(r"Bootstrapping Graal............... in (?P<time>[0-9]+) ms")
+    scoreMatcher = Matcher(time, {'const:name' : 'const:BootstrapTime', 'const:score' : 'time'})
+    tests = []
+    tests.append(Test("Bootstrap", "Bootstrap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher]))
+    tests.append(Test("Bootstrap", "Bootstrap-bigHeap", ['-version'], succesREs=[time], scoreMatchers=[scoreMatcher], vmOpts=['-Xms2g']))
+    return tests
+
 class Test:
     def __init__(self, name, group, cmd, succesREs=[], failureREs=[], scoreMatchers=[], vmOpts=[]):
         self.name = name
@@ -60,7 +72,7 @@
         self.vmOpts = vmOpts
         self.cmd = cmd
     
-    def test(self, vm, cwd=None, opts=[]):
+    def test(self, vm, cwd=None, opts=[], vmbuild=None):
         parser = OutputParser(nonZeroIsFatal = False)
         jvmError = re.compile(r"(?P<jvmerror>([A-Z]:|/).*[/\\]hs_err_pid[0-9]+\.log)")
         parser.addMatcher(Matcher(jvmError, {'const:jvmError' : 'jvmerror'}))
@@ -70,7 +82,7 @@
         for failureRE in self.failureREs:
             parser.addMatcher(Matcher(failureRE, {'const:failed' : 'const:1'}))
         
-        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd)
+        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
         
         parsedLines = result['parsed']
         assert len(parsedLines) == 1, 'Test matchers should not return more than one line'
@@ -91,13 +103,13 @@
         
         return result['retcode'] is 0 and parsed.has_key('passed') and parsed['passed'] is '1'
     
-    def bench(self, vm, cwd=None, opts=[]):
+    def bench(self, vm, cwd=None, opts=[], vmbuild=None):
         parser = OutputParser(nonZeroIsFatal = False)
         
         for scoreMatcher in self.scoreMatchers:
             parser.addMatcher(scoreMatcher)
             
-        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd)
+        result = parser.parse(vm, self.vmOpts + opts + self.cmd, cwd, vmbuild)
         if result['retcode'] is not 0:
             return {}
         
--- a/mxtool/mx.py	Wed Jan 04 19:58:51 2012 +0100
+++ b/mxtool/mx.py	Wed Jan 04 22:54:27 2012 +0100
@@ -134,7 +134,7 @@
         self.native = False
         self.dir = dir
         
-    def all_deps(self, deps, includeLibs):
+    def all_deps(self, deps, includeLibs, includeSelf=True):
         """
         Add the transitive set of dependencies for this project, including
         libraries if 'includeLibs' is true, to the 'deps' list.
@@ -151,7 +151,7 @@
                 dep = project(name)
                 if not dep in deps:
                     dep.all_deps(deps, includeLibs)
-        if not self in deps:
+        if not self in deps and includeSelf:
             deps.append(self)
         return deps
     
@@ -416,7 +416,7 @@
         cp += [_opts.cp_suffix]
     return os.pathsep.join(cp)
 
-def classpath(names=None, resolve=True):
+def classpath(names=None, resolve=True, includeSelf=True):
     """
     Get the class path for a list of given projects, resolving each entry in the
     path (e.g. downloading a missing library) if 'resolve' is true.
@@ -425,10 +425,10 @@
         return _as_classpath(sorted_deps(True), resolve)
     deps = []
     if isinstance(names, types.StringTypes):
-        project(names).all_deps(deps, True)
+        project(names).all_deps(deps, True, includeSelf)
     else:
         for n in names:
-            project(n).all_deps(deps, True)
+            project(n).all_deps(deps, True, includeSelf)
     return _as_classpath(deps, resolve)
     
 def sorted_deps(includeLibs=False):
@@ -833,7 +833,7 @@
         else:
             os.mkdir(outputDir)
 
-        cp = classpath(p.name)
+        cp = classpath(p.name, includeSelf=False)
         sourceDirs = p.source_dirs()
         mustBuild = args.force
         if not mustBuild:
@@ -890,7 +890,7 @@
                                 elif self.c != 0:
                                     self.c -= 1
                                 else:
-                                    print line.rstrip()
+                                    log(line.rstrip())
                         errFilt=Filter().eat
                         
                     run([java().javac, '-g', '-J-Xmx1g', '-source', args.compliance, '-classpath', cp, '-d', outputDir, '@' + argfile.name], err=errFilt)