author | vlivanov |
Thu, 18 Jan 2018 02:25:18 +0300 | |
changeset 48596 | 860326263d1f |
parent 47216 | 71c04702a3d5 |
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 |
</fileset> |
|
64 |
</copy> |
|
65 |
</target> |
|
66 |
||
67 |
<target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template"> |
|
68 |
<property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/> |
|
69 |
<java classname="com.sun.tdk.jcov.TmplGen"> |
|
70 |
<arg value="-verbose"/> |
|
71 |
<arg line="-include ${cc.include}"/> |
|
72 |
<arg line="-type all"/> |
|
73 |
<arg line="-template ${cc.template}"/> |
|
74 |
<arg value="${cc.instrumented.path}"/> |
|
75 |
<classpath> |
|
76 |
<pathelement location="${jcov.jar}"/> |
|
77 |
</classpath> |
|
78 |
</java> |
|
79 |
||
80 |
<java classname="com.sun.tdk.jcov.RepGen"> |
|
81 |
<arg value="-verbose"/> |
|
82 |
<arg line="-output ${cc.dir}/CC_template_report"/> |
|
83 |
<arg value="${cc.template}"/> |
|
84 |
<classpath> |
|
85 |
<pathelement location="${jcov.jar}"/> |
|
86 |
</classpath> |
|
87 |
</java> |
|
88 |
</target> |
|
89 |
||
16255 | 90 |
<target name="init-cc" depends="init-cc-disabled, init-cc-enabled"> |
91 |
<property name="run.test.cc.jvmargs" value=""/> |
|
92 |
</target> |
|
93 |
||
94 |
<target name="init-cc-cleanup" if="${cc.enabled}"> |
|
95 |
<delete dir="${cc.dir}" failonerror="false" /> |
|
16529 | 96 |
<delete dir="${build.dir}/to_be_instrumented" failonerror="false" /> |
16255 | 97 |
</target> |
98 |
||
99 |
<target name="check-merging-files" depends="init"> |
|
16529 | 100 |
<echo message="checking avalibility of ${cc.template}"/> |
16255 | 101 |
<condition property="nothing-to-merge" value="true"> |
16529 | 102 |
<not> |
103 |
<available file="${cc.template}"/> |
|
104 |
</not> |
|
16255 | 105 |
</condition> |
16529 | 106 |
<echo message="nothing-to-merge = ${nothing-to-merge}"/> |
16255 | 107 |
</target> |
108 |
||
109 |
<target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}"> |
|
16529 | 110 |
<echo message="making pre-merge workaround due to missed template"/> |
16255 | 111 |
<move todir="${cc.dir}" includeemptydirs="false"> |
112 |
<fileset dir="${cc.dir}"> |
|
113 |
<include name="*.xml"/> |
|
114 |
</fileset> |
|
115 |
<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/> |
|
116 |
</move> |
|
117 |
</target> |
|
118 |
||
119 |
<target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}"> |
|
120 |
<echo message="merging files"/> |
|
121 |
<fileset dir="${cc.dir}" id="cc.xmls"> |
|
16529 | 122 |
<include name="**/*_${jcov}_*.xml"/> |
16255 | 123 |
<include name="**/CC_template.xml"/> |
124 |
</fileset> |
|
125 |
||
126 |
<pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/> |
|
16529 | 127 |
<echo message="merging files - ${cc.all.xmls}" /> |
16255 | 128 |
<java classname="com.sun.tdk.jcov.Merger"> |
129 |
<arg value="-verbose"/> |
|
130 |
<arg value="-output"/> |
|
131 |
<arg value="${cc.merged.xml}"/> |
|
132 |
<arg value="-exclude"/> |
|
133 |
<arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/> |
|
17742
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
134 |
<arg value="-exclude"/> |
19097
f544a2ea40ef
8021262: Make nashorn access checks consistent with underlying dynalink
sundar
parents:
18855
diff
changeset
|
135 |
<arg value="jdk\.nashorn\.javaadapters*"/> |
17742
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
136 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
137 |
<arg value="jdk\.nashorn\.internal\.objects\.annotations*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
138 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
139 |
<arg value="jdk\.nashorn\.internal\.scripts*"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
140 |
<arg value="-exclude"/> |
55c938a4618a
8014512: Exclude testing and infrastructure packages from code coverage
jlaskey
parents:
16529
diff
changeset
|
141 |
<arg value="jdk\.nashorn\.internal\.lookup\.MethodHandleFactory*"/> |
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\.test\.framework*"/> |
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\.test\.models*"/> |
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\.ir\.debug*"/> |
17749
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
148 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
149 |
<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
|
150 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
151 |
<arg value="jdk\.nashorn\.internal\.runtime\.DebugLogger*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
152 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
153 |
<arg value="jdk\.nashorn\.internal\.runtime\.Timing*"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
154 |
<arg value="-exclude"/> |
0f0fad887be7
8014648: Exclude testing and infrastructure packages from code coverage, round two
jlaskey
parents:
17742
diff
changeset
|
155 |
<arg value="jdk\.nashorn\.internal\.runtime\.Logging*"/> |
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\.Debug*"/> |
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\.objects\.NativeDebug*"/> |
16255 | 160 |
<arg line="${cc.all.xmls}"/> |
161 |
<classpath> |
|
162 |
<pathelement location="${jcov.jar}"/> |
|
163 |
</classpath> |
|
164 |
</java> |
|
165 |
||
166 |
</target> |
|
167 |
||
168 |
<target name="generate-code-coverage-report" depends="merge-code-coverage"> |
|
169 |
<java classname="com.sun.tdk.jcov.RepGen"> |
|
170 |
<arg value="-verbose"/> |
|
171 |
<!-- <arg line ="-exclude_list CC.report.exclude"/> --> |
|
172 |
<arg line="-output ${cc.report.dir}"/> |
|
173 |
<arg value="${cc.merged.xml}"/> |
|
174 |
<classpath> |
|
175 |
<pathelement location="${jcov.jar}"/> |
|
176 |
</classpath> |
|
177 |
</java> |
|
178 |
</target> |
|
179 |
||
180 |
||
181 |
</project> |