make/code_coverage.xml

changeset 0
b1a7da25b547
child 952
6d5471a497fb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/make/code_coverage.xml	Wed Apr 27 01:36:41 2016 +0800
     1.3 @@ -0,0 +1,181 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!--
     1.6 + Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
     1.7 + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8 + 
     1.9 + This code is free software; you can redistribute it and/or modify it
    1.10 + under the terms of the GNU General Public License version 2 only, as
    1.11 + published by the Free Software Foundation.
    1.12 + 
    1.13 + This code is distributed in the hope that it will be useful, but WITHOUT
    1.14 + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.15 + FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.16 + version 2 for more details (a copy is included in the LICENSE file that
    1.17 + accompanied this code).
    1.18 + 
    1.19 + You should have received a copy of the GNU General Public License version
    1.20 + 2 along with this work; if not, write to the Free Software Foundation,
    1.21 + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.22 + 
    1.23 + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.24 + or visit www.oracle.com if you need additional information or have any
    1.25 + questions.
    1.26 +-->
    1.27 +<project name="code-coverage" default="generate-code-coverage-report" basedir="..">
    1.28 +
    1.29 +  <!-- CODE COVERAGE -->
    1.30 +  <target name="init-cc-enabled" if="${cc.enabled}">
    1.31 +
    1.32 +    <echo message="initialize [${jcov}] java coverage"/>
    1.33 +
    1.34 +
    1.35 +    <property name="cc.report.dir" value="${cc.dir}/CC_${jcov}_report"/>
    1.36 +    <property name="cc.merged.xml" value="${cc.dir}/CC_${jcov}_result-merged.xml"/>
    1.37 +
    1.38 +    <condition property="run.test.cc.jvmargs" value="${cc.dynamic.args}">
    1.39 +      <equals arg1="${jcov}" arg2="dynamic" trim="true"/>
    1.40 +    </condition>
    1.41 +
    1.42 +    <condition property="cc.generate.template" value="true">
    1.43 +      <equals arg1="${cc.dynamic.genereate.template}" arg2="true" trim="true"/>
    1.44 +    </condition>
    1.45 +
    1.46 +    <mkdir dir="${cc.dir}"/>
    1.47 +    <mkdir dir="${build.dir}/to_be_instrumented"/>
    1.48 +
    1.49 +    <!-- info -->
    1.50 +    <echo message="jcov=${jcov}"/>
    1.51 +    <echo message="cc.generate.template=${cc.generate.template}"/>
    1.52 +    <echo message="cc.instrument=${cc.instrument}"/>
    1.53 +    <echo message="run.test.cc.jvmargs=${run.test.cc.jvmargs}"/>
    1.54 +    <echo message="cc.report.dir=${cc.report.dir}"/>
    1.55 +    <echo message="cc.merged.xml=${cc.merged.xml}"/>
    1.56 +  </target>
    1.57 +
    1.58 +  <target name="init-cc-disabled" unless="${cc.enabled}">
    1.59 +    <property name="run.test.cc.jvmargs" value=""/>
    1.60 +  </target>
    1.61 +
    1.62 +  <target name="prepare-to-be-instrumented" depends="compile" description="Prepares to_be_instrumented dir">
    1.63 +    <copy todir="${build.dir}/to_be_instrumented">
    1.64 +      <fileset dir="${build.classes.dir}">
    1.65 +        <include name="**/*.class"/>
    1.66 +      </fileset>
    1.67 +    </copy>
    1.68 +  </target>
    1.69 +
    1.70 +  <target name="generate-cc-template" depends="prepare-to-be-instrumented" description="Generates code coverage template for dynamic CC" if="cc.generate.template">
    1.71 +    <property name="cc.instrumented.path" location="${build.dir}/to_be_instrumented"/>
    1.72 +    <java classname="com.sun.tdk.jcov.TmplGen">
    1.73 +      <arg value="-verbose"/>
    1.74 +      <arg line="-include ${cc.include}"/>
    1.75 +      <arg line="-type all"/>
    1.76 +      <arg line="-template ${cc.template}"/>
    1.77 +      <arg value="${cc.instrumented.path}"/>
    1.78 +      <classpath>
    1.79 +        <pathelement location="${jcov.jar}"/>
    1.80 +      </classpath>
    1.81 +    </java>
    1.82 +
    1.83 +    <java classname="com.sun.tdk.jcov.RepGen">
    1.84 +      <arg value="-verbose"/>
    1.85 +      <arg line="-output ${cc.dir}/CC_template_report"/>
    1.86 +      <arg value="${cc.template}"/>
    1.87 +      <classpath>
    1.88 +        <pathelement location="${jcov.jar}"/>
    1.89 +      </classpath>
    1.90 +    </java>
    1.91 +  </target>
    1.92 +
    1.93 +  <target name="init-cc" depends="init-cc-disabled, init-cc-enabled">
    1.94 +    <property name="run.test.cc.jvmargs" value=""/>
    1.95 +  </target>
    1.96 +
    1.97 +  <target name="init-cc-cleanup" if="${cc.enabled}">
    1.98 +    <delete dir="${cc.dir}" failonerror="false" />
    1.99 +    <delete dir="${build.dir}/to_be_instrumented" failonerror="false" />
   1.100 +  </target>
   1.101 +
   1.102 +  <target name="check-merging-files" depends="init">
   1.103 +	<echo message="checking avalibility of ${cc.template}"/>
   1.104 +    <condition property="nothing-to-merge" value="true">
   1.105 +		<not>
   1.106 +	      <available file="${cc.template}"/>
   1.107 +		</not>
   1.108 +    </condition>
   1.109 +	<echo message="nothing-to-merge = ${nothing-to-merge}"/>
   1.110 +  </target>
   1.111 +
   1.112 +  <target name="fix-merging-files" depends="check-merging-files" if="${nothing-to-merge}">
   1.113 +	<echo message="making pre-merge workaround due to missed template"/>
   1.114 +	<move todir="${cc.dir}" includeemptydirs="false">
   1.115 +		<fileset dir="${cc.dir}">
   1.116 +			<include name="*.xml"/>
   1.117 +		</fileset>
   1.118 +		<mapper type="glob" from="*.xml" to="CC_${jcov}_result-merged.xml"/>
   1.119 +	</move>
   1.120 +  </target>
   1.121 + 
   1.122 +  <target name="merge-code-coverage" depends="fix-merging-files" unless="${nothing-to-merge}">
   1.123 +	<echo message="merging files"/>
   1.124 +    <fileset dir="${cc.dir}" id="cc.xmls">
   1.125 +      <include name="**/*_${jcov}_*.xml"/>
   1.126 +      <include name="**/CC_template.xml"/>
   1.127 +    </fileset>
   1.128 +
   1.129 +    <pathconvert pathsep=" " property="cc.all.xmls" refid="cc.xmls"/>
   1.130 +	<echo message="merging files - ${cc.all.xmls}" />
   1.131 +    <java classname="com.sun.tdk.jcov.Merger">
   1.132 +      <arg value="-verbose"/>
   1.133 +      <arg value="-output"/>
   1.134 +      <arg value="${cc.merged.xml}"/>
   1.135 +      <arg value="-exclude"/>
   1.136 +      <arg value="com\.oracle\.nashorn\.runtime\.ScriptRuntime*"/>
   1.137 +      <arg value="-exclude"/>
   1.138 +      <arg value="jdk\.nashorn\.javaadapters*"/>
   1.139 +      <arg value="-exclude"/>
   1.140 +      <arg value="jdk\.nashorn\.internal\.objects\.annotations*"/>
   1.141 +      <arg value="-exclude"/>
   1.142 +      <arg value="jdk\.nashorn\.internal\.scripts*"/>
   1.143 +      <arg value="-exclude"/>
   1.144 +      <arg value="jdk\.nashorn\.internal\.lookup\.MethodHandleFactory*"/>
   1.145 +      <arg value="-exclude"/>
   1.146 +      <arg value="jdk\.nashorn\.internal\.test\.framework*"/>
   1.147 +      <arg value="-exclude"/>
   1.148 +      <arg value="jdk\.nashorn\.test\.models*"/>
   1.149 +      <arg value="-exclude"/>
   1.150 +      <arg value="jdk\.nashorn\.internal\.ir\.debug*"/>
   1.151 +      <arg value="-exclude"/>
   1.152 +      <arg value="jdk\.nashorn\.internal\.runtime\.regexp\.joni\.bench*"/>
   1.153 +      <arg value="-exclude"/>
   1.154 +      <arg value="jdk\.nashorn\.internal\.runtime\.DebugLogger*"/>
   1.155 +      <arg value="-exclude"/>
   1.156 +      <arg value="jdk\.nashorn\.internal\.runtime\.Timing*"/>
   1.157 +      <arg value="-exclude"/>
   1.158 +      <arg value="jdk\.nashorn\.internal\.runtime\.Logging*"/>
   1.159 +      <arg value="-exclude"/>
   1.160 +      <arg value="jdk\.nashorn\.internal\.runtime\.Debug*"/>
   1.161 +      <arg value="-exclude"/>
   1.162 +      <arg value="jdk\.nashorn\.internal\.objects\.NativeDebug*"/>
   1.163 +      <arg line="${cc.all.xmls}"/>
   1.164 +      <classpath>
   1.165 +        <pathelement location="${jcov.jar}"/>
   1.166 +      </classpath>
   1.167 +    </java>
   1.168 +
   1.169 +  </target>
   1.170 +
   1.171 +  <target name="generate-code-coverage-report" depends="merge-code-coverage">
   1.172 +    <java classname="com.sun.tdk.jcov.RepGen">
   1.173 +      <arg value="-verbose"/>
   1.174 +<!--      <arg line ="-exclude_list CC.report.exclude"/> -->
   1.175 +      <arg line="-output ${cc.report.dir}"/>
   1.176 +      <arg value="${cc.merged.xml}"/>
   1.177 +      <classpath>
   1.178 +        <pathelement location="${jcov.jar}"/>
   1.179 +      </classpath>
   1.180 +    </java>
   1.181 +  </target>
   1.182 +
   1.183 +
   1.184 +</project>

mercurial