author | sundar |
Mon, 20 May 2013 23:04:01 +0530 | |
changeset 17757 | 892b9873e831 |
parent 17749 | 0f0fad887be7 |
child 18855 | 408663ef8f66 |
permissions | -rw-r--r-- |
16255 | 1 |
<?xml version="1.0" encoding="UTF-8"?> |
2 |
<!-- |
|
3 |
Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
|
4 |
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
||
6 |
This code is free software; you can redistribute it and/or modify it |
|
7 |
under the terms of the GNU General Public License version 2 only, as |
|
8 |
published by the Free Software Foundation. |
|
9 |
||
10 |
This code is distributed in the hope that it will be useful, but WITHOUT |
|
11 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
12 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
13 |
version 2 for more details (a copy is included in the LICENSE file that |
|
14 |
accompanied this code). |
|
15 |
||
16 |
You should have received a copy of the GNU General Public License version |
|
17 |
2 along with this work; if not, write to the Free Software Foundation, |
|
18 |
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
19 |
||
20 |
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
21 |
or visit www.oracle.com if you need additional information or have any |
|
22 |
questions. |
|
23 |
--> |
|
24 |
<project name="code-coverage" default="generate-code-coverage-report" basedir=".."> |
|
25 |
||
26 |
<!-- CODE COVERAGE --> |
|
27 |
<target name="init-cc-enabled" if="${cc.enabled}"> |
|
28 |
||
29 |
<echo message="initialize [${jcov}] java coverage"/> |
|
30 |
||
31 |
||
32 |
<property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/> |
|
33 |
<property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/> |
|
34 |
||
35 |
<condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}"> |
|
36 |
<equals arg1="${jcov}" arg2="dynamic" trim="true"/> |
|
37 |
</condition> |
|
38 |
||
16529 | 39 |
<condition property="cc.generate.template" value="true"> |
40 |
<equals arg1="${cc.dynamic.genereate.template}" arg2="true" trim="true"/> |
|
41 |
</condition> |
|
42 |
||
16255 | 43 |
<mkdir dir="${cc.dir}"/> |
16529 | 44 |
<mkdir dir="${build.dir}/to_be_instrumented"/> |
16255 | 45 |
|
46 |
<!-- info --> |
|
47 |
<echo message="jcov=${jcov}"/> |
|
48 |
<echo message="cc.generate.template=${cc.generate.template}"/> |
|
49 |
<echo message="cc.instrument=${cc.instrument}"/> |
|
50 |
<echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/> |
|
51 |
<echo message="cc.report.dir=${cc.report.dir}"/> |
|
52 |
<echo message="cc.merged.xml=${cc.merged.xml}"/> |
|
53 |
</target> |
|
54 |
||
55 |
<target name="init-cc-disabled" unless="${cc.enabled}"> |
|
56 |
<property name="run.test.cc.jvmargs" value=""/> |
|
57 |
</target> |
|
58 |
||
16529 | 59 |
<target name="prepare-to-be-instrumented" depends="compile" description="Prepares to_be_instrumented dir"> |
60 |
<copy todir="${build.dir}/to_be_instrumented"> |
|
61 |
<fileset dir="${build.classes.dir}"> |
|
62 |
<include name="**/*.class"/> |
|
63 |
<include name="**/*.clazz"/> |
|
64 |
</fileset> |
|
65 |
</copy> |
|
66 |
||
67 |
<move todir="${build.dir}/to_be_instrumented/jdk/nashorn/internal/objects"> |
|
68 |
<fileset dir="${build.dir}/to_be_instrumented/jdk/nashorn/internal/objects"> |
|
69 |
<include name="**/*.clazz"/> |
|
70 |
</fileset> |
|
71 |
<mapper type="glob" from="*.clazz" to="*.class"/> |
|
72 |
</move> |
|
73 |
</target> |
|
74 |
||
75 |
<target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template"> |
|
76 |
<property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/> |
|
77 |
<java classname="com.sun.tdk.jcov.TmplGen"> |
|
78 |
<arg value="-verbose"/> |
|
79 |
<arg line="-include ${cc.include}"/> |
|
80 |
<arg line="-type all"/> |
|
81 |
<arg line="-template ${cc.template}"/> |
|
82 |
<arg value="${cc.instrumented.path}"/> |
|
83 |
<classpath> |
|
84 |
<pathelement location="${jcov.jar}"/> |
|
85 |
</classpath> |
|
86 |
</java> |
|
87 |
||
88 |
<java classname="com.sun.tdk.jcov.RepGen"> |
|
89 |
<arg value="-verbose"/> |
|
90 |
<arg line="-output ${cc.dir}/CC_template_report"/> |
|
91 |
<arg value="${cc.template}"/> |
|
92 |
<classpath> |
|
93 |
<pathelement location="${jcov.jar}"/> |
|
94 |
</classpath> |
|
95 |
</java> |
|
96 |
</target> |
|
97 |
||
16255 | 98 |
<target name="init-cc" depends="init-cc-disabled, init-cc-enabled"> |
99 |
<property name="run.test.cc.jvmargs" value=""/> |
|
100 |
</target> |
|
101 |
||
102 |
<target name="init-cc-cleanup" if="${cc.enabled}"> |
|
103 |
<delete dir="${cc.dir}" failonerror="false" /> |
|
16529 | 104 |
<delete dir="${build.dir}/to_be_instrumented" failonerror="false" /> |
16255 | 105 |
</target> |
106 |
||
107 |
<target name="check-merging-files" depends="init"> |
|
16529 | 108 |
<echo message="checking avalibility of ${cc.template}"/> |
16255 | 109 |
<condition property="nothing-to-merge" value="true"> |
16529 | 110 |
<not> |
111 |
<available file="${cc.template}"/> |
|
112 |
</not> |
|
16255 | 113 |
</condition> |
16529 | 114 |
<echo message="nothing-to-merge = ${nothing-to-merge}"/> |
16255 | 115 |
</target> |
116 |
||
117 |
<target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}"> |
|
16529 | 118 |
<echo message="making pre-merge workaround due to missed template"/> |
16255 | 119 |
<move todir="${cc.dir}" includeemptydirs="false"> |
120 |
<fileset dir="${cc.dir}"> |
|
121 |
<include name="*.xml"/> |
|
122 |
</fileset> |
|
123 |
<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/> |
|
124 |
</move> |
|
125 |
</target> |
|
126 |
||
127 |
<target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}"> |
|
128 |
<echo message="merging files"/> |
|
129 |
<fileset dir="${cc.dir}" id="cc.xmls"> |
|
16529 | 130 |
<include name="**/*_${jcov}_*.xml"/> |
16255 | 131 |
<include name="**/CC_template.xml"/> |
132 |
</fileset> |
|
133 |
||
134 |
<pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/> |
|
16529 | 135 |
<echo message="merging files - ${cc.all.xmls}" /> |
16255 | 136 |
<java classname="com.sun.tdk.jcov.Merger"> |
137 |
<arg value="-verbose"/> |
|
138 |
<arg value="-output"/> |
|
139 |
<arg value="${cc.merged.xml}"/> |
|
140 |
<arg value="-exclude"/> |
|
141 |
<arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/> |
|
17742
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
142 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
143 |
<arg value="jdk\.nashorn\.internal\.javaadapters*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
144 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
145 |
<arg value="jdk\.nashorn\.internal\.objects\.annotations*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
146 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
147 |
<arg value="jdk\.nashorn\.internal\.scripts*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
148 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
149 |
<arg value="jdk\.nashorn\.internal\.lookup\.MethodHandleFactory*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
150 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
151 |
<arg value="jdk\.nashorn\.internal\.test\.framework*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
152 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
153 |
<arg value="jdk\.nashorn\.test\.models*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
154 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
155 |
<arg value="jdk\.nashorn\.internal\.ir\.debug*"/> |
17749
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
156 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
157 |
<arg value="jdk\.nashorn\.internal\.runtime\.regexp\.joni\.bench*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
158 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
159 |
<arg value="jdk\.nashorn\.internal\.runtime\.DebugLogger*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
160 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
161 |
<arg value="jdk\.nashorn\.internal\.runtime\.Timing*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
162 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
163 |
<arg value="jdk\.nashorn\.internal\.runtime\.Logging*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
164 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
165 |
<arg value="jdk\.nashorn\.internal\.runtime\.Debug*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
166 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
167 |
<arg value="jdk\.nashorn\.internal\.objects\.NativeDebug*"/> |
16255 | 168 |
<arg line="${cc.all.xmls}"/> |
169 |
<classpath> |
|
170 |
<pathelement location="${jcov.jar}"/> |
|
171 |
</classpath> |
|
172 |
</java> |
|
173 |
||
174 |
</target> |
|
175 |
||
176 |
<target name="generate-code-coverage-report" depends="merge-code-coverage"> |
|
177 |
<java classname="com.sun.tdk.jcov.RepGen"> |
|
178 |
<arg value="-verbose"/> |
|
179 |
<!-- <arg line ="-exclude_list CC.report.exclude"/> --> |
|
180 |
<arg line="-output ${cc.report.dir}"/> |
|
181 |
<arg value="${cc.merged.xml}"/> |
|
182 |
<classpath> |
|
183 |
<pathelement location="${jcov.jar}"/> |
|
184 |
</classpath> |
|
185 |
</java> |
|
186 |
</target> |
|
187 |
||
188 |
||
189 |
</project> |