8194925: NMT: SummarySanityCheck test can't parse values > max_jint
authorstefank
Fri, 12 Jan 2018 13:56:05 +0100
changeset 48782 c823eca266c3
parent 48781 6ebef5cd0c8d
child 48783 bade224cc81e
8194925: NMT: SummarySanityCheck test can't parse values > max_jint Reviewed-by: shade, zgu
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 '- <mtType> (reserved=<reserved>KB, committed=<committed>KB)
     Pattern mtTypePattern = Pattern.compile("-\\s+(?<typename>[\\w\\s]+)\\(reserved=(?<reserved>\\d+)KB,\\scommitted=(?<committed>\\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 + ")" );
     }