diff options
author | wisberg <wisberg> | 2003-06-02 05:23:53 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-06-02 05:23:53 +0000 |
commit | 46323d9c1d74bdc6053cd1db8084974004e512f7 (patch) | |
tree | 7f539e9305a9ed91b87e29c6613db45c9391e857 /testing/src | |
parent | ad708998c210421ad40c8392856980c16047b70e (diff) | |
download | aspectj-46323d9c1d74bdc6053cd1db8084974004e512f7.tar.gz aspectj-46323d9c1d74bdc6053cd1db8084974004e512f7.zip |
javarun attributes for interpreting error/output streams as errors, used only when forking
Diffstat (limited to 'testing/src')
-rw-r--r-- | testing/src/org/aspectj/testing/harness/bridge/JavaRun.java | 52 | ||||
-rw-r--r-- | testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java | 4 |
2 files changed, 51 insertions, 5 deletions
diff --git a/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java index 43c5db4c9..76785b464 100644 --- a/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java @@ -143,6 +143,13 @@ public class JavaRun implements IAjcRun { ClassLoader loader = null; URL[] urls = FileUtil.getFileURLs(libs); boolean completedNormally = false; + if (spec.outStreamIsError) { + // XXX implement same-vm stream snooping + // strictly speaking, also warn for errStream, but + // it is on by default (in same-VM, Tester controls; + // in other-vm stream-snooping controls) + MessageUtil.info(status, "unimplemented: stream-based error implemented in same vm"); + } Class targetClass = null; try { loader = new TestClassLoader(urls, dirs); @@ -281,7 +288,10 @@ public class JavaRun implements IAjcRun { commandLabel.append(Arrays.asList(controller.getCommand()).toString()); final ByteArrayOutputStream errSnoop = new ByteArrayOutputStream(); + final ByteArrayOutputStream outSnoop + = new ByteArrayOutputStream(); controller.setErrSnoop(errSnoop); + controller.setOutSnoop(outSnoop); controller.start(); // give it 3 minutes... long maxTime = System.currentTimeMillis() + 3 * 60 * 1000; @@ -305,10 +315,24 @@ public class JavaRun implements IAjcRun { } } if (0 < errSnoop.size()) { - MessageUtil.error(handler, errSnoop.toString()); - if (!doneFlag.failed) { - doneFlag.failed = true; - } + if (spec.errStreamIsError) { + MessageUtil.error(handler, errSnoop.toString()); + if (!doneFlag.failed) { + doneFlag.failed = true; + } + } else { + MessageUtil.info(handler, "Error stream: " + errSnoop.toString()); + } + } + if (0 < outSnoop.size()) { + if (spec.outStreamIsError) { + MessageUtil.error(handler, outSnoop.toString()); + if (!doneFlag.failed) { + doneFlag.failed = true; + } + } else { + MessageUtil.info(handler, "Output stream: " + outSnoop.toString()); + } } if (doneFlag.failed) { MessageUtil.info(handler, "other-vm command-line: " + commandLabel); @@ -409,6 +433,12 @@ public class JavaRun implements IAjcRun { /** if true, skip Tester setup (e.g., if Tester n/a) */ protected boolean skipTester; + /** if true, report text to output stream as error */ + protected boolean outStreamIsError; + + /** if true, report text to error stream as error */ + protected boolean errStreamIsError = true; + public Spec() { super(XMLNAME); setXMLNames(NAMES); @@ -428,6 +458,14 @@ public class JavaRun implements IAjcRun { this.className = className; } + public void setErrStreamIsError(boolean errStreamIsError) { + this.errStreamIsError = errStreamIsError; + } + + public void setOutStreamIsError(boolean outStreamIsError) { + this.outStreamIsError = outStreamIsError; + } + /** @param skip if true, then do not set up Tester */ public void setSkipTester(boolean skip) { skipTester = skip; @@ -467,6 +505,12 @@ public class JavaRun implements IAjcRun { if (null != javaVersion) { out.printAttribute("vm", javaVersion); } + if (outStreamIsError) { + out.printAttribute("outStreamIsError", "true"); + } + if (!errStreamIsError) { // defaults to true + out.printAttribute("errStreamIsError", "false"); + } super.writeAttributes(out); out.endAttributes(); if (!LangUtil.isEmpty(dirChanges)) { diff --git a/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java b/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java index 9736486c1..63d324149 100644 --- a/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java +++ b/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java @@ -395,7 +395,9 @@ public class AjcSpecXmlReader { jrunspec.addMessage((IMessage) null); // input s.b. interpretable by Boolean.valueOf(String) jrunspec.setSkipTester(true); - + jrunspec.setErrStreamIsError(true); + jrunspec.setOutStreamIsError(true); + DirChanges.Spec dcspec = new DirChanges.Spec(); dcspec.setAdded((String) null); dcspec.setRemoved((String) null); |