JDK-8202360 : [TESTBUG] runtime/LoadClass/TestResize.java needs to print output when it fails
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-04-27
  • Updated: 2019-06-20
  • Resolved: 2018-05-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b17Fixed
Related Reports
Relates :  
Description
On a local test run of all tests in /runtime I got the following failure:

----------System.out:(2/734)----------
Command line: [/export/users/dh198349/jdk-dev/open/test/hotspot/jtreg/../../../../build/linux-x64-debug/images/jdk/bin/java -cp /export/users/dh198349/jdk-dev/open/test/hotspot/jtreg/JTwork/classes/runtime/LoadClass/TestResize.d:/export/users/dh198349/jdk-dev/open/test/hotspot/jtreg/runtime/LoadClass:/export/users/dh198349/jdk-dev/open/test/hotspot/jtreg/JTwork/classes/test/lib:/export/users/dh198349/jdk-dev/open/test/lib:/net/scanas416.us.oracle.com/export/java_re2/misc/promoted/jtreg/4.2/fcs/b12/binaries/jtreg/lib/javatest.jar:/net/scanas416.us.oracle.com/export/java_re2/misc/promoted/jtreg/4.2/fcs/b12/binaries/jtreg/lib/jtreg.jar -XX:+PrintSystemDictionaryAtExit TriggerResize 50000 ]
PASS table_size:1009, classes:1161 OK
----------System.err:(14/974)----------
java.lang.RuntimeException: Load factor too high, expected MAX 5.0, got 467.30841121495325
	at TestResize.analyzeOutputOn(TestResize.java:86)
	at TestResize.main(TestResize.java:104)

But I have no idea how this came about because the test doesn't report the output from PrintSystemDictionaryAtExit. It should dump all the output before throwing the exception.
Comments
The output overflows jtreg by default: ... Output overflow: JT Harness has limited the test output to the text to that at the beginning and the end, so that you can see how the test began, and how it completed.
19-05-2018

Updated proposed fix: # hg diff diff -r 1dc98fa30b14 test/hotspot/jtreg/runtime/LoadClass/TestResize.java --- a/test/hotspot/jtreg/runtime/LoadClass/TestResize.java Tue May 15 14:35:51 2018 +0200 +++ b/test/hotspot/jtreg/runtime/LoadClass/TestResize.java Fri May 18 13:45:02 2018 -0500 @@ -70,7 +70,9 @@ Process process = pb.start(); BufferedReader rd = new BufferedReader(new InputStreamReader(process.getInputStream())); String line = rd.readLine(); + String string_out = ""; while (line != null) { + string_out += line+"\n"; if (line.startsWith("Java dictionary (")) { // ex. "Java dictionary (table_size=107, classes=6)" // ex. "Java dictionary (table_size=20201, classes=50002)" @@ -83,7 +85,12 @@ double loadFactor = (double)classes / (double)table_size; if (loadFactor > MAX_LOAD_FACTOR) { - throw new RuntimeException("Load factor too high, expected MAX "+MAX_LOAD_FACTOR+", got "+loadFactor); + System.out.println(string_out); + while (line != null) { + line = rd.readLine(); + System.out.println(line); + } + throw new RuntimeException("Load factor too high, expected MAX "+MAX_LOAD_FACTOR+", got "+loadFactor+" [table size "+table_size+", number of clases "+classes+"]"); } else { System.out.println("PASS table_size:"+table_size+", classes:"+classes+" OK"); }
18-05-2018

Attached TestResize.jtr showing the new output at failure. There are 2 new things to notice: #1 The exception itself now shows the table size and number of classes: java.lang.RuntimeException: Load factor too high, expected MAX 5.0, got 467.30841121495325 [table size 107, number of clases 50002] #2 Full output from PrintSystemDictionaryAtExit
18-05-2018

Proposed fix: # hg diff diff -r 1dc98fa30b14 test/hotspot/jtreg/runtime/LoadClass/TestResize.java --- a/test/hotspot/jtreg/runtime/LoadClass/TestResize.java Tue May 15 14:35:51 2018 +0200 +++ b/test/hotspot/jtreg/runtime/LoadClass/TestResize.java Wed May 16 12:20:52 2018 -0500 @@ -83,6 +83,9 @@ double loadFactor = (double)classes / (double)table_size; if (loadFactor > MAX_LOAD_FACTOR) { + Scanner scanner_out = new Scanner(process.getInputStream()).useDelimiter("\\A"); + String string_out = scanner_out.hasNext() ? scanner_out.next() : ""; + System.out.println(string_out); throw new RuntimeException("Load factor too high, expected MAX "+MAX_LOAD_FACTOR+", got "+loadFactor); } else { System.out.println("PASS table_size:"+table_size+", classes:"+classes+" OK");
16-05-2018