You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/04/02 17:09:15 UTC

svn commit: r1308378 - /commons/proper/exec/trunk/src/test/java/org/apache/commons/exec/DefaultExecutorTest.java

Author: sebb
Date: Mon Apr  2 15:09:15 2012
New Revision: 1308378

URL: http://svn.apache.org/viewvc?rev=1308378&view=rev
Log:
Adjust timing again; was too coarse for Continuum

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=1308378&r1=1308377&r2=1308378&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 15:09:15 2012
@@ -1067,17 +1067,19 @@ public class DefaultExecutorTest extends
 
         int start = 0;
         final int seconds = 1;
+        final int offsetMultiplier = 3;
+        final int maxRetries = 50;
         int processTerminatedCounter = 0;
         int watchdogKilledProcessCounter = 0;
         CommandLine cmdLine = new CommandLine(pingScript);
         cmdLine.addArgument(Integer.toString(seconds + 1)); // need to add "1" to wait the requested number of seconds
 
-        for (int offset = start; offset <= 50; offset++) {
+        for (int offset = start; offset <= maxRetries; offset++) {
             // wait progressively longer for process to complete
             // tricky to get this test right. We want to try and catch the process while it is terminating,
             // so we increase the timeout gradually until the test terminates normally.
             // However if the increase is too gradual, we never wait long enough for any test to exit normally
-            ExecuteWatchdog watchdog = new ExecuteWatchdog(seconds * 1000 + offset * 5);
+            ExecuteWatchdog watchdog = new ExecuteWatchdog(seconds * 1000 + offset * offsetMultiplier);
             exec.setWatchdog(watchdog);
             try {
                 exec.execute(cmdLine);
@@ -1093,7 +1095,8 @@ public class DefaultExecutorTest extends
             }
         }
 
-        System.out.println("Processes terminated: "+processTerminatedCounter+" killed: "+watchdogKilledProcessCounter);
+        System.out.println("Processes terminated: "+processTerminatedCounter+" killed: "+watchdogKilledProcessCounter
+                +" Multiplier: "+offsetMultiplier+" MaxRetries: "+maxRetries);
         assertTrue("Not a single process terminated on its own", processTerminatedCounter > 0);
         assertTrue("Not a single process was killed by the watch dog", watchdogKilledProcessCounter > 0);
     }