< prev index next >

test/java/lang/invoke/MethodHandles/CatchExceptionTest.java

Print this page
rev 11972 : 8055269: java/lang/invoke/MethodHandles/CatchExceptionTest.java fails intermittently
Reviewed-by:

*** 70,85 **** public CatchExceptionTest(TestCase testCase, final boolean isVararg, final int argsCount, 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<Class<?>> classes; int extra = Math.max(0, argsCount - throwerLen); classes = getThrowerParams(isVararg, extra); --- 70,79 ----
*** 95,107 **** catcher = testCase.getCatcher(getCatcherParams()); nargs = Math.max(2, this.argsCount); } public static void main(String[] args) throws Throwable { 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 timeout *= 0.9; TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d, () -> { CatchExceptionTest test = factory.nextTest(); if (test != null) { --- 89,103 ---- catcher = testCase.getCatcher(getCatcherParams()); nargs = Math.max(2, this.argsCount); } 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); ! // subtract vm init time and reserve time for vm exit timeout *= 0.9; TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d, () -> { CatchExceptionTest test = factory.nextTest(); if (test != null) {
*** 129,138 **** --- 125,140 ---- result.add(0, testCase.throwableClass); return result; } 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( argsCount, thrower.type().parameterArray()); Object arg0 = Helper.MISSING_ARG;
*** 210,223 **** + Helper.RNG.nextInt(maxArgs - MIN_TESTED_ARITY) + 1; args = 1; } ! if (Helper.IS_VERBOSE) { ! System.out.printf("maxArgs = %d%nmaxDrops = %d%n", ! maxArgs, maxDrops); ! } constructorSize = TestCase.CONSTRUCTORS.size(); } private static List<CatchExceptionTest> createTests(int argsCount, int catchDrops) { --- 212,222 ---- + Helper.RNG.nextInt(maxArgs - MIN_TESTED_ARITY) + 1; args = 1; } ! System.out.printf("maxArgs = %d%nmaxDrops = %d%n", maxArgs, maxDrops); constructorSize = TestCase.CONSTRUCTORS.size(); } private static List<CatchExceptionTest> createTests(int argsCount, int catchDrops) {
*** 241,251 **** return result; } /** * @return next test from test matrix: ! * {varArgs, noVarArgs} x TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x {1, .., maxDrops} */ public CatchExceptionTest nextTest() { if (constructor < constructorSize) { return createTest(); } --- 240,250 ---- return result; } /** * @return next test from test matrix: ! * {varArgs, noVarArgs} x TestCase.rtypes x TestCase.THROWABLES x {1, .., maxArgs } x {0, .., maxDrops} */ public CatchExceptionTest nextTest() { if (constructor < constructorSize) { return createTest(); }
*** 254,264 **** if (!Helper.IS_THOROUGH && count > Helper.TEST_LIMIT) { System.out.println("test limit is exceeded"); return null; } if (dropArgs <= currentMaxDrops) { ! if (dropArgs == 1) { if (Helper.IS_THOROUGH || Helper.RNG.nextBoolean()) { ++dropArgs; return createTest(); } else if (Helper.IS_VERBOSE) { System.out.printf( --- 253,263 ---- if (!Helper.IS_THOROUGH && count > Helper.TEST_LIMIT) { System.out.println("test limit is exceeded"); return null; } if (dropArgs <= currentMaxDrops) { ! if (dropArgs == 0) { if (Helper.IS_THOROUGH || Helper.RNG.nextBoolean()) { ++dropArgs; return createTest(); } else if (Helper.IS_VERBOSE) { System.out.printf(
*** 269,280 **** ++dropArgs; return createTest(); } } ! if (args <= maxArgs) { ! dropArgs = 1; currentMaxDrops = Math.min(args, maxDrops); ++args; return createTest(); } return null; --- 268,279 ---- ++dropArgs; return createTest(); } } ! if (args < maxArgs) { ! dropArgs = 0; currentMaxDrops = Math.min(args, maxDrops); ++args; return createTest(); } return null;
< prev index next >