diff --git a/common/autoconf/configure.ac b/common/autoconf/configure.ac index 27bc76a9b3e..0079a944dac 100644 --- a/common/autoconf/configure.ac +++ b/common/autoconf/configure.ac @@ -207,6 +207,7 @@ JDKOPT_SETUP_CODE_COVERAGE # Need toolchain to setup dtrace HOTSPOT_SETUP_DTRACE HOTSPOT_SETUP_JVM_FEATURES +HOTSPOT_ENABLE_DISABLE_GTEST ############################################################################### # diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh index b64d91f82de..ef4a2674e9f 100644 --- a/common/autoconf/generated-configure.sh +++ b/common/autoconf/generated-configure.sh @@ -688,6 +688,7 @@ LIBCXX STATIC_CXX_SETTING FIXPATH_DETACH_FLAG FIXPATH +BUILD_GTEST VALID_JVM_FEATURES JVM_FEATURES_custom JVM_FEATURES_zeroshark @@ -1198,6 +1199,7 @@ enable_native_coverage enable_dtrace with_jvm_features with_jvm_interpreter +enable_hotspot_gtest with_stdc__lib with_msvcr_dll with_msvcp_dll @@ -1992,6 +1994,7 @@ Optional Features: --enable-dtrace[=yes/no/auto] enable dtrace. Default is auto, where dtrace is enabled if all dependencies are present. + --disable-hotspot-gtest Disables building of the Hotspot unit tests --disable-freetype-bundling disable bundling of the freetype library with the build result [enabled on Windows or when using @@ -4298,6 +4301,11 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom" # +################################################################################ +# Check if gtest should be built +# + + # # Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -5072,7 +5080,7 @@ VS_SDK_PLATFORM_NAME_2013= #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1463500649 +DATE_WHEN_GENERATED=1463732692 ############################################################################### # @@ -53409,6 +53417,49 @@ fi + # Check whether --enable-hotspot-gtest was given. +if test "${enable_hotspot_gtest+set}" = set; then : + enableval=$enable_hotspot_gtest; +fi + + + if test -e "$HOTSPOT_TOPDIR/test/native"; then + GTEST_DIR_EXISTS="true" + else + GTEST_DIR_EXISTS="false" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Hotspot gtest unit tests should be built" >&5 +$as_echo_n "checking if Hotspot gtest unit tests should be built... " >&6; } + if test "x$enable_hotspot_gtest" = "xyes"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, forced" >&5 +$as_echo "yes, forced" >&6; } + BUILD_GTEST="true" + else + as_fn_error $? "Cannot build gtest without the test source" "$LINENO" 5 + fi + elif test "x$enable_hotspot_gtest" = "xno"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5 +$as_echo "no, forced" >&6; } + BUILD_GTEST="false" + elif test "x$enable_hotspot_gtest" = "x"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + BUILD_GTEST="true" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + BUILD_GTEST="false" + fi + else + as_fn_error $? "--enable-gtest must be either yes or no" "$LINENO" 5 + fi + + + + ############################################################################### # # Check dependencies for external and internal libraries. diff --git a/common/autoconf/hotspot.m4 b/common/autoconf/hotspot.m4 index 5d1b7467b10..18b6ec0aa21 100644 --- a/common/autoconf/hotspot.m4 +++ b/common/autoconf/hotspot.m4 @@ -306,3 +306,43 @@ AC_DEFUN_ONCE([HOTSPOT_VALIDATE_JVM_FEATURES], fi done ]) + +################################################################################ +# Check if gtest should be built +# +AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST], +[ + AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest], + [Disables building of the Hotspot unit tests])]) + + if test -e "$HOTSPOT_TOPDIR/test/native"; then + GTEST_DIR_EXISTS="true" + else + GTEST_DIR_EXISTS="false" + fi + + AC_MSG_CHECKING([if Hotspot gtest unit tests should be built]) + if test "x$enable_hotspot_gtest" = "xyes"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + AC_MSG_RESULT([yes, forced]) + BUILD_GTEST="true" + else + AC_MSG_ERROR([Cannot build gtest without the test source]) + fi + elif test "x$enable_hotspot_gtest" = "xno"; then + AC_MSG_RESULT([no, forced]) + BUILD_GTEST="false" + elif test "x$enable_hotspot_gtest" = "x"; then + if test "x$GTEST_DIR_EXISTS" = "xtrue"; then + AC_MSG_RESULT([yes]) + BUILD_GTEST="true" + else + AC_MSG_RESULT([no]) + BUILD_GTEST="false" + fi + else + AC_MSG_ERROR([--enable-gtest must be either yes or no]) + fi + + AC_SUBST(BUILD_GTEST) +]) diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in index 02b761ef037..cace1439818 100644 --- a/common/autoconf/spec.gmk.in +++ b/common/autoconf/spec.gmk.in @@ -237,7 +237,7 @@ VALID_JVM_FEATURES := @VALID_JVM_FEATURES@ VALID_JVM_VARIANTS := @VALID_JVM_VARIANTS@ # Control wether Hotspot builds gtest tests -BUILD_GTEST := true +BUILD_GTEST := @BUILD_GTEST@ # Control use of precompiled header in hotspot libjvm build USE_PRECOMPILED_HEADER := @USE_PRECOMPILED_HEADER@ diff --git a/make/GensrcModuleInfo.gmk b/make/GensrcModuleInfo.gmk index 2fbcdc6ab24..757b268758f 100644 --- a/make/GensrcModuleInfo.gmk +++ b/make/GensrcModuleInfo.gmk @@ -85,21 +85,29 @@ ifneq ($(MOD_FILES), ) MODS_REST := $(filter-out $(MODS_QUALIFIED_EXPORTS), $(MOD_FILE_CONTENTS)) # Filter the contents for modules that are actually being built - MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES))) - MODIFICATIONS := $(filter $(MODULES_FILTER), $(MODS_QUALIFIED_EXPORTS)) \ + ALL_MODULES_FILTER := $(addprefix %/, $(addsuffix ;, $(ALL_MODULES))) + MODIFICATIONS := $(filter $(ALL_MODULES_FILTER), $(MODS_QUALIFIED_EXPORTS)) \ $(MODS_REST) + # Returns non empty if the package exists in the current module + # Param 1 - Name of package with dots + PackageExists = \ + $(strip $(wildcard $(addsuffix $(subst .,/,/$(strip $1)), \ + $(MODULE_CLASSES_DIRS)))) + # Convert the modification lines into arguments for the modification tool. # Filter out modifications for non existing to-modules. $(foreach line, $(MODIFICATIONS), \ $(eval split_line := $(subst /,$(SPACE),$(line))) \ $(eval command := $(word 1, $(split_line))) \ $(eval package := $(patsubst %;,%,$(word 2, $(split_line)))) \ - $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \ - $(if $(to_module), \ - $(eval ARGS += -$(command) $(package)/$(to_module)) \ - , \ - $(eval ARGS += -$(command) $(package)) \ + $(if $(call PackageExists, $(package)), \ + $(eval to_module := $(patsubst %;,%,$(word 4, $(split_line)))) \ + $(if $(to_module), \ + $(eval ARGS += -$(command) $(package)/$(to_module)) \ + , \ + $(eval ARGS += -$(command) $(package)) \ + ) \ ) \ ) diff --git a/make/Images.gmk b/make/Images.gmk index 564f2b27ddb..92adf3013db 100644 --- a/make/Images.gmk +++ b/make/Images.gmk @@ -43,8 +43,9 @@ ALL_MODULES := $(call FindAllModules) $(eval $(call ReadImportMetaData)) -JRE_MODULES += $(filter-out $(MODULES_FILTER), $(BOOT_MODULES) $(PLATFORM_MODULES) $(JRE_TOOL_MODULES)) -JDK_MODULES += $(filter-out $(MODULES_FILTER), $(ALL_MODULES)) +JRE_MODULES += $(filter $(ALL_MODULES), $(BOOT_MODULES) \ + $(PLATFORM_MODULES) $(JRE_TOOL_MODULES)) +JDK_MODULES += $(ALL_MODULES) # Compact builds have additional modules COMPACT1_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec