You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2021/04/15 11:19:07 UTC

[cassandra] branch cassandra-2.2 updated: Remove test parallelism from ant build.xml

This is an automated email from the ASF dual-hosted git repository.

mck pushed a commit to branch cassandra-2.2
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-2.2 by this push:
     new 1185593  Remove test parallelism from ant build.xml
1185593 is described below

commit 1185593907ba6597c29da1dfb5e6edb121b358c5
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Sat Apr 10 18:34:19 2021 +0200

    Remove test parallelism from ant build.xml
    
     patch by Mick Semb Wever; reviewed by Berenguer Blasi, Yifan Cai for CASSANDRA-16595
---
 build.xml | 99 ++++++++++++++-------------------------------------------------
 1 file changed, 22 insertions(+), 77 deletions(-)

diff --git a/build.xml b/build.xml
index 1b54943..cbe45ba 100644
--- a/build.xml
+++ b/build.xml
@@ -1271,8 +1271,7 @@
   <!-- Defines how to run a set of tests. If you change the defaults for attributes
        you should also update them in testmacro.,
        The two are split because the helper doesn't generate
-       a junit report or fail on errors, since this is called in parallel to run tests
-       when we choose to run tests in parallel -->
+       a junit report or fail on errors -->
   <macrodef name="testmacrohelper">
     <attribute name="inputdir" />
     <attribute name="timeout" default="${test.timeout}" />
@@ -1399,14 +1398,12 @@
         <exclude name="**/pig/*.java" />
     </fileset>
   </target>
-  
-  <!-- Will not generate a junit report or fail on error since it is called in parallel for test-compression
-       That is taken care of by testparallel -->
+
+  <!-- Will not generate a junit report or fail on error  -->
   <macrodef name="testlist">
     <attribute name="test.file.list"/>
-    <attribute name="testlist.offset"/>
     <sequential>
-      <testmacrohelper inputdir="${test.dir}/${test.classlistprefix}" filelist="@{test.file.list}" poffset="@{testlist.offset}" exclude="**/*.java" timeout="${test.timeout}">
+      <testmacrohelper inputdir="${test.dir}/${test.classlistprefix}" filelist="@{test.file.list}" exclude="**/*.java" timeout="${test.timeout}">
         <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
         <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
         <jvmarg value="-Dcorrupt-sstable-root=${test.data}/corrupt-sstables"/>
@@ -1419,18 +1416,16 @@
     </sequential>
   </macrodef>
 
-  <!-- Will not generate a junit report or fail on error since it is called in parallel for test-compression
-       That is taken care of by testparallel -->
+  <!-- Will not generate a junit report  -->
   <macrodef name="testlist-compression">
     <attribute name="test.file.list" />
-    <attribute name="testlist.offset" />
     <sequential>
       <property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
       <concat destfile="${compressed_yaml}">
         <fileset file="${test.conf}/cassandra.yaml"/>
         <fileset file="${test.conf}/commitlog_compression.yaml"/>
       </concat>
-      <testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}" poffset="@{testlist.offset}"
+      <testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
                        exclude="**/*.java" timeout="${test.timeout}" testtag="compression">
         <jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
         <jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
@@ -1484,8 +1479,8 @@
       <fileset dir="${test.unit.src}" excludes="**/pig/*.java" includes="**/${test.name}.java" />
       <fileset dir="${test.distributed.src}" includes="**/${test.name}.java" />
     </path>
-    <property name="all-test-classes" refid="all-test-classes-path"/>
-    <testparallel testdelegate="testlist-compression" />
+    <property name="test.file.list" refid="all-test-classes-path"/>
+    <testlist-compression test.file.list="${test.file.list}"/>
   </target>
 
   <target name="msg-ser-gen-test" depends="build-test" description="Generates message serializations">
@@ -1735,7 +1730,7 @@
     </create-javadoc>
    </target>
 
-  <!-- Run tests not in parallel and reports errors and generates a junit report after -->
+  <!-- Run tests and reports errors and generates a junit report after -->
   <macrodef name="testmacro">
     <attribute name="inputdir" />
     <attribute name="timeout" default="${test.timeout}" />
@@ -1768,63 +1763,12 @@
     </sequential>
   </macrodef>
 
-  <!-- Run tests in parallel and report errors after and generate a junit report -->
-  <macrodef name="testparallel">
-    <attribute name="testdelegate"/>
-    <sequential>
-      <testparallelhelper testdelegate="@{testdelegate}"/>
-      <fail message="Some test(s) failed.">
-        <condition>
-            <and>
-            <isset property="testfailed"/>
-            <not>
-              <isset property="ant.test.failure.ignore"/>
-            </not>
-          </and>
-        </condition>
-      </fail>
-    </sequential>
-  </macrodef>
-
-  <!-- Run multiple junit tasks in parallel, but don't track errors or generate a report after
-       If a test fails the testfailed property will be set. All the tests are run using te testdelegate
-       macro that is specified as an attribute and they will be run concurrently in this ant process -->
-  <scriptdef name="testparallelhelper" language="javascript">
-    <attribute name="testdelegate"/>
-    <![CDATA[
-        var Integer = java.lang.Integer;
-        sep = project.getProperty("path.separator");
-        all = project.getProperty("all-test-classes").split(sep);
-        dir = project.getProperty("test.unit.src");
-
-        numRunners = parseInt(project.getProperty("test.runners"));
-
-        var p = project.createTask('parallel');
-        p.setThreadCount(numRunners);
-
-        for (i = 0; i < all.length; i++) {
-
-            if (all[i] == undefined) continue;
-
-            task = project.createTask( attributes.get("testdelegate") );
-
-            task.setDynamicAttribute( "test.file.list", "" + all[i]);
-
-            task.setDynamicAttribute( "testlist.offset", "" + i );
-
-            p.addTask(task);
-        }
-
-        p.perform();
-    ]]>
-  </scriptdef>
-
-  <target name="test" depends="eclipse-warnings,build-test" description="Parallel Test Runner">
+  <target name="test" depends="eclipse-warnings,build-test" description="Test Runner">
     <path id="all-test-classes-path">
       <fileset dir="${test.unit.src}" includes="**/${test.name}.java" excludes="**/pig/*.java **/distributed/test/UpgradeTest*.java" />
     </path>
-    <property name="all-test-classes" refid="all-test-classes-path"/>
-    <testparallel testdelegate="testlist"/>
+    <property name="test.file.list" refid="all-test-classes-path"/>
+    <testlist test.file.list="${test.file.list}"/>
   </target>
 
   <target name="generate-test-report" description="Generates JUnit's HTML report from results already in build/output">
@@ -1839,19 +1783,20 @@
   <!-- run a list of tests as provided in -Dtest.classlistfile (or default of 'testnames.txt')
   The class list file should be one test class per line, with the path starting after test/unit
   e.g. org/apache/cassandra/hints/HintMessageTest.java -->
-  <target name="testclasslist" depends="build-test" description="Parallel-run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
+  <target name="testclasslist" depends="build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
     <path id="all-test-classes-path">
       <fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
     </path>
-    <property name="all-test-classes" refid="all-test-classes-path"/>
-    <testparallel testdelegate="testlist"/>
+    <property name="test.file.list" refid="all-test-classes-path"/>
+    <testlist test.file.list="${test.file.list}"/>
   </target>
-  <target name="testclasslist-compression" depends="build-test" description="Parallel-run compression tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
-    <path id="all-test-classes-path">
-      <fileset dir="${test.unit.src}" includesfile="${test.classlistfile}"/>
-    </path>
-    <property name="all-test-classes" refid="all-test-classes-path"/>
-    <testparallel testdelegate="testlist-compression"/>
+
+  <target name="testclasslist-compression" depends="build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
+      <path id="all-test-classes-path">
+          <fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
+      </path>
+      <property name="test.file.list" refid="all-test-classes-path"/>
+      <testlist-compression test.file.list="${test.file.list}"/>
   </target>
 
   <target name="test-distributed" depends="build-test" description="Execute unit tests">

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org