aboutsummaryrefslogtreecommitdiffstats
path: root/testing-drivers
diff options
context:
space:
mode:
authorwisberg <wisberg>2005-03-10 10:54:38 +0000
committerwisberg <wisberg>2005-03-10 10:54:38 +0000
commit3220c918da6f292b3ba09b180ea9e4444cdfe4cb (patch)
tree99941c5d8dac417473605f1d06d5db4b4445cd85 /testing-drivers
parent86bdc5747166cdf819d48e701ab0a853e94e45e7 (diff)
downloadaspectj-3220c918da6f292b3ba09b180ea9e4444cdfe4cb.tar.gz
aspectj-3220c918da6f292b3ba09b180ea9e4444cdfe4cb.zip
-exitOnFailure for System.exit(..) on failure, so release/build.xml can respond to test failures.
Diffstat (limited to 'testing-drivers')
-rw-r--r--testing-drivers/src/org/aspectj/testing/drivers/Harness.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/testing-drivers/src/org/aspectj/testing/drivers/Harness.java b/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
index 20421fe80..02dfd0a62 100644
--- a/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
+++ b/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
@@ -186,6 +186,9 @@ public class Harness {
/** if true, then log results in report(..) when done */
private boolean logResults;
+ /** if true and there were failures, do System.exit({numFailures})*/
+ private boolean exitOnFailure;
+
protected Harness() {
features = new HashMap();
}
@@ -283,9 +286,10 @@ public class Harness {
if (!skip) {
doStartSuite(suiteFile);
long elapsed = 0;
- try {
+ RunResult result = null;
+ try {
final long startTime = System.currentTimeMillis();
- RunResult result = run(spec);
+ result = run(spec);
if (null != resultList) {
resultList.add(result);
}
@@ -294,6 +298,17 @@ public class Harness {
} finally {
doEndSuite(suiteFile,elapsed);
}
+ if (exitOnFailure && (null != result)) {
+ int numFailures = RunUtils.numFailures(result.status, true);
+ if (0 < numFailures) {
+ System.exit(numFailures);
+ }
+ Object value = result.status.getResult();
+ if ((value instanceof Boolean)
+ && !((Boolean) value).booleanValue()) {
+ System.exit(-1);
+ }
+ }
}
}
}
@@ -462,6 +477,8 @@ public class Harness {
killTemp = true;
} else if ("-logResults".equals(option)) {
logResults = true;
+ } else if ("-exitOnFailure".equals(option)) {
+ exitOnFailure = true;
} else {
return false;
}
@@ -522,6 +539,7 @@ public class Harness {
out.println(" -quietHarness harness components suppress logging");
out.println(" -keepTemp do not delete temporary files");
out.println(" -logResults log results at end, verbosely if fail");
+ out.println(" -exitOnFailure do System.exit({num-failures}) if suite fails");
out.println(" {suiteFile}.xml.. specify test suite XML file");
out.println(" {suiteFile}.txt.. specify test suite .txt file (deprecated)");
}