# HG changeset patch # User stefank # Date 1515761765 -3600 # Node ID c823eca266c3e98f3fb7d9e8162c4e30a7b6d76d # Parent 6ebef5cd0c8d3204884f59ed946fd199002a2104 8194925: NMT: SummarySanityCheck test can't parse values > max_jint Reviewed-by: shade, zgu diff -r 6ebef5cd0c8d -r c823eca266c3 test/hotspot/jtreg/runtime/NMT/SummarySanityCheck.java --- a/test/hotspot/jtreg/runtime/NMT/SummarySanityCheck.java Wed Jan 10 22:40:47 2018 +0100 +++ b/test/hotspot/jtreg/runtime/NMT/SummarySanityCheck.java Fri Jan 12 13:56:05 2018 +0100 @@ -63,8 +63,8 @@ throwTestException("Failed to parse jcmd output"); } - int totalCommitted = 0, totalReserved = 0; - int totalCommittedSum = 0, totalReservedSum = 0; + long totalCommitted = 0, totalReserved = 0; + long totalCommittedSum = 0, totalReservedSum = 0; // Match '- (reserved=KB, committed=KB) Pattern mtTypePattern = Pattern.compile("-\\s+(?[\\w\\s]+)\\(reserved=(?\\d+)KB,\\scommitted=(?\\d+)KB\\)"); @@ -76,16 +76,16 @@ Matcher totalMemoryMatcher = totalMemoryPattern.matcher(lines[i]); if (totalMemoryMatcher.matches()) { - totalCommitted = Integer.parseInt(totalMemoryMatcher.group("committed")); - totalReserved = Integer.parseInt(totalMemoryMatcher.group("reserved")); + totalCommitted = Long.parseLong(totalMemoryMatcher.group("committed")); + totalReserved = Long.parseLong(totalMemoryMatcher.group("reserved")); } else { throwTestException("Failed to match the expected groups in 'Total' memory part"); } } else if (lines[i].startsWith("-")) { Matcher typeMatcher = mtTypePattern.matcher(lines[i]); if (typeMatcher.matches()) { - int typeCommitted = Integer.parseInt(typeMatcher.group("committed")); - int typeReserved = Integer.parseInt(typeMatcher.group("reserved")); + long typeCommitted = Long.parseLong(typeMatcher.group("committed")); + long typeReserved = Long.parseLong(typeMatcher.group("reserved")); // Make sure reserved is always less or equals if (typeCommitted > typeReserved) { @@ -103,12 +103,12 @@ } // See if they add up correctly, rounding is a problem so make sure we're within +/- 8KB - int committedDiff = totalCommitted - totalCommittedSum; + long committedDiff = totalCommitted - totalCommittedSum; if (committedDiff > 8 || committedDiff < -8) { throwTestException("Total committed (" + totalCommitted + ") did not match the summarized committed (" + totalCommittedSum + ")" ); } - int reservedDiff = totalReserved - totalReservedSum; + long reservedDiff = totalReserved - totalReservedSum; if (reservedDiff > 8 || reservedDiff < -8) { throwTestException("Total reserved (" + totalReserved + ") did not match the summarized reserved (" + totalReservedSum + ")" ); }