Index: tests/reliability/src/java/org/apache/harmony/test/reliability/share/LongRunningTestStarter.java =================================================================== --- tests/reliability/src/java/org/apache/harmony/test/reliability/share/LongRunningTestStarter.java (revision 582798) +++ tests/reliability/src/java/org/apache/harmony/test/reliability/share/LongRunningTestStarter.java (working copy) @@ -75,14 +75,17 @@ } long curTime = Calendar.getInstance().getTimeInMillis(); - long startTime = curTime; - long endTime = curTime + (int) (testTimeOut * 1000 * 0.9f); + long endTime = curTime + (int)(testTimeOut * 1000); long iterTime = 0; + long lastIterTime = 0; int iteration = 0; - try { - while (curTime < endTime) { - result = ((Test) Class.forName(testClassName).newInstance()).test(testArgs); + log.add("End iteration time: " + endTime); + try + { + while (curTime + iterTime < endTime) { + log.add("Current iteration time: " + curTime); + result = ((Test)Class.forName(testClassName).newInstance()).test(testArgs); System.gc(); if (result != Result.PASS) { @@ -92,12 +95,13 @@ return result; } + lastIterTime = Calendar.getInstance().getTimeInMillis() - curTime; + log.add("Last iteration time: " + lastIterTime); + if (iterTime < lastIterTime) { + log.add("New iteration time: " + lastIterTime); + iterTime = lastIterTime; + } curTime = Calendar.getInstance().getTimeInMillis(); - if (iteration == 0) { - iterTime = curTime - startTime; - long tmp = curTime + (int) (testTimeOut * 1000 - iterTime * 4); - endTime = tmp > endTime ? endTime : tmp; - } iteration++; } } catch (Exception e) {