changeset 18888:31960077ea9d

Specify jacoco project includes/excludes in suite.py
author Paul Woegerer <paul.woegerer@oracle.com>
date Wed, 21 Jan 2015 12:02:35 +0100
parents 19d99eec8876
children 4dc7b1f66de3
files mx/mx_graal.py mx/suite.py
diffstat 2 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mx/mx_graal.py	Wed Jan 21 11:43:22 2015 +0100
+++ b/mx/mx_graal.py	Wed Jan 21 12:02:35 2015 +0100
@@ -1023,8 +1023,15 @@
         jacocoagent = mx.library("JACOCOAGENT", True)
         # Exclude all compiler tests and snippets
 
-        baseExcludes = ['com.oracle.graal.compiler.test', 'com.oracle.graal.jtt', 'com.oracle.graal.api.meta.test', 'com.oracle.truffle.api.test', \
-                'com.oracle.truffle.api.dsl.test', 'com.oracle.graal.truffle', 'com.oracle.graal.truffle.test', 'com.oracle.graal.compiler.hsail.test']
+        includes = ['com.oracle.graal.*']
+        baseExcludes = []
+        for p in mx.projects():
+            projsetting = getattr(p, 'jacoco', '')
+            if projsetting == 'exclude':
+                baseExcludes.append(p.name)
+            if projsetting == 'include':
+                includes.append(p.name + '.*')
+
         def _filter(l):
             # filter out specific classes which are already covered by a baseExclude package
             return [clazz for clazz in l if not any([clazz.startswith(package) for package in baseExcludes])]
@@ -1034,7 +1041,6 @@
             excludes += _filter(p.find_classes_with_matching_source_line(None, lambda line: 'JaCoCo Exclude' in line, includeInnerClasses=True).keys())
 
         excludes += [package + '.*' for package in baseExcludes]
-        includes = ['com.oracle.graal.*']
         agentOptions = {
                         'append' : 'true' if _jacoco == 'append' else 'false',
                         'bootclasspath' : 'true',
@@ -2133,7 +2139,25 @@
         out = args[0]
     elif len(args) > 1:
         mx.abort('jacocoreport takes only one argument : an output directory')
-    mx.run_java(['-jar', jacocoreport.get_path(True), '--in', 'jacoco.exec', '--out', out] + [p.dir for p in mx.projects()])
+
+    includes = ['com.oracle.graal']
+    for p in mx.projects():
+        projsetting = getattr(p, 'jacoco', '')
+        if projsetting == 'include':
+            includes.append(p.name)
+
+    includedirs = set()
+    for p in mx.projects():
+        for include in includes:
+            if include in p.dir:
+                includedirs.add(p.dir)
+
+    for i in includedirs:
+        bindir = i + '/bin'
+        if not os.path.exists(bindir):
+            os.makedirs(bindir)
+
+    mx.run_java(['-jar', jacocoreport.get_path(True), '--in', 'jacoco.exec', '--out', out] + sorted(includedirs))
 
 def sl(args):
     """run an SL program"""
--- a/mx/suite.py	Wed Jan 21 11:43:22 2015 +0100
+++ b/mx/suite.py	Wed Jan 21 12:02:35 2015 +0100
@@ -246,6 +246,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "API,Graal,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.api.code" : {
@@ -626,6 +627,7 @@
         "com.oracle.graal.service.processor",
       ],
       "workingSets" : "Graal,Replacements",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.replacements.amd64" : {
@@ -660,6 +662,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Replacements,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.replacements.verifier" : {
@@ -940,6 +943,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.jtt" : {
@@ -952,6 +956,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.asm" : {
@@ -1059,6 +1064,7 @@
       ],
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.asm.hsail" : {
@@ -1113,6 +1119,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.7",
       "workingSets" : "API,Truffle,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.truffle.api.dsl" : {
@@ -1135,6 +1142,7 @@
       "javaCompliance" : "1.7",
       "annotationProcessors" : ["com.oracle.truffle.dsl.processor"],
       "workingSets" : "API,Truffle,Codegen,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.truffle.dsl.processor" : {
@@ -1219,6 +1227,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Truffle",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.truffle.test" : {
@@ -1232,6 +1241,7 @@
       "checkstyle" : "com.oracle.graal.graph",
       "javaCompliance" : "1.8",
       "workingSets" : "Graal,Truffle,Test",
+      "jacoco" : "exclude",
     },
 
     "com.oracle.graal.truffle.hotspot" : {