8214904: Test8004741.java failed due to "Too few ThreadDeath hits; expected at least 6 but saw only 5"

Reviewed-by: kvn, epavlova
This commit is contained in:
Igor Ignatyev 2019-11-15 14:22:24 -08:00
parent 7e2ec3bdc3
commit 733bb68c11
2 changed files with 29 additions and 40 deletions

View File

@ -54,7 +54,6 @@ compiler/types/correctness/CorrectnessTest.java 8225620 solaris-sparcv9
compiler/types/correctness/OffTest.java 8225620 solaris-sparcv9 compiler/types/correctness/OffTest.java 8225620 solaris-sparcv9
compiler/c2/Test6852078.java 8194310 generic-all compiler/c2/Test6852078.java 8194310 generic-all
compiler/c2/Test8004741.java 8214904 generic-all
compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,22 +22,33 @@
*/ */
/* /*
* @test Test8004741.java * @test
* @bug 8004741 * @bug 8004741
* @summary Missing compiled exception handle table entry for multidimensional array allocation * @summary Missing compiled exception handle table entry for multidimensional array allocation
* *
* @requires !vm.graal.enabled * @requires !vm.graal.enabled
* @library /test/lib
*
* @build sun.hotspot.WhiteBox
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
*
* @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers * -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
* -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100 * -XX:+SafepointALot -XX:GuaranteedSafepointInterval=100
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.c2.Test8004741 * compiler.c2.Test8004741
*
* @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions * @run main/othervm -Xmx128m -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions
* -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers * -XX:-TieredCompilation -XX:+StressCompiledExceptionHandlers
* -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
* compiler.c2.Test8004741 * compiler.c2.Test8004741
*/ */
package compiler.c2; package compiler.c2;
import sun.hotspot.WhiteBox;
public class Test8004741 extends Thread { public class Test8004741 extends Thread {
static int passed = 0; static int passed = 0;
@ -58,7 +69,7 @@ public class Test8004741 extends Thread {
} catch (ThreadDeath e) { } catch (ThreadDeath e) {
System.out.println("test got ThreadDeath"); System.out.println("test got ThreadDeath");
passed++; passed++;
throw(e); throw e;
} }
return ar; return ar;
} }
@ -84,15 +95,11 @@ public class Test8004741 extends Thread {
try { try {
progressLock.wait(); progressLock.wait();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); throw new Error("unexpected InterruptedException", e);
System.out.println("unexpected InterruptedException");
fail();
} }
} }
if (progressState > state) { if (progressState > state) {
System.out.println("unexpected test state change, expected " + throw new Error("unexpected test state change, state = " + state + ", progressState = " + progressState);
state + " but saw " + progressState);
fail();
} }
} }
} }
@ -114,9 +121,7 @@ public class Test8004741 extends Thread {
} catch (ThreadDeath e) { } catch (ThreadDeath e) {
// nothing to say, passing was incremented by the test. // nothing to say, passing was incremented by the test.
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); throw new Error("unexpected Throwable " + e, e);
System.out.println("unexpected Throwable " + e);
fail();
} }
toState(STOPPING); toState(STOPPING);
} }
@ -144,24 +149,22 @@ public class Test8004741 extends Thread {
test(2, 100); test(2, 100);
} }
// Will this sleep help ensure that the compiler is run? var method = Test8004741.class.getDeclaredMethod("test", int.class, int.class);
Thread.sleep(500); if (!WhiteBox.getWhiteBox().isMethodCompiled(method)) {
passed = 0; throw new Error("test method didn't get compiled");
}
try { try {
test(-1, 100); test(-1, 100);
System.out.println("Missing NegativeArraySizeException #1"); throw new AssertionError("Missing NegativeArraySizeException");
fail(); } catch (NegativeArraySizeException e) {
} catch ( java.lang.NegativeArraySizeException e ) {
System.out.println("Saw expected NegativeArraySizeException #1"); System.out.println("Saw expected NegativeArraySizeException #1");
} }
try { try {
test(100, -1); test(100, -1);
fail(); throw new AssertionError("Missing NegativeArraySizeException");
System.out.println("Missing NegativeArraySizeException #2"); } catch (NegativeArraySizeException e) {
fail();
} catch ( java.lang.NegativeArraySizeException e ) {
System.out.println("Saw expected NegativeArraySizeException #2"); System.out.println("Saw expected NegativeArraySizeException #2");
} }
@ -169,23 +172,10 @@ public class Test8004741 extends Thread {
* as long as it does not crash (the outcome if the exception range * as long as it does not crash (the outcome if the exception range
* table entry for the array allocation is missing). * table entry for the array allocation is missing).
*/ */
int N = 12; passed = 0;
for (int n = 0; n < N; n++) { int limit = 6;
while (passed != limit) {
threadTest(); threadTest();
} }
if (passed > N/2) {
System.out.println("Saw " + passed + " out of " + N + " possible ThreadDeath hits");
System.out.println("PASSED");
} else {
System.out.println("Too few ThreadDeath hits; expected at least " + N/2 +
" but saw only " + passed);
fail();
}
} }
}
static void fail() {
System.out.println("FAILED");
System.exit(97);
}
};