Index: build.xml
===================================================================
--- build.xml (revision 577337)
+++ build.xml (working copy)
@@ -329,7 +329,8 @@
collect.output.to.summarize,
setup.efl,
generate.reports,
- duplicate.results.in.latest"
+ duplicate.results.in.latest,
+ exit.based.on.eut.status"
description="Processes JUnit reports and creates a summary">
@@ -373,6 +374,8 @@
classpath="${work.dir}/summary-reporter/classes"
classname="org.apache.harmony.eut.reporter.EUTReporter"
fork="true"
+ failonerror="false"
+ resultproperty="reporter.exit.code"
output="${work.dir}/r_output.txt">
@@ -405,6 +408,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java
===================================================================
--- summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java (revision 577337)
+++ summary-reporter/src/org/apache/harmony/eut/reporter/EUTReporter.java (working copy)
@@ -27,6 +27,12 @@
*/
public final class EUTReporter {
+ /* EUTReporter return codes. */
+ private static final int RETURN_EUT_PASSED = 0;
+ private static final int RETURN_EUT_FAILED = 1;
+ private static final int RETURN_USAGE_ERROR = 2;
+ private static final int RETURN_INTERNAL_ERROR = 3;
+
/** Keeps the list of test suites being processed. */
static ArrayList suiteList = new ArrayList();
@@ -54,7 +60,9 @@
System.err.println(" * .suites.properties file");
System.err.println(" * tested.java.version file");
System.err.println(" * running.java.version file");
- System.exit(1);
+ System.err.println("EUT SCRIPT: "
+ + "incorrect using of reporter or missed resources...");
+ System.exit(RETURN_USAGE_ERROR);
}
private static void checkFileExistance(File f) {
@@ -86,8 +94,26 @@
return String.valueOf(aliquot) + "." + fractionStr + "%";
}
- public static void main(String[] args) throws Exception {
+ /*
+ * The contruct for return code is:
+ * 0 - sucessfully generated report and EUT is PASSED
+ * 1 - sucessfully generated report and EUT is FAILED
+ * 2 - wrong usage (or input data is missed)
+ * 3 - unexpected parsing error (uncought throwable)
+ */
+ public static void main(String[] args) {
+ try {
+ main_unsafe(args);
+ } catch (Throwable e) {
+ System.err.println("EUT SCRIPT: "
+ + "Unexpected Error during EUT results parsing:" + e);
+ e.printStackTrace();
+ System.exit(RETURN_INTERNAL_ERROR);
+ }
+ }
+ private static void main_unsafe(String[] args) throws Exception {
+
// check the run arguments
if (args.length != 6) {
usage();
@@ -196,6 +222,17 @@
"report.txt");
EUTTXTReportEmitter.emitTXTReport(out, esi);
out.close();
- System.out.println("EUT summary report was successfully generated");
+ System.out.println("EUT SCRIPT: "
+ + "EUT summary report was successfully generated");
+
+ if (esi.tests_run_total == esi.ss.tests_reported_passed) {
+ System.out.println("EUT SCRIPT: "
+ + "No unexpected EUT issues detected");
+ System.exit(RETURN_EUT_PASSED);
+ } else {
+ System.err.println("EUT SCRIPT: "
+ + "Unexpected EUT issues are detected");
+ System.exit(RETURN_EUT_FAILED);
+ }
}
} // end of class 'EUTReporter' definition