git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276413 13f79535-47bb-0310-9956-ffa450edef68master
@@ -161,6 +161,11 @@ Other changes: | |||||
* New "pattern" attribute for <date> selector. | * New "pattern" attribute for <date> selector. | ||||
* <junit> has a new forkmode attribute that controls the number of | |||||
Java VMs that get created when forking tests. This allows you to | |||||
run all tests in a single forked JVM reducing the overhead of VM | |||||
creation a lot. Bugzilla Report 24697. | |||||
Changes from Ant 1.6.0 to Ant 1.6.1 | Changes from Ant 1.6.0 to Ant 1.6.1 | ||||
============================================= | ============================================= | ||||
@@ -53,7 +53,7 @@ | |||||
<property name="junit.filtertrace" value="off"/> | <property name="junit.filtertrace" value="off"/> | ||||
<property name="junit.summary" value="no"/> | <property name="junit.summary" value="no"/> | ||||
<property name="test.haltonfailure" value="yes" /> | <property name="test.haltonfailure" value="yes" /> | ||||
<property name="junit.forkstyle" value="once"/> | |||||
<property name="junit.forkmode" value="once"/> | |||||
<property name="unfiltered.files" value="**/*.gif,**/*.jpg,**/*.ico,**/*.pdf,**/*.zip"/> | <property name="unfiltered.files" value="**/*.gif,**/*.jpg,**/*.ico,**/*.pdf,**/*.zip"/> | ||||
<!-- | <!-- | ||||
@@ -1429,7 +1429,7 @@ | |||||
<junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}" | <junit printsummary="${junit.summary}" haltonfailure="${test.haltonfailure}" | ||||
filtertrace="${junit.filtertrace}" | filtertrace="${junit.filtertrace}" | ||||
fork="${junit.fork}" forkstyle="${junit.forkstyle}" | |||||
fork="${junit.fork}" forkmode="${junit.forkmode}" | |||||
failureproperty="tests.failed"> | failureproperty="tests.failed"> | ||||
<!-- <jvmarg value="-classic"/> --> | <!-- <jvmarg value="-classic"/> --> | ||||
<classpath refid="tests-classpath"/> | <classpath refid="tests-classpath"/> | ||||
@@ -67,6 +67,24 @@ elements</a>).</p> | |||||
<td valign="top">Run the tests in a separate VM.</td> | <td valign="top">Run the tests in a separate VM.</td> | ||||
<td align="center" valign="top">No; default is <code>off</code>.</td> | <td align="center" valign="top">No; default is <code>off</code>.</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td valign="top">forkmode</td> | |||||
<td valign="top">Controls how many Java Virtual Machines get | |||||
created if you want to fork some tests. Possible values are | |||||
"perTest" (the default), "perBatch" and | |||||
"once". "once" creates only a single Java VM | |||||
for all tests while "perTest" creates a new VM for each | |||||
TestCase class. "perBatch" creates a VM for each nested | |||||
<code><batchtest></code> and one collecting all nested | |||||
<code><test></code>s. Note that only tests with the same | |||||
settings of <code>filtertrace</code>, <code>haltonerror</code>, | |||||
<code>haltonfailure</code>, <code>errorproperty</code> and | |||||
<code>failureproperty</code> can share a VM, so even if you set | |||||
<code>forkmode</code> to "once", Ant may have to create | |||||
more than a single Java VM. This attribute is ignored for tests | |||||
that don't get forked into a new Java VM.</td> | |||||
<td align="center" valign="top">No; default is <code>perTest</code>.</td> | |||||
</tr> | |||||
<tr> | <tr> | ||||
<td valign="top">haltonerror</td> | <td valign="top">haltonerror</td> | ||||
<td valign="top">Stop the build process if an error occurs during the test | <td valign="top">Stop the build process if an error occurs during the test | ||||
@@ -147,7 +147,7 @@ public class JUnitTask extends Task { | |||||
private File tmpDir; | private File tmpDir; | ||||
private AntClassLoader classLoader = null; | private AntClassLoader classLoader = null; | ||||
private Permissions perm = null; | private Permissions perm = null; | ||||
private ForkStyle forkStyle = new ForkStyle("perTest"); | |||||
private ForkMode forkMode = new ForkMode("perTest"); | |||||
private static final int STRING_BUFFER_SIZE = 128; | private static final int STRING_BUFFER_SIZE = 128; | ||||
@@ -295,8 +295,8 @@ public class JUnitTask extends Task { | |||||
* | * | ||||
* @since Ant 1.6.2 | * @since Ant 1.6.2 | ||||
*/ | */ | ||||
public void setForkStyle(ForkStyle style) { | |||||
this.forkStyle = style; | |||||
public void setForkMode(ForkMode mode) { | |||||
this.forkMode = mode; | |||||
} | } | ||||
/** | /** | ||||
@@ -641,11 +641,11 @@ public class JUnitTask extends Task { | |||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
List testLists = new ArrayList(); | List testLists = new ArrayList(); | ||||
boolean forkPerTest = forkStyle.getValue().equals(ForkStyle.PER_TEST); | |||||
if (forkPerTest || forkStyle.getValue().equals(ForkStyle.ONCE)) { | |||||
boolean forkPerTest = forkMode.getValue().equals(ForkMode.PER_TEST); | |||||
if (forkPerTest || forkMode.getValue().equals(ForkMode.ONCE)) { | |||||
testLists.addAll(executeOrQueue(getIndividualTests(), | testLists.addAll(executeOrQueue(getIndividualTests(), | ||||
forkPerTest)); | forkPerTest)); | ||||
} else { /* forkStyle.getValue().equals(ForkStyle.PER_BATCH) */ | |||||
} else { /* forkMode.getValue().equals(ForkMode.PER_BATCH) */ | |||||
final int count = batchTests.size(); | final int count = batchTests.size(); | ||||
for (int i = 0; i < count; i++) { | for (int i = 0; i < count; i++) { | ||||
BatchTest batchtest = (BatchTest) batchTests.elementAt(i); | BatchTest batchtest = (BatchTest) batchTests.elementAt(i); | ||||
@@ -1379,7 +1379,7 @@ public class JUnitTask extends Task { | |||||
* These are the different forking options | * These are the different forking options | ||||
* @since 1.6.2 | * @since 1.6.2 | ||||
*/ | */ | ||||
public static final class ForkStyle extends EnumeratedAttribute { | |||||
public static final class ForkMode extends EnumeratedAttribute { | |||||
/** | /** | ||||
* fork once only | * fork once only | ||||
@@ -1394,11 +1394,11 @@ public class JUnitTask extends Task { | |||||
*/ | */ | ||||
public static final String PER_BATCH = "perBatch"; | public static final String PER_BATCH = "perBatch"; | ||||
public ForkStyle() { | |||||
public ForkMode() { | |||||
super(); | super(); | ||||
} | } | ||||
public ForkStyle(String value) { | |||||
public ForkMode(String value) { | |||||
super(); | super(); | ||||
setValue(value); | setValue(value); | ||||
} | } | ||||