bodewig 00/09/19 09:25:43
Modified: docs index.html junit.html src/main/org/apache/tools/ant/taskdefs/optional/junit JUnitTask.java Log: Added dir attribute to <junit> and documentation for the one of <java>. Revision Changes Path 1.108 +6 -0 jakarta-ant/docs/index.html Index: index.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/index.html,v retrieving revision 1.107 retrieving revision 1.108 diff -u -r1.107 -r1.108 --- index.html 2000/09/19 16:13:43 1.107 +++ index.html 2000/09/19 16:25:31 1.108 @@ -2334,6 +2334,12 @@ 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> 1.9 +6 -0 jakarta-ant/docs/junit.html Index: junit.html =================================================================== RCS file: /home/cvs/jakarta-ant/docs/junit.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- junit.html 2000/09/14 08:13:05 1.8 +++ junit.html 2000/09/19 16:25:32 1.9 @@ -64,6 +64,12 @@ Ignored if fork is disabled.</td> <td align="center" valign="top">No, default "java"</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> 1.10 +20 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java Index: JUnitTask.java =================================================================== RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- JUnitTask.java 2000/09/14 08:49:39 1.9 +++ JUnitTask.java 2000/09/19 16:25:40 1.10 @@ -91,6 +91,7 @@ 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; @@ -162,6 +163,15 @@ } /** + * 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. */ public JUnitTask() throws Exception { @@ -201,6 +211,12 @@ 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 @@ 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();