14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.io.BufferedReader; 25 import java.io.File; 26 import java.io.FileNotFoundException; 27 import java.io.FileReader; 28 import java.io.IOException; 29 import java.io.Reader; 30 import java.nio.CharBuffer; 31 import java.util.Arrays; 32 import java.util.Scanner; 33 34 import com.oracle.java.testlibrary.Asserts; 35 import com.oracle.java.testlibrary.JDKToolFinder; 36 import com.oracle.java.testlibrary.JDKToolLauncher; 37 import com.oracle.java.testlibrary.OutputAnalyzer; 38 import com.oracle.java.testlibrary.Platform; 39 import com.oracle.java.testlibrary.ProcessTools; 40 41 /* 42 * @test 43 * @bug 6313383 44 * @key regression 45 * @summary Regression test for hprof export issue due to large heaps (>2G) 46 * @library /testlibrary 47 * @modules java.base/sun.misc 48 * java.compiler 49 * java.management/sun.management 50 * jdk.jvmstat/sun.jvmstat.monitor 51 * @build com.oracle.java.testlibrary.* JMapHProfLargeHeapProc 52 * @run main JMapHProfLargeHeapTest 53 */ 54 55 public class JMapHProfLargeHeapTest { 56 private static final String HEAP_DUMP_FILE_NAME = "heap.hprof"; 57 private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; 58 private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; 59 private static final long M = 1024L; 60 private static final long G = 1024L * M; 61 62 public static void main(String[] args) throws Exception { 63 // If we are on MacOSX, test if JMap tool is signed, otherwise return 64 // since test will fail with privilege error. 65 if (Platform.isOSX()) { 66 String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap"); 67 ProcessBuilder codesignProcessBuilder = new ProcessBuilder( 68 "codesign", "-v", jmapToolPath); 69 Process codesignProcess = codesignProcessBuilder.start(); 70 OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); 71 try { | 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 import java.io.BufferedReader; 25 import java.io.File; 26 import java.io.FileNotFoundException; 27 import java.io.FileReader; 28 import java.io.IOException; 29 import java.io.Reader; 30 import java.nio.CharBuffer; 31 import java.util.Arrays; 32 import java.util.Scanner; 33 34 import jdk.test.lib.Asserts; 35 import jdk.test.lib.JDKToolFinder; 36 import jdk.test.lib.JDKToolLauncher; 37 import jdk.test.lib.OutputAnalyzer; 38 import jdk.test.lib.Platform; 39 import jdk.test.lib.ProcessTools; 40 41 /* 42 * @test 43 * @bug 6313383 44 * @key regression 45 * @summary Regression test for hprof export issue due to large heaps (>2G) 46 * @library /testlibrary 47 * @modules java.base/sun.misc 48 * java.compiler 49 * java.management/sun.management 50 * jdk.jvmstat/sun.jvmstat.monitor 51 * @build jdk.test.lib.* JMapHProfLargeHeapProc 52 * @run main JMapHProfLargeHeapTest 53 */ 54 55 public class JMapHProfLargeHeapTest { 56 private static final String HEAP_DUMP_FILE_NAME = "heap.hprof"; 57 private static final String HPROF_HEADER_1_0_1 = "JAVA PROFILE 1.0.1"; 58 private static final String HPROF_HEADER_1_0_2 = "JAVA PROFILE 1.0.2"; 59 private static final long M = 1024L; 60 private static final long G = 1024L * M; 61 62 public static void main(String[] args) throws Exception { 63 // If we are on MacOSX, test if JMap tool is signed, otherwise return 64 // since test will fail with privilege error. 65 if (Platform.isOSX()) { 66 String jmapToolPath = JDKToolFinder.getTestJDKTool("jmap"); 67 ProcessBuilder codesignProcessBuilder = new ProcessBuilder( 68 "codesign", "-v", jmapToolPath); 69 Process codesignProcess = codesignProcessBuilder.start(); 70 OutputAnalyzer analyser = new OutputAnalyzer(codesignProcess); 71 try { |