ASF Bugzilla – Attachment 34436 Details for
Bug 60364
Document Test Coverage
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add JaCoCo Testcoverage to build
vcs-diff6899493265173743578.patch (text/plain), 15.76 KB, created by
Thomas Schapitz
on 2016-11-11 20:30:49 UTC
(
hide
)
Description:
Add JaCoCo Testcoverage to build
Filename:
MIME Type:
Creator:
Thomas Schapitz
Created:
2016-11-11 20:30:49 UTC
Size:
15.76 KB
patch
obsolete
># This patch file was generated by NetBeans IDE ># Following Index: paths are relative to: D:\projects\foreign\apache\jmeter\trunk ># This patch can be applied using context Tools: Patch action on respective folder. ># It uses platform neutral UTF-8 encoding and \n newlines. ># Above lines and this line are ignored by the patching process. >Index: 1.classpath >--- 1.classpath Base (BASE) >+++ 1.classpath Locally Deleted >@@ -1,109 +0,0 @@ >-<?xml version="1.0" encoding="UTF-8"?> >-<!-- >- Licensed to the Apache Software Foundation (ASF) under one or more >- contributor license agreements. See the NOTICE file distributed with >- this work for additional information regarding copyright ownership. >- The ASF licenses this file to You under the Apache License, Version 2.0 >- (the "License"); you may not use this file except in compliance with >- the License. You may obtain a copy of the License at >- >- http://www.apache.org/licenses/LICENSE-2.0 >- >- Unless required by applicable law or agreed to in writing, software >- distributed under the License is distributed on an "AS IS" BASIS, >- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >- See the License for the specific language governing permissions and >- limitations under the License. >---> >-<!-- >- This is a sample Eclipse .classpath file, which can be used to help set up the proper .classpath. >- Note that the "con" entry may be different on individual systems, but the other entries >- should generally be the same, unless you attach sources or javadoc to the jars. >- >- Eclipse seems to use TABS for indenting the entries. >- --> >-<classpath> >- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> >- <classpathentry kind="src" output="build/components" path="src/components"/> >- <classpathentry kind="src" output="build/core" path="src/core"/> >- <classpathentry kind="src" output="build/examples" path="src/examples"/> >- <classpathentry kind="src" output="build/functions" path="src/functions"/> >- <classpathentry kind="src" output="build/jorphan" path="src/jorphan"/> >- <classpathentry kind="src" output="build/junit" path="src/junit"/> >- <classpathentry kind="src" output="build/monitor/components" path="src/monitor/components"/> >- <classpathentry kind="src" output="build/monitor/model" path="src/monitor/model"/> >- <classpathentry kind="src" output="build/protocol/ftp" path="src/protocol/ftp"/> >- <classpathentry kind="src" output="build/protocol/http" path="src/protocol/http"/> >- <classpathentry kind="src" output="build/protocol/java" path="src/protocol/java"/> >- <classpathentry kind="src" output="build/protocol/jdbc" path="src/protocol/jdbc"/> >- <classpathentry kind="src" output="build/protocol/jms" path="src/protocol/jms"/> >- <classpathentry kind="src" output="build/protocol/ldap" path="src/protocol/ldap"/> >- <classpathentry kind="src" output="build/protocol/mail" path="src/protocol/mail"/> >- <classpathentry kind="src" output="build/protocol/mongodb" path="src/protocol/mongodb"/> >- <classpathentry kind="src" output="build/protocol/native" path="src/protocol/native"/> >- <classpathentry kind="src" output="build/protocol/tcp" path="src/protocol/tcp"/> >- <classpathentry kind="src" output="build/slf4j-logkit" path="src/slf4j-logkit"/> >- <classpathentry kind="src" output="build/test" path="test/src"/> >- <classpathentry kind="lib" path="lib/accessors-smart-1.1.jar"/> >- <classpathentry kind="lib" path="lib/asm-5.1.jar"/> >- <classpathentry kind="lib" path="lib/avalon-framework-4.1.4.jar"/> >- <classpathentry kind="lib" path="lib/bsf-2.4.0.jar"/> >- <classpathentry kind="lib" path="lib/bsh-2.0b5.jar"/> >- <classpathentry kind="lib" path="lib/commons-codec-1.10.jar"/> >- <classpathentry kind="lib" path="lib/commons-collections-3.2.2.jar"/> >- <classpathentry kind="lib" path="lib/commons-dbcp2-2.1.1.jar"/> >- <classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/> >- <classpathentry kind="lib" path="lib/commons-io-2.5.jar"/> >- <classpathentry kind="lib" path="lib/commons-jexl-1.1.jar"/> >- <classpathentry kind="lib" path="lib/commons-jexl-2.1.1.jar"/> >- <classpathentry kind="lib" path="lib/commons-jexl3-3.0.jar"/> >- <classpathentry kind="lib" path="lib/commons-lang3-3.4.jar"/> >- <classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/> >- <classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/> >- <classpathentry kind="lib" path="lib/commons-net-3.5.jar"/> >- <classpathentry kind="lib" path="lib/commons-pool2-2.4.2.jar"/> >- <classpathentry kind="lib" path="lib/dnsjava-2.1.7.jar"/> >- <classpathentry kind="lib" path="lib/excalibur-logger-1.1.jar"/> >- <classpathentry kind="lib" path="lib/freemarker-2.3.23.jar"/> >- <classpathentry kind="lib" path="lib/groovy-all-2.4.7.jar"/> >- <classpathentry kind="lib" path="lib/hamcrest-core-1.3.jar"/> >- <classpathentry kind="lib" path="lib/geronimo-jms_1.1_spec-1.1.1.jar"/> >- <classpathentry kind="lib" path="lib/httpclient-4.5.2.jar"/> >- <classpathentry kind="lib" path="lib/httpcore-4.4.5.jar"/> >- <classpathentry kind="lib" path="lib/httpmime-4.5.2.jar"/> >- <classpathentry kind="lib" path="lib/jcharts-0.7.5.jar"/> >- <classpathentry kind="lib" path="lib/jodd-core-3.7.1.jar"/> >- <classpathentry kind="lib" path="lib/jodd-lagarto-3.7.1.jar"/> >- <classpathentry kind="lib" path="lib/jodd-log-3.7.1.jar"/> >- <classpathentry kind="lib" path="lib/jodd-props-3.7.1.jar"/> >- <classpathentry kind="lib" path="lib/json-path-2.2.0.jar"/> >- <classpathentry kind="lib" path="lib/json-smart-2.2.1.jar"/> >- <classpathentry kind="lib" path="lib/jsoup-1.9.2.jar"/> >- <classpathentry kind="lib" path="lib/jtidy-r938.jar"/> >- <classpathentry kind="lib" path="lib/junit-4.12.jar"/> >- <classpathentry kind="lib" path="lib/logkit-2.0.jar"/> >- <classpathentry kind="lib" path="lib/mail-1.5.0-b01.jar"/> >- <classpathentry kind="lib" path="lib/mongo-java-driver-2.11.3.jar"/> >- <classpathentry kind="lib" path="lib/ph-css-4.1.5.jar"/> >- <classpathentry kind="lib" path="lib/ph-commons-6.2.4.jar"/> >- <classpathentry kind="lib" path="lib/oro-2.0.8.jar"/> >- <classpathentry kind="lib" path="lib/rhino-1.7.7.1.jar"/> >- <classpathentry kind="lib" path="lib/rsyntaxtextarea-2.6.0.jar"/> >- <classpathentry kind="lib" path="lib/serializer-2.7.2.jar"/> >- <classpathentry kind="lib" path="lib/slf4j-api-1.7.21.jar"/> >- <classpathentry kind="lib" path="lib/tika-core-1.13.jar"/> >- <classpathentry kind="lib" path="lib/tika-parsers-1.13.jar"/> >- <classpathentry kind="lib" path="lib/xalan-2.7.2.jar"/> >- <classpathentry kind="lib" path="lib/xercesImpl-2.11.0.jar"/> >- <classpathentry kind="lib" path="lib/xml-apis-1.4.01.jar"/> >- <classpathentry kind="lib" path="lib/xmlgraphics-commons-2.1.jar"/> >- <classpathentry kind="lib" path="lib/xmlpull-1.1.3.1.jar"/> >- <classpathentry kind="lib" path="lib/xpp3_min-1.1.4c.jar"/> >- <classpathentry kind="lib" path="lib/xstream-1.4.9.jar"/> >- <!-- Needed for build and test --> >- <classpathentry kind="lib" path="lib/api/bcmail-jdk15on-1.49.jar"/> >- <classpathentry kind="lib" path="lib/api/bcprov-jdk15on-1.49.jar"/> >- <classpathentry kind="lib" path="lib/api/bcpkix-jdk15on-1.49.jar"/> >- <classpathentry kind="src" path="test/resources" output="build/test"/> >- <classpathentry kind="output" path="classes"/> >-</classpath> >Index: build.properties >--- build.properties Base (BASE) >+++ build.properties Locally Modified (Based On LOCAL) >@@ -389,3 +389,9 @@ > rat-tasks.loc = ${maven2.repo}/org/apache/rat/apache-rat-tasks/${rat.version} > rat-tasks.md5 = 96b699581b4475ed5756a0c24af745e8 > >+# Optional for use by JaCoCo >+jacocoant.version = 0.7.7.201606060606 >+jacocoant.jar = org.jacoco.ant-${jacocoant.version}-nodeps.jar >+jacocoant.loc = ${maven2.repo}/org/jacoco/org.jacoco.ant/${jacocoant.version} >+#jacocoant.md5 = 3ca768b6f77cc4fe52795ee9c3f679fd >+jacocoant.md5 = fc093f67abf5bafb782d2eafa2f5815e >\ No newline at end of file >Index: build.xml >--- build.xml Base (BASE) >+++ build.xml Locally Modified (Based On LOCAL) >@@ -17,7 +17,9 @@ > --> > <project name="JMeter" default="install" basedir="." > xmlns:rat="antlib:org.apache.rat.anttasks" >- xmlns="antlib:org.apache.tools.ant"> >+ xmlns:jacoco="antlib:org.jacoco.ant" >+ xmlns:if="ant:if" >+ xmlns="antlib:org.apache.tools.ant" > > <description> > > N.B. To build JMeter from a release you need both the binary and source archives, >@@ -331,6 +333,14 @@ > <!-- Directory where Optional 3rd party libraries live --> > <property name="lib.opt" value="lib/opt"/> > >+ <!-- Directory where Jacoco libraries live --> >+ <!-- I'm to lazy to fix this now, so I tag along with rat & checkstyle, >+ which already live there. But: none of these should apear on the classpath >+ of Jmeter, neither runtime, nor compiletime. These are only required on the >+ Ant classpath, so judging from comments elsewhere, this is the wrong place. >+ --> >+ <property name="lib.coverage" location="lib/opt"/> >+ > <!-- Other stuff --> > <property name="extras.dir" value="extras"/> > >@@ -892,6 +902,7 @@ > <classpath> > <pathelement location="${dest.jar.jmeter}/ApacheJMeter.jar"/> > </classpath> >+ <jvmarg value="${jacocoagent}run_gui:java(server) org.apache.jmeter.NewDriver" if:set="jacocoagent" /> > <sysproperty key="jmeter.home" value="${basedir}"/> > </java> > </target> >@@ -2457,6 +2468,7 @@ > <fileset dir="${dest.jar}" includes="*.jar"/> > <path refid="classpath"/> > </classpath> >+ <jvmarg value="${jacocoagent}batchtest:daemon:java(server) -Djava.awt.headless=true org.apache.jmeter.NewDriver -j ${batchtestserver.out}/${batchtestserver.log} -Dserver_port=${rmi_port}" if:set="jacocoagent" /> > <sysproperty key="java.awt.headless" value="true"/> > <!-- Bug 59723 --> > <!-- quieten the logging; this has to be done first --> >@@ -2558,6 +2570,7 @@ > <fileset dir="${dest.jar}" includes="*.jar"/> > <path refid="classpath"/> > </classpath> >+ <jvmarg value="${jacocoagent}batchtest:java(${taskname}) -Djava.awt.headless=false org.apache.jmeter.NewDriver -ttestfiles/${batchtest.name}.jmx ${remote}" if:set="jacocoagent" /> > <!-- Detect if non-GUI runs OK headless by forcing it to try using non-headless mode --> > <sysproperty key="user.language" value="en"/> > <sysproperty key="user.region" value="US"/> >@@ -2755,6 +2768,7 @@ > <path refid="classpath"/> > </classpath> > <jvmarg value="-server"/> >+ <jvmarg value="${jacocoagent}_test:java -Djava.awt.headless=${test.headless} org.apache.jorphan.test.AllTests" if:set="jacocoagent" /> > <jvmarg value="-Dfile.encoding=${test.encoding}"/> > <sysproperty key="java.awt.headless" value="${test.headless}"/> > <sysproperty key="testsaveservice.saveout" value="${testsaveservice.saveout}" /> >@@ -2781,6 +2795,7 @@ > printsummary="on"> > <formatter type="${test.format}" usefile="yes"/> > <formatter type="xml"/> >+ <jvmarg value="${jacocoagent}run_gui:junit -Djava.awt.headless=${java.awt.headless} org.apache.jmeter.NewDriver" if:set="jacocoagent" /> > <jvmarg value="-Dfile.encoding=${test.encoding}"/> > <!-- Allow headless to be passed in --> > <jvmarg value="-Djava.awt.headless=${java.awt.headless}"/> >@@ -3016,6 +3031,7 @@ > <process_jarfile jarname="xmlpull"/> > <process_jarfile jarname="xpp3"/> > <process_jarfile jarname="xstream"/> >+ <process_jarfile jarname="jacocoant" dest.dir="${lib.coverage}" /> > </target> > > <target name="_process_doc_jars"> >@@ -3085,6 +3101,78 @@ > </antcall> > </target> > >+ <target name="_coverage.prepare" > >+ <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml"> >+ <classpath path="${lib.coverage}/${jacocoant.jar}"/> >+ </taskdef> >+ <jacoco:agent property="jacocoagent" >+ destfile="${build.dir}/jacoco.exec" >+ includes="org.apache.jmeter.*:org.apache.jorphan.*:org.apache.commons.cli.avalon.*:org.sl4j.impl.StaticLoggerBinder" >+ sessionid="" >+ /> >+ </target> >+ >+ <target name="_coverage.report" depends="_coverage.prepare, init-svnVersion, init-version"> >+ <jacoco:report> >+ >+ <executiondata> >+ <file file="${build.dir}/jacoco.exec"/> >+ </executiondata> >+ >+ <structure name="JMeter ${jmeter.version} ${implementation.version}"> >+ <classfiles> >+ <fileset dir="${build.components}"/> >+ <fileset dir="${build.core}"/> >+ <fileset dir="${build.functions}"/> >+ <fileset dir="${build.jorphan}"/> >+ <fileset dir="${build.junit}"/> >+ <fileset dir="${build.monitor.components}"/> >+ <fileset dir="${build.monitor.model}"/> >+ <fileset dir="${build.ftp}"/> >+ <fileset dir="${build.http}"/> >+ <fileset dir="${build.java}"/> >+ <fileset dir="${build.jdbc}"/> >+ <fileset dir="${build.jms}"/> >+ <fileset dir="${build.ldap}"/> >+ <fileset dir="${build.mail}"/> >+ <fileset dir="${build.mongodb}"/> >+ <fileset dir="${build.native}"/> >+ <fileset dir="${build.tcp}"/> >+ <fileset dir="${build.slf4j_logkit}"/> >+ <fileset dir="${build.test}"/> >+ </classfiles> >+ <sourcefiles encoding="${encoding}"> >+ <fileset dir="${src.components}"/> >+ <fileset dir="${src.core}"/> >+ <fileset dir="${src.functions}"/> >+ <fileset dir="${src.jorphan}"/> >+ <fileset dir="${src.junit}"/> >+ <fileset dir="${src.monitor.components}"/> >+ <fileset dir="${src.monitor.model}"/> >+ <fileset dir="${src.ftp}"/> >+ <fileset dir="${src.http}"/> >+ <fileset dir="${src.java}"/> >+ <fileset dir="${src.jdbc}"/> >+ <fileset dir="${src.jms}"/> >+ <fileset dir="${src.ldap}"/> >+ <fileset dir="${src.mail}"/> >+ <fileset dir="${src.mongodb}"/> >+ <fileset dir="${src.native}"/> >+ <fileset dir="${src.tcp}"/> >+ <fileset dir="${src.slf4j_logkit}"/> >+ <fileset dir="${src.test}"/> >+ </sourcefiles> >+ </structure> >+ >+ <html destdir="reports/coverage"/> >+ <xml destfile="reports/coverage/jmeter-coverage.xml"/> >+ <csv destfile="reports/coverage/jmeter-coverage.csv"/> >+ >+ </jacoco:report> >+ </target> >+ >+ <target name="coverage" depends="_coverage.prepare, test-both, _allbatchtests, _coverage.report"/> >+ > <target name="_check_exists" if="_check_exists"> > <fail message="Invalid call sequence - file.exists should not be defined" if="file.exists"/> > <available file="${file}" property="file.exists"/> >Index: test/src/org/apache/jmeter/JMeterVersionTest.java >--- test/src/org/apache/jmeter/JMeterVersionTest.java Base (BASE) >+++ test/src/org/apache/jmeter/JMeterVersionTest.java Locally Modified (Based On LOCAL) >@@ -115,6 +115,11 @@ > versions.remove("rat"); > propNames.remove("rat-tasks"); > versions.remove("rat-tasks"); >+ >+ // remove optional jacoco jars (required for coverage reporting, not required for jmeter) >+ propNames.remove("jacocoant"); >+ versions.remove("jacocoant"); >+ > prop = buildProp; > final File licencesDir = getFileFromHome("licenses/bin"); > licencesDir.list(new FilenameFilter() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 60364
:
34436
|
34437