changeset 1516:6179ef0cb94e

8079200: Fix heapdump tests to validate heapdump after jhat is removed Reviewed-by: sla
author ykantser
date Thu, 07 May 2015 16:11:04 +0200
parents 8b0cc5d855fb
children 9baf9f83c0d8
files test/lib/Makefile test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java
diffstat 2 files changed, 33 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/test/lib/Makefile	Sat May 02 18:35:36 2015 -0700
+++ b/test/lib/Makefile	Thu May 07 16:11:04 2015 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2013, 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
@@ -41,25 +41,38 @@
 JAVAC = $(JDK_HOME)/bin/javac
 JAR = $(JDK_HOME)/bin/jar
 
-SRC_FILES = $(shell find $(SRC_DIR) -name '*.java')
+WB_SRC_FILES = $(shell find $(SRC_DIR)/sun/hotspot -name '*.java')
+SHARE_SRC_FILES = $(shell find $(SRC_DIR)/share/classes -name '*.java')
 
-.PHONY: filelist clean cleantmp
+.PHONY: wb.filelist share.filelist clean cleantmp
 
-all: wb.jar cleantmp
+all: wb.jar test-lib.jar cleantmp
 
-wb.jar: filelist
+wb.jar: wb.filelist
 	@mkdir -p $(OUTPUT_DIR)
-	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @filelist
+	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @wb.filelist
 	$(JAR) cf wb.jar -C $(OUTPUT_DIR) .
 	@rm -rf $(OUTPUT_DIR)
 
-filelist: $(SRC_FILES)
+wb.filelist: $(WB_SRC_FILES)
 	@rm -f $@
-	@echo $(SRC_FILES) > $@
+	@echo $(WB_SRC_FILES) > $@
+
+test-lib.jar: share.filelist
+	@mkdir -p $(OUTPUT_DIR)
+	$(JAVAC) -sourcepath $(SRC_DIR) -d $(OUTPUT_DIR) -cp $(OUTPUT_DIR) @share.filelist
+	$(JAR) cf test-lib.jar -C $(OUTPUT_DIR) .
+	@rm -rf $(OUTPUT_DIR)
+
+share.filelist: $(SHARE_SRC_FILES)
+	@rm -f $@
+	@echo $(SHARE_SRC_FILES) > $@
 
 clean: cleantmp
 	@rm -rf wb.jar
+	@rm -rf test-list.jar
 
 cleantmp:
-	@rm -rf filelist
+	@rm -rf wb.filelist
+	@rm -rf share.filelist
 	@rm -rf $(BUILD_DIR)
--- a/test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java	Sat May 02 18:35:36 2015 -0700
+++ b/test/lib/share/classes/jdk/test/lib/hprof/HprofParser.java	Thu May 07 16:11:04 2015 +0200
@@ -36,6 +36,17 @@
  */
 public class HprofParser {
 
+    public static void main(String[] args) throws Exception {
+        if (args.length < 1) {
+            System.out.println("No arguments supplied");
+        }
+        File dump = new File(args[0]);
+        if (!dump.exists() || !dump.isFile()) {
+            throw new RuntimeException("The dump file does not exist or not a file");
+        }
+        parse(dump);
+    }
+
     /**
      * @see #parse(File, boolean, boolean, boolean)
      */