Browse Source

Added dir attribute to <junit> and documentation for the one of <java>.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268012 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
4a9c1fbf6e
3 changed files with 32 additions and 0 deletions
  1. +6
    -0
      docs/index.html
  2. +6
    -0
      docs/junit.html
  3. +20
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java

+ 6
- 0
docs/index.html View File

@@ -2334,6 +2334,12 @@ the one that is currently running Ant.</p>
returncode other than 0. Only available if fork is true.</td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">The directory to invoke the VM in. (ignored if
fork is disabled)</td>
<td align="center" valign="top">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>arg and jvmarg</h4>


+ 6
- 0
docs/junit.html View File

@@ -64,6 +64,12 @@ elements</a>.</p>
Ignored if fork is disabled.</td>
<td align="center" valign="top">No, default &quot;java&quot;</td>
</tr>
<tr>
<td valign="top">dir</td>
<td valign="top">The directory to invoke the VM in. (ignored if
fork is disabled)</td>
<td align="center" valign="top">No</td>
</tr>
</table>

<h3><a name="nested">Nested Elements</a></h3>


+ 20
- 0
src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java View File

@@ -91,6 +91,7 @@ public class JUnitTask extends Task {
private Vector tests = new Vector();
private Vector batchTests = new Vector();
private Vector formatters = new Vector();
private File dir = null;

private Integer timeout = null;
private boolean summary = false;
@@ -161,6 +162,15 @@ public class JUnitTask extends Task {
formatters.addElement(fe);
}

/**
* The directory to invoke the VM in.
*
* <p>Ignored if fork=false.
*/
public void setDir(File dir) {
this.dir = dir;
}

/**
* Creates a new JUnitRunner and enables fork of a new Java VM.
*/
@@ -201,6 +211,12 @@ public class JUnitTask extends Task {
int exitValue = JUnitTestRunner.ERRORS;
if (!test.getFork()) {

if (dir != null) {
log("dir attribute ignored if running in the same VM",
Project.MSG_WARN);
}

JUnitTestRunner runner =
new JUnitTestRunner(test, test.getHaltonerror(),
test.getHaltonfailure());
@@ -283,6 +299,10 @@ public class JUnitTask extends Task {

Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), createWatchdog());
execute.setCommandline(cmd.getCommandline());
if (dir != null) {
execute.setWorkingDirectory(dir);
}
log("Executing: "+cmd.toString(), Project.MSG_VERBOSE);
try {
exitValue = execute.execute();


Loading…
Cancel
Save