You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by ti...@apache.org on 2017/11/20 21:52:23 UTC
svn commit: r1815861 - in /db/jdo/trunk: README.html
exectck/src/main/java/org/apache/jdo/exectck/Help.java
exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
Author: tilmannz
Date: Mon Nov 20 21:52:22 2017
New Revision: 1815861
URL: http://svn.apache.org/viewvc?rev=1815861&view=rev
Log:
Made TCK failure behavior configurable - JIRA #765
Modified:
db/jdo/trunk/README.html
db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java
db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
Modified: db/jdo/trunk/README.html
URL: http://svn.apache.org/viewvc/db/jdo/trunk/README.html?rev=1815861&r1=1815860&r2=1815861&view=diff
==============================================================================
--- db/jdo/trunk/README.html (original)
+++ db/jdo/trunk/README.html Mon Nov 20 21:52:22 2017
@@ -167,6 +167,7 @@ mvn jdo-exectck:<goal>
<DT>-Djdo.tck.doEnhance=<DD> Setting this parameter to false will bypass enhancement.
<DT>-Djdo.tck.doRunTCK=<DD> Setting this parameter to false will bypass running the TCK.
<DT>-Djdo.tck.runTCKVerbose=<DD> Setting this parameter to true will display test progress and error output while the TCK is running.
+ <DT>-Djdo.tck.onFailure=<DD> 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.
</DL>
<a name="examples"></a>
<h3>Examples</h3>
Modified: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java?rev=1815861&r1=1815860&r2=1815861&view=diff
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java (original)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/Help.java Mon Nov 20 21:52:22 2017
@@ -78,6 +78,11 @@ public class Help extends AbstractMojo{
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");
Modified: db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java?rev=1815861&r1=1815860&r2=1815861&view=diff
==============================================================================
--- db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java (original)
+++ db/jdo/trunk/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java Mon Nov 20 21:52:22 2017
@@ -44,6 +44,10 @@ import org.apache.maven.plugin.MojoFailu
*/
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 @@ public class RunTCK extends AbstractTCKM
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 @@ public class RunTCK extends AbstractTCKM
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
-
if (!doRunTCK) {
System.out.println("Skipping RunTCK goal!");
return;
@@ -296,6 +307,7 @@ public class RunTCK extends AbstractTCKM
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 @@ public class RunTCK extends AbstractTCKM
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 @@ public class RunTCK extends AbstractTCKM
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 @@ public class RunTCK extends AbstractTCKM
}
}
}
+ 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.");
+ }
}
}