jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1769389 - in /jmeter/trunk: build.properties build.xml test/src/org/apache/jmeter/JMeterVersionTest.java xdocs/changes.xml
Date Sat, 12 Nov 2016 15:23:20 GMT
Author: pmouawad
Date: Sat Nov 12 15:23:20 2016
New Revision: 1769389

URL: http://svn.apache.org/viewvc?rev=1769389&view=rev
Log:
Bug 60364 - Document Test Coverage
Bugzilla Id: 60364

Modified:
    jmeter/trunk/build.properties
    jmeter/trunk/build.xml
    jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/build.properties
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.properties?rev=1769389&r1=1769388&r2=1769389&view=diff
==============================================================================
--- jmeter/trunk/build.properties (original)
+++ jmeter/trunk/build.properties Sat Nov 12 15:23:20 2016
@@ -389,3 +389,8 @@ rat-tasks.jar                = apache-ra
 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                = fc093f67abf5bafb782d2eafa2f5815e
\ No newline at end of file

Modified: jmeter/trunk/build.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/build.xml?rev=1769389&r1=1769388&r2=1769389&view=diff
==============================================================================
--- jmeter/trunk/build.xml (original)
+++ jmeter/trunk/build.xml Sat Nov 12 15:23:20 2016
@@ -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>
@@ -899,7 +910,7 @@
   <target name="package" depends="compile, prepare-resources, package-only"
      description="Compile everything and create the jars"/>
 
-  <target name="package-and-check" depends="clean, package, checkstyle, rat"
+  <target name="package-and-check" depends="clean, download_jars, package, checkstyle,
rat"
      description="Compile, create jars and apply checkstyle before commiting code"/>
 
   <target name="prepare-resources"
@@ -2457,6 +2468,7 @@ run JMeter unless all the JMeter jars ar
             <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 @@ run JMeter unless all the JMeter jars ar
         <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 @@ run JMeter unless all the JMeter jars ar
         <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 @@ run JMeter unless all the JMeter jars ar
            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 @@ run JMeter unless all the JMeter jars ar
     <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,74 @@ run JMeter unless all the JMeter jars ar
     </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"/>

Modified: jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java?rev=1769389&r1=1769388&r2=1769389&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/JMeterVersionTest.java Sat Nov 12 15:23:20 2016
@@ -115,6 +115,9 @@ public class JMeterVersionTest extends J
         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() {

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1769389&r1=1769388&r2=1769389&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov 12 15:23:20 2016
@@ -290,6 +290,7 @@ This allows you to update Think Times fr
     Contributed by Benoit Wiart (b.wiart at ubik-ingenierie.com)</li>
     <li><pr>218</pr>Misc cleanup. Contributed by Benoit Wiart (b.wiart
at ubik-ingenierie.com)</li>
     <li><pr>216</pr>Re-use pattern when possible. Contributed by Benoit
Wiart (b.wiart at ubik-ingenierie.com)</li>
+    <li><bug>60364</bug>Document Test Coverage. Contributed by Thomas Schapitz
(ts-nospam12 at online.de)</li>
 </ul>
 
  <!-- =================== Bug fixes =================== -->
@@ -382,6 +383,7 @@ This allows you to update Think Times fr
 <li>Roberto Braga (roberto.braga at soziale.it)</li>
 <li>jarek102 at gmail.com</li>
 <li>Wyatt Epp (wyatt.epp at gmail.com)</li>
+<li>Thomas Schapitz (ts-nospam12 at online.de)</li>
 </ul>
 <p>We also thank bug reporters who helped us improve JMeter. <br/>
 For this release we want to give special thanks to the following reporters for the clear
reports and tests made after our fixes:</p>



Mime
View raw message