make/code_coverage.xml

Thu, 31 Aug 2017 15:30:47 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:30:47 +0800
changeset 952
6d5471a497fb
parent 468
dc54df348a58
parent 0
b1a7da25b547
permissions
-rw-r--r--

merge

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

mercurial