Browse Source

Don't ignore the extension attribute for formatters when forking

multiple JUnit tests in a single VM.

PR: 32973


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278057 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 20 years ago
parent
commit
b47a31a210
3 changed files with 24 additions and 1 deletions
  1. +3
    -0
      WHATSNEW
  2. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  3. +16
    -0
      src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java

+ 3
- 0
WHATSNEW View File

@@ -450,6 +450,9 @@ Fixed bugs:
* <xslt> failed to process file-hierarchies of more than one level if * <xslt> failed to process file-hierarchies of more than one level if
scanincludeddirectories was true. Bugzilla Report 24866. scanincludeddirectories was true. Bugzilla Report 24866.


* forkmode="perBatch" or "once" would ignore extension attributes that
had been specified for <formatter>s. Bugzilla Report 32973.

Changes from Ant 1.6.1 to Ant 1.6.2 Changes from Ant 1.6.1 to Ant 1.6.2
=================================== ===================================




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

@@ -1183,7 +1183,11 @@ public class JUnitTask extends Task {
*/ */
protected File getOutput(FormatterElement fe, JUnitTest test) { protected File getOutput(FormatterElement fe, JUnitTest test) {
if (fe.getUseFile()) { if (fe.getUseFile()) {
String filename = test.getOutfile() + fe.getExtension();
String base = test.getOutfile();
if (base == null) {
base = JUnitTestRunner.IGNORED_FILE_NAME;
}
String filename = base + fe.getExtension();
File destFile = new File(test.getTodir(), filename); File destFile = new File(test.getTodir(), filename);
String absFilename = destFile.getAbsolutePath(); String absFilename = destFile.getAbsolutePath();
return getProject().resolveFile(absFilename); return getProject().resolveFile(absFilename);


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

@@ -79,6 +79,15 @@ public class JUnitTestRunner implements TestListener {
*/ */
public static final int ERRORS = 2; public static final int ERRORS = 2;


/**
* Used in formatter arguments as a placeholder for the basename
* of the output file (which gets replaced by a test specific
* output file name later).
*
* @since Ant 1.6.3
*/
public static final String IGNORED_FILE_NAME = "IGNORETHIS";

/** /**
* Holds the registered formatters. * Holds the registered formatters.
*/ */
@@ -599,6 +608,13 @@ public class JUnitTestRunner implements TestListener {
fe.setUseFile(true); fe.setUseFile(true);
if (!multipleTests) { if (!multipleTests) {
fe.setOutfile(new File(line.substring(pos + 1))); fe.setOutfile(new File(line.substring(pos + 1)));
} else {
int fName = line.indexOf(IGNORED_FILE_NAME);
if (fName > -1) {
fe.setExtension(line
.substring(fName
+ IGNORED_FILE_NAME.length()));
}
} }
} }
fromCmdLine.addElement(fe); fromCmdLine.addElement(fe);


Loading…
Cancel
Save