Index: README.html
===================================================================
--- README.html (revision 1814292)
+++ README.html (working copy)
@@ -167,6 +167,7 @@
-Djdo.tck.doEnhance= Setting this parameter to false will bypass enhancement.
-Djdo.tck.doRunTCK= Setting this parameter to false will bypass running the TCK.
-Djdo.tck.runTCKVerbose= Setting this parameter to true will display test progress and error output while the TCK is running.
+ -Djdo.tck.onFailure= Specifies how test failures are treated. "failFast" will immediately abort the test run. "failGoal" (default) will execute the whole TCK before failing. "logOnly" will report failures to console and logs only but return 'SUCCESS' to the Maven execution environment.
Examples
Index: exectck/src/main/java/org/apache/jdo/exectck/Help.java
===================================================================
--- exectck/src/main/java/org/apache/jdo/exectck/Help.java (revision 1814292)
+++ exectck/src/main/java/org/apache/jdo/exectck/Help.java (working copy)
@@ -78,6 +78,11 @@
msg.append("* jdo.tck.runTCKVerbose\n");
msg.append(" Setting this parameter to true will display test progress and"
+ "error output while the TCK is running.\n");
+ msg.append("* jdo.tck.onFailure\n");
+ msg.append(" Specifies how test failures are treated. \"failFast\" will immediately abort the test run. "
+ + "\"failGoal\" (default) will execute the whole TCK (maven goal) before failing. "
+ + "\"logOnly\" will report failures to console and logs only but return 'SUCCESS' to the "
+ + "Maven execution environment.\n");
msg.append("\n To run the TCK on an implementation under test, \n"
+ " place all required jars and their dependencies in lib/iut\n"
+ " and set jdo.tck.impl to iut:\n");
Index: exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
===================================================================
--- exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (revision 1814292)
+++ exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (working copy)
@@ -44,6 +44,10 @@
*/
public class RunTCK extends AbstractTCKMojo {
+ private static final String TCK_PARAM_ON_FAILURE_FAIL_FAST = "failFast";
+ private static final String TCK_PARAM_ON_FAILURE_FAIL_EVENTUALLY = "failGoal";
+ private static final String TCK_PARAM_ON_FAILURE_LOG_ONLY = "logOnly";
+
/**
* To skip running of TCK, set to false.
* @parameter property="jdo.tck.doRunTCK"
@@ -61,6 +65,14 @@
private boolean runtckVerbose;
/**
+ * Define handling of TCK failures.
+ * @parameter property="jdo.tck.onFailure"
+ * default-value="failGoal"
+ * @required
+ */
+ private String onFailure;
+
+ /**
* Run the TCK in a debugger.
* @parameter property="jdo.tck.debugTCK"
* default-value=false
@@ -196,7 +208,6 @@
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
-
if (!doRunTCK) {
System.out.println("Skipping RunTCK goal!");
return;
@@ -296,6 +307,7 @@
Logger.getLogger(RunTCK.class.getName()).log(Level.SEVERE, null, ex);
}
+ int failureCount = 0;
for (String db : dbs) {
System.setProperty("jdo.tck.database", db);
alreadyran = false;
@@ -447,6 +459,7 @@
System.out.println("success");
} else {
System.out.println("FAIL");
+ failureCount++;
}
if (runtckVerbose) {
System.out.println("\nCommand line is: \n" + command.toString());
@@ -481,8 +494,17 @@
alreadyran = true;
}
+ if (TCK_PARAM_ON_FAILURE_FAIL_FAST.equals(onFailure) && failureCount > 0) {
+ break;
+ }
+ }
+ if (TCK_PARAM_ON_FAILURE_FAIL_FAST.equals(onFailure) && failureCount > 0) {
+ break;
}
}
+ if (TCK_PARAM_ON_FAILURE_FAIL_FAST.equals(onFailure) && failureCount > 0) {
+ break;
+ }
}
// Remove log file
try {
@@ -538,5 +560,11 @@
}
}
}
+ if (TCK_PARAM_ON_FAILURE_FAIL_FAST.equals(onFailure) && failureCount > 0) {
+ throw new MojoExecutionException("Aborted TCK test run after 1 failure.");
+ }
+ if (TCK_PARAM_ON_FAILURE_FAIL_EVENTUALLY.equals(onFailure) && failureCount > 0) {
+ throw new MojoExecutionException("There were " + failureCount + " TCK test failures.");
+ }
}
}