# HG changeset patch # User iignatyev # Date 1431969168 -10800 # Mon May 18 20:12:48 2015 +0300 # Node ID 8fc6d3e907e23a18177d983173bd46841f609263 # Parent 92321d7c8a3e077356430e7cbfb5fe4a31e1d89e 8055269: java/lang/invoke/MethodHandles/CatchExceptionTest.java fails intermittently Reviewed-by: diff --git a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java --- a/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java +++ b/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java @@ -72,12 +72,6 @@ final int catchDrops) { this.testCase = testCase; this.dropped = catchDrops; - if (Helper.IS_VERBOSE) { - System.out.printf("CatchException::CatchException(%s, isVararg=%b " + - "argsCount=%d catchDrops=%d)%n", - testCase, isVararg, argsCount, catchDrops - ); - } MethodHandle thrower = testCase.thrower; int throwerLen = thrower.type().parameterCount(); List> classes; @@ -97,9 +91,11 @@ } public static void main(String[] args) throws Throwable { + System.out.println("classes = " + ARGS_CLASSES); + TestFactory factory = new TestFactory(); long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT); - // substract vm init time and reserve time for vm exit + // subtract vm init time and reserve time for vm exit timeout *= 0.9; TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d, () -> { @@ -131,6 +127,12 @@ } private void runTest() { + if (Helper.IS_VERBOSE) { + System.out.printf("CatchException(%s, isVararg=%b argsCount=%d " + + "dropped=%d)%n", + testCase, thrower.isVarargsCollector(), argsCount, dropped); + } + Helper.clear(); Object[] args = Helper.randomArgs( @@ -212,10 +214,7 @@ args = 1; } - if (Helper.IS_VERBOSE) { - System.out.printf("maxArgs = %d%nmaxDrops = %d%n", - maxArgs, maxDrops); - } + System.out.printf("maxArgs = %d%nmaxDrops = %d%n", maxArgs, maxDrops); constructorSize = TestCase.CONSTRUCTORS.size(); } @@ -243,7 +242,7 @@ /** * @return next test from test matrix: - * {varArgs, noVarArgs} x TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x {1, .., maxDrops} + * {varArgs, noVarArgs} x TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x {0, .., maxDrops} */ public CatchExceptionTest nextTest() { if (constructor < constructorSize) { @@ -256,7 +255,7 @@ return null; } if (dropArgs <= currentMaxDrops) { - if (dropArgs == 1) { + if (dropArgs == 0) { if (Helper.IS_THOROUGH || Helper.RNG.nextBoolean()) { ++dropArgs; return createTest(); @@ -271,8 +270,8 @@ } } - if (args <= maxArgs) { - dropArgs = 1; + if (args < maxArgs) { + dropArgs = 0; currentMaxDrops = Math.min(args, maxDrops); ++args; return createTest();