aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2011-05-18 17:51:04 +0000
committeraclement <aclement>2011-05-18 17:51:04 +0000
commitfe6263f9f3261b53ada5189d0cb8f68a1e58dca2 (patch)
tree53fd0b5f7ac8106d53c55a28639bb42a8fcaf5bf
parente4f67df5e2efb3c03d45e8b2e99511176501083f (diff)
downloadaspectj-fe6263f9f3261b53ada5189d0cb8f68a1e58dca2.tar.gz
aspectj-fe6263f9f3261b53ada5189d0cb8f68a1e58dca2.zip
collect output from forked java task !!!!
-rw-r--r--testing/newsrc/org/aspectj/testing/AntSpec.java41
1 files changed, 40 insertions, 1 deletions
diff --git a/testing/newsrc/org/aspectj/testing/AntSpec.java b/testing/newsrc/org/aspectj/testing/AntSpec.java
index 7b76c3bf2..8bd62c0ef 100644
--- a/testing/newsrc/org/aspectj/testing/AntSpec.java
+++ b/testing/newsrc/org/aspectj/testing/AntSpec.java
@@ -11,7 +11,9 @@
*******************************************************************************/
package org.aspectj.testing;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileReader;
import java.util.StringTokenizer;
import org.apache.tools.ant.BuildEvent;
@@ -58,7 +60,7 @@ public class AntSpec implements ITestStep {
private String m_antFile;
private String m_antTarget;
- public void execute(AjcTestCase inTestCase) {
+ public void execute(final AjcTestCase inTestCase) {
final String failMessage = "test \"" + m_ajcTest.getTitle() + "\" failed: ";
File buildFile = new File(m_ajcTest.getDir() + File.separatorChar + m_antFile);
@@ -97,6 +99,43 @@ public class AntSpec implements ITestStep {
public void buildFinished(BuildEvent event) {
super.buildFinished(event);
if (event.getException() != null) {
+
+ try {
+ File antout = new File(inTestCase.getSandboxDirectory().getAbsolutePath(), "antout");
+ if (antout.exists()) {
+ stdout.append("Forked java command stdout:\n");
+ System.out.println("Forked java command stdout:");
+ FileReader fr = new FileReader(antout);
+ BufferedReader br = new BufferedReader(fr);
+ String line = br.readLine();
+ while (line != null) {
+ stdout.append(line).append("\n");
+ System.out.println(stdout);
+ line = br.readLine();
+ }
+ fr.close();
+ }
+
+ File anterr = new File(inTestCase.getSandboxDirectory().getAbsolutePath(), "anterr");
+ if (anterr.exists()) {
+ stdout.append("Forked java command stderr:\n");
+ System.out.println("Forked java command stderr:");
+ FileReader fr = new FileReader(anterr);
+ BufferedReader br = new BufferedReader(fr);
+ String line = br.readLine();
+ while (line != null) {
+ stdout.append(line).append("\n");
+ System.out.println(stdout);
+ line = br.readLine();
+ }
+ fr.close();
+ }
+ } catch (Exception e) {
+ System.out.println("Exception whilst loading forked java task output " + e.getMessage() + "\n");
+ e.printStackTrace();
+ stdout.append("Exception whilst loading forked java task output " + e.getMessage() + "\n");
+ }
+
StringBuffer message = new StringBuffer();
message.append(event.getException().toString()).append("\n");
message.append(verboseLog);