< prev index next >

test/sun/tools/jmap/BasicJMapTest.java

Print this page
rev 11744 : 8059047: Extract parser/validator from jhat for use in tests

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -23,19 +23,21 @@
 
 import java.io.File;
 import java.util.Arrays;
 
 import static jdk.testlibrary.Asserts.*;
+import jdk.test.lib.hprof.HprofParser;
 import jdk.testlibrary.JDKToolLauncher;
 import jdk.testlibrary.OutputAnalyzer;
 import jdk.testlibrary.ProcessTools;
 
 /*
  * @test
  * @bug 6321286
  * @summary Unit test for jmap utility
  * @library /lib/testlibrary
+ * @library /../../test/lib/share/classes/
  * @build jdk.testlibrary.*
  * @run main BasicJMapTest
  */
 public class BasicJMapTest {
 

@@ -74,10 +76,16 @@
         verifyDumpFile(dump);
     }
 
     private static void verifyDumpFile(File dump) {
         assertTrue(dump.exists() && dump.isFile(), "Could not create dump file");
+        try {
+            HprofParser.parse(dump);
+        } catch (Exception e) {
+            e.printStackTrace();
+            assertFalse(true, "Could not parse dump file");
+        }
         dump.delete();
     }
 
     private static OutputAnalyzer jmap(String... toolArgs) throws Exception {
         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jmap");
< prev index next >