aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormwebster <mwebster>2006-08-14 15:52:16 +0000
committermwebster <mwebster>2006-08-14 15:52:16 +0000
commit0850eef4c7060de3848dfdfe90c8b6c7d3d2e75f (patch)
tree9ecd25a0d320b44084a515c772a5b1282cbf495b
parent6bf6295895351381b81fdf1cb625ea8e81032c1a (diff)
downloadaspectj-0850eef4c7060de3848dfdfe90c8b6c7d3d2e75f.tar.gz
aspectj-0850eef4c7060de3848dfdfe90c8b6c7d3d2e75f.zip
Bug 153772 "Support stdout/stderr specifications for the ant compiler test step"
-rw-r--r--testing/newsrc/org/aspectj/testing/AntSpec.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/testing/newsrc/org/aspectj/testing/AntSpec.java b/testing/newsrc/org/aspectj/testing/AntSpec.java
index ca95b4e26..8ea86cdb5 100644
--- a/testing/newsrc/org/aspectj/testing/AntSpec.java
+++ b/testing/newsrc/org/aspectj/testing/AntSpec.java
@@ -17,6 +17,8 @@ import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildEvent;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.taskdefs.Java;
import org.apache.tools.ant.types.Path;
import java.io.File;
@@ -109,13 +111,17 @@ public class AntSpec implements ITestStep {
}
}
public void messageLogged(BuildEvent event) {
- super.messageLogged(event);
- if (event.getTarget() != null && event.getPriority() >= Project.MSG_INFO && m_antTarget.equals(event.getTarget().getName())) {
- if (event.getException() == null) {
- stdout.append(event.getMessage()).append('\n');
- } else {
- stderr.append(event.getMessage());
- }
+ super.messageLogged(event);
+
+ Target target = event.getTarget();
+ if (target != null && m_antTarget.equals(target.getName()) && event.getSource() instanceof Java)
+ switch(event.getPriority()) {
+ case Project.MSG_INFO:
+ stdout.append(event.getMessage()).append('\n');
+ break;
+ case Project.MSG_WARN:
+ stderr.append(event.getMessage()).append('\n');
+ break;
}
}
};
@@ -136,14 +142,13 @@ public class AntSpec implements ITestStep {
AjcTestCase.fail(failMessage + "error when invoking target :" + t.toString());
}
- // match lines
- //TODO AV experimental: requires full match so rather useless.
- // if someone needs it, we ll have to impl a "include / exclude" stuff
- if (m_stdOutSpec != null)
+ /* See if stdout/stderr matches test specification */
+ if (m_stdOutSpec != null) {
m_stdOutSpec.matchAgainst(stdout.toString());
- // match lines
- if (m_stdErrSpec != null)
- m_stdErrSpec.matchAgainst(stdout.toString());
+ }
+ if (m_stdErrSpec != null) {
+ m_stdErrSpec.matchAgainst(stderr.toString());
+ }
}
public void addStdErrSpec(OutputSpec spec) {