8170878: JDK 9 fails to build when enabling Hotspot code coverage
authorerikj
Tue, 13 Dec 2016 12:31:43 +0100
changeset 42506 54b0b4fffab5
parent 42505 11439b0c0792
child 42507 a3499e58c108
8170878: JDK 9 fails to build when enabling Hotspot code coverage Reviewed-by: ihse
common/bin/compare.sh
make/Bundles.gmk
make/Jprt.gmk
make/Main.gmk
--- a/common/bin/compare.sh	Mon Dec 12 18:56:32 2016 -0800
+++ b/common/bin/compare.sh	Tue Dec 13 12:31:43 2016 +0100
@@ -509,30 +509,32 @@
             | $CUT -f 2 -d ' ' | $SED "s|$OTHER_UNZIPDIR/||g")
     fi
 
-    $RM -f $WORK_DIR/$ZIP_FILE.diffs
-    for file in $DIFFING_FILES; do
-        if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
-            diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
-        fi
-    done
+    if [ "$CMP_ZIPS_CONTENTS" = "true" ]; then
+        $RM -f $WORK_DIR/$ZIP_FILE.diffs
+        for file in $DIFFING_FILES; do
+            if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
+                diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
+            fi
+        done
 
-    if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
-        return_value=1
-        echo "        Differing files in $ZIP_FILE"
-        $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP 'differ$' | cut -f 2 -d ' ' | \
-            $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
-        $CAT $WORK_DIR/$ZIP_FILE.difflist
+        if [ -s "$WORK_DIR/$ZIP_FILE.diffs" ]; then
+            return_value=1
+            echo "        Differing files in $ZIP_FILE"
+            $CAT $WORK_DIR/$ZIP_FILE.diffs | $GREP 'differ$' | cut -f 2 -d ' ' | \
+                $SED "s|$OTHER_UNZIPDIR|            |g" > $WORK_DIR/$ZIP_FILE.difflist
+            $CAT $WORK_DIR/$ZIP_FILE.difflist
 
-        if [ -n "$SHOW_DIFFS" ]; then
-            for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
-                if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
-                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
-                elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
-                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
-                else
-                    LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
-                fi
-            done
+            if [ -n "$SHOW_DIFFS" ]; then
+                for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
+                    if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
+                        LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
+                    elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
+                        LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
+                    else
+                        LC_ALL=C $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
+                    fi
+                done
+            fi
         fi
     fi
 
@@ -1072,7 +1074,8 @@
     echo "-perms              Compare the permission bits on all files and directories"
     echo "-types              Compare the output of the file command on all files"
     echo "-general            Compare the files not convered by the specialized comparisons"
-    echo "-zips               Compare the contents of all zip files"
+    echo "-zips               Compare the contents of all zip files and files in them"
+    echo "-zips-names         Compare the file names inside all zip files"
     echo "-jars               Compare the contents of all jar files"
     echo "-libs               Compare all native libraries"
     echo "-execs              Compare all executables"
@@ -1100,6 +1103,7 @@
 CMP_TYPES=false
 CMP_GENERAL=false
 CMP_ZIPS=false
+CMP_ZIPS_CONTENTS=true
 CMP_JARS=false
 CMP_LIBS=false
 CMP_EXECS=false
@@ -1143,6 +1147,11 @@
             ;;
         -zips)
             CMP_ZIPS=true
+            CMP_ZIPS_CONTENTS=true
+            ;;
+        -zips-names)
+            CMP_ZIPS=true
+            CMP_ZIPS_CONTENTS=false
             ;;
         -jars)
             CMP_JARS=true
--- a/make/Bundles.gmk	Mon Dec 12 18:56:32 2016 -0800
+++ b/make/Bundles.gmk	Tue Dec 13 12:31:43 2016 +0100
@@ -43,16 +43,20 @@
 $(eval $(call IncludeCustomExtension, , Bundles-pre.gmk))
 ################################################################################
 # BUNDLE : Name of bundle to create
-# FILES : Files in BASE_DIR to add to bundle
-# SPECIAL_INCLUDES : List of directories inside BASE_DIR to look for additional
+# FILES : Files in BASE_DIRS to add to bundle
+# SPECIAL_INCLUDES : List of directories inside BASE_DIRS to look for additional
 #     files in. These files will not get proper dependency handling. Use when
 #     files or directories may contain spaces.
-# BASE_DIR : Base directory for the root dir in the bundle.
+# BASE_DIRS : Base directories for the root dir in the bundle.
 # SUBDIR : Optional name of root dir in bundle.
 SetupBundleFile = $(NamedParamsMacroTemplate)
 define SetupBundleFileBody
 
-  $1_RELATIVE_FILES := $$(patsubst $$($1_BASE_DIR)/%, %, $$($1_FILES))
+  $$(foreach d, $$($1_BASE_DIRS), \
+    $$(eval $1_$$d_RELATIVE_FILES := $$$$(patsubst $$d/%, %, \
+        $$$$(filter $$d/%, $$$$($1_FILES)))) \
+    $$(eval $1_$$d_LIST_FILE := $(SUPPORT_OUTPUTDIR)/bundles/_$1_$$$$(subst /,_,$$d_files)) \
+  )
 
   ifneq ($$(filter %.tar.gz, $$($1_BUNDLE_NAME)), )
     $1_TYPE := tar.gz
@@ -65,55 +69,65 @@
   $$(call SetIfEmpty, $1_UNZIP_DEBUGINFO, false)
 
   $(BUNDLES_OUTPUTDIR)/$$($1_BUNDLE_NAME): $$($1_FILES)
-	$$(eval $$(call ListPathsSafely, \
-	    $1_RELATIVE_FILES, \
-	    $(SUPPORT_OUTPUTDIR)/bundles/_$1_files))
+	$$(foreach d, $$($1_BASE_DIRS), \
+	  $$(eval $$(call ListPathsSafely, \
+	      $1_$$d_RELATIVE_FILES, $$($1_$$d_LIST_FILE))) \
+	)
 	$$(call MakeDir, $$(@D))
         ifneq ($$($1_SPECIAL_INCLUDES), )
 	  $$(foreach i, $$($1_SPECIAL_INCLUDES), \
-	      ($(CD) $$($1_BASE_DIR) && $(FIND) $$i \
-	          >> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; )
+	    $$(foreach d, $$d, \
+	      ($(CD) $$d && $(FIND) $$i \
+	          >> $(SUPPORT_OUTPUTDIR)/bundles/_$1_files ) ; ))
         endif
-        ifneq ($$($1_SUBDIR), )
-          ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO), tar.gz-true-false)
-	    $(CD) $$($1_BASE_DIR) \
-	        && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
-                    -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
-	            --transform 's|^|$$($1_SUBDIR)/|' $(TAR_IGNORE_EXIT_VALUE) ) \
-	        | $(GZIP) > $$@
-          else
-            # If a subdir has been specified, copy all files into a temporary
-            # location with this subdir before creating the tar file
-	    $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
-	    $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
-	    ( $(CD) $$($1_BASE_DIR) \
-	        && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
-	            $(TAR_IGNORE_EXIT_VALUE) ) \
-	        | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )
-            # Unzip any zipped debuginfo files
-            ifeq ($$($1_UNZIP_DEBUGINFO), true)
-	      for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
-	        $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
-	      done
-            endif
-            ifeq ($$($1_TYPE), tar.gz)
-	      $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
-	          ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) $$($1_SUBDIR) $(TAR_IGNORE_EXIT_VALUE) ) \
-	          | $(GZIP) > $$@
-            else ifeq ($$($1_TYPE), zip)
-	      $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
-            endif
+        ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO), .-zip-false)
+          # If no subdir is specified, zip can be done directly from BASE_DIRS.
+	  $$(foreach d, $$($1_BASE_DIRS), \
+	    ( $(CD) $$d \
+	    && $(ZIPEXE) -qru $$@ . -i@$$($1_$$d_LIST_FILE) \
+	    || test "$$$$?" = "12" )$$(NEWLINE))
+        else ifeq ($$($1_SUBDIR)-$$($1_TYPE)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
+            .-tar.gz-false-1)
+          # If no subdir is specified and only one BASE_DIR, tar.gz can be done
+          # directly from BASE_DIR.
+	  $(CD) $$($1_BASE_DIRS) \
+	      && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
+	          -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
+	          $(TAR_IGNORE_EXIT_VALUE) ) \
+	      | $(GZIP) > $$@
+        else ifeq ($$($1_TYPE)-$(TAR_SUPPORTS_TRANSFORM)-$$($1_UNZIP_DEBUGINFO)-$$(words $$($1_BASE_DIRS)), \
+            tar.gz-true-false-1)
+          # If only one BASE_DIR, but with a SUBDIR set, tar.gz can use the
+          # transform option to create bundle directly from the BASE_DIR.
+	  $(CD) $$($1_BASE_DIRS) \
+	      && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
+	          -$(TAR_INCLUDE_PARAM) $$($1_$$($1_BASE_DIRS)_LIST_FILE) \
+	          $$(if $$($1_SUBDIR), --transform 's|^|$$($1_SUBDIR)/|') \
+	          $(TAR_IGNORE_EXIT_VALUE) ) \
+	      | $(GZIP) > $$@
+        else
+          # In all other cases, need to copy all files into a temporary location
+          # before creation bundle.
+	  $(RM) -r $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
+	  $(MKDIR) -p $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR)
+	  $$(foreach d, $$($1_BASE_DIRS), \
+	    ( $(CD) $$d \
+	    && $(TAR) cf - -$(TAR_INCLUDE_PARAM) $$($1_$$d_LIST_FILE) \
+	        $(TAR_IGNORE_EXIT_VALUE) ) \
+	    | ( $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) && $(TAR) xf - )$$(NEWLINE) )
+          # Unzip any zipped debuginfo files
+          ifeq ($$($1_UNZIP_DEBUGINFO), true)
+	    for f in `$(FIND) $(SUPPORT_OUTPUTDIR)/bundles/$1/$$($1_SUBDIR) -name "*.diz"`; do \
+	      $(CD) $$$${f%/*} && $(UNZIP) -q $$$${f} && $(RM) $$$${f}; \
+	    done
           endif
-        else
           ifeq ($$($1_TYPE), tar.gz)
-	    $(CD) $$($1_BASE_DIR) \
-	        && ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
-	            -$(TAR_INCLUDE_PARAM) $(SUPPORT_OUTPUTDIR)/bundles/_$1_files \
-	            $(TAR_IGNORE_EXIT_VALUE) ) \
-	        | $(GZIP) > $$@
+	    $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && \
+	    ( $(TAR) cf - $(TAR_CREATE_EXTRA_PARAM) \
+	        $$(if $$($1_SUBDIR), $$($1_SUBDIR), .) $(TAR_IGNORE_EXIT_VALUE) ) \
+	    | $(GZIP) > $$@
           else ifeq ($$($1_TYPE), zip)
-	    $(CD) $$($1_BASE_DIR) \
-	        && $(ZIPEXE) -qr $$@ . -i@$(SUPPORT_OUTPUTDIR)/bundles/_$1_files
+	    $(CD) $(SUPPORT_OUTPUTDIR)/bundles/$1 && $(ZIPEXE) -qr $$@ .
           endif
         endif
 
@@ -219,7 +233,7 @@
       BUNDLE_NAME := $(JDK_BUNDLE_NAME), \
       FILES := $(JDK_BUNDLE_FILES), \
       SPECIAL_INCLUDES := $(JDK_SPECIAL_INCLUDES), \
-      BASE_DIR := $(JDK_IMAGE_DIR), \
+      BASE_DIRS := $(JDK_IMAGE_DIR), \
       SUBDIR := $(JDK_BUNDLE_SUBDIR), \
   ))
 
@@ -228,7 +242,7 @@
   $(eval $(call SetupBundleFile, BUILD_JRE_BUNDLE, \
       BUNDLE_NAME := $(JRE_BUNDLE_NAME), \
       FILES := $(JRE_BUNDLE_FILES), \
-      BASE_DIR := $(JRE_IMAGE_DIR), \
+      BASE_DIRS := $(JRE_IMAGE_DIR), \
       SUBDIR := $(JRE_BUNDLE_SUBDIR), \
   ))
 
@@ -237,7 +251,7 @@
   $(eval $(call SetupBundleFile, BUILD_JDK_SYMBOLS_BUNDLE, \
       BUNDLE_NAME := $(JDK_SYMBOLS_BUNDLE_NAME), \
       FILES := $(JDK_SYMBOLS_BUNDLE_FILES), \
-      BASE_DIR := $(JDK_IMAGE_DIR), \
+      BASE_DIRS := $(JDK_IMAGE_DIR) $(wildcard $(SYMBOLS_IMAGE_DIR)), \
       SUBDIR := $(JDK_BUNDLE_SUBDIR), \
       UNZIP_DEBUGINFO := true, \
   ))
@@ -247,7 +261,7 @@
   $(eval $(call SetupBundleFile, BUILD_JRE_SYMBOLS_BUNDLE, \
       BUNDLE_NAME := $(JRE_SYMBOLS_BUNDLE_NAME), \
       FILES := $(JRE_SYMBOLS_BUNDLE_FILES), \
-      BASE_DIR := $(JRE_IMAGE_DIR), \
+      BASE_DIRS := $(JRE_IMAGE_DIR), \
       SUBDIR := $(JRE_BUNDLE_SUBDIR), \
       UNZIP_DEBUGINFO := true, \
   ))
@@ -257,7 +271,7 @@
   $(eval $(call SetupBundleFile, BUILD_DEMOS_BUNDLE, \
       BUNDLE_NAME := $(DEMOS_BUNDLE_NAME), \
       FILES := $(DEMOS_BUNDLE_FILES), \
-      BASE_DIR := $(JDK_IMAGE_DIR), \
+      BASE_DIRS := $(JDK_IMAGE_DIR), \
       SUBDIR := $(JDK_BUNDLE_SUBDIR), \
   ))
 
@@ -272,7 +286,7 @@
   $(eval $(call SetupBundleFile, BUILD_TEST_BUNDLE, \
       BUNDLE_NAME := $(TEST_BUNDLE_NAME), \
       FILES := $(TEST_BUNDLE_FILES), \
-      BASE_DIR := $(TEST_IMAGE_DIR), \
+      BASE_DIRS := $(TEST_IMAGE_DIR), \
   ))
 
   TEST_TARGETS += $(BUILD_TEST_BUNDLE)
@@ -286,7 +300,7 @@
   $(eval $(call SetupBundleFile, BUILD_DOCS_BUNDLE, \
       BUNDLE_NAME := $(DOCS_BUNDLE_NAME), \
       FILES := $(DOCS_BUNDLE_FILES), \
-      BASE_DIR := $(DOCS_IMAGE_DIR), \
+      BASE_DIRS := $(DOCS_IMAGE_DIR), \
       SUBDIR := docs, \
   ))
 
--- a/make/Jprt.gmk	Mon Dec 12 18:56:32 2016 -0800
+++ b/make/Jprt.gmk	Tue Dec 13 12:31:43 2016 +0100
@@ -81,7 +81,6 @@
   # Optional symbols bundle
   ifeq ($(GCOV_ENABLED), true)
     jprt_bundle: $(JPRT_ARCHIVE_SYMBOLS_BUNDLE)
-    zip-bundles: $(SYMBOLS_ZIP_BUNDLE)
 
     $(JPRT_ARCHIVE_SYMBOLS_BUNDLE): product-images
 	$(call MakeDir, $(@D))
--- a/make/Main.gmk	Mon Dec 12 18:56:32 2016 -0800
+++ b/make/Main.gmk	Tue Dec 13 12:31:43 2016 +0100
@@ -689,6 +689,7 @@
 
   jdk-image: jmods zip-source demos samples release-file
   jre-image: jmods release-file
+  symbols-image: $(LIBS_TARGETS) $(LAUNCHER_TARGETS)
 
   profiles: jmods release-file