Author: sebb
Date: Mon Apr 2 14:36:30 2012
New Revision: 1308365
URL: http://svn.apache.org/viewvc?rev=1308365&view=rev
Log:
Fix timing issue - watchdog was not waiting long enough for process to complete.
Modified:
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
Modified:
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java?rev=1308365&r1=1308364&r2=1308365&view=diff
==============================================================================
---
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
(original)
+++
commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java
Mon Apr 2 14:36:30 2012
@@ -1062,9 +1062,8 @@ public class DefaultExecutorTest extends
* Possible deadlock when a process is terminating at the same time its
timing out. Please
* note that a successful test is no proof that the issues was indeed
fixed.
*
- * @throws Exception the test failed
*/
- public void testExec_60() throws IOException {
+ public void testExec_60() throws Exception {
int start = 0;
final int seconds = 1;
@@ -1074,7 +1073,8 @@ public class DefaultExecutorTest extends
cmdLine.addArgument(Integer.toString(seconds + 1)); // need to add "1"
to wait the requested number of seconds
for (int offset = start; offset <= 20; offset += 1) {
- ExecuteWatchdog watchdog = new ExecuteWatchdog(seconds * 1000 +
offset);
+ // wait progressively longer for process to complete
+ ExecuteWatchdog watchdog = new ExecuteWatchdog(seconds * 1000 +
offset * 10);
exec.setWatchdog(watchdog);
try {
exec.execute(cmdLine);
@@ -1090,6 +1090,7 @@ public class DefaultExecutorTest extends
}
}
+ System.out.println("Processes terminated: "+processTerminatedCounter+"
killed: "+watchdogKilledProcessCounter);
assertTrue("Not a single process terminated on its own",
processTerminatedCounter > 0);
assertTrue("Not a single process was killed by the watch dog",
watchdogKilledProcessCounter > 0);
}