< prev index next >

make/RunTestsPrebuilt.gmk

Print this page


   1 #
   2 # Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  78   # and if wildcard is empty, then complain that the file is missing.
  79   ifeq ($3, MKDIR)
  80     ifneq ($$(findstring $$(LOG), info debug trace), )
  81       $$(info Creating directory for $1)
  82     endif
  83     $$(shell mkdir -p $$($1))
  84   else ifneq ($3, NO_CHECK)
  85     ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
  86       $$(info Error: Prebuilt variable $1 points to missing file/directory:)
  87       $$(info '$$($1)')
  88       $$(error Cannot continue.)
  89     endif
  90   endif
  91 endef
  92 
  93 # Create an ephemeral spec file
  94 #
  95 # $1: The output file name
  96 # $2..$N: The lines to output to the file
  97 define CreateNewSpec
  98   $(if $(strip $(33)), \
  99     $(error Internal makefile error: \
 100       Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
 101   ) \
 102   $(shell $(RM) $1) \
 103   $(foreach i, $(call sequence, 2, 32), \
 104     $(if $(strip $($i)), \
 105       $(call AppendFile, $(strip $($i)), $1) \
 106     ) \
 107   )
 108 endef
 109 
 110 ################################################################################
 111 # Check input and setup basic buildsystem support
 112 ################################################################################
 113 
 114 # Verify that user has given correct additional input.
 115 
 116 # These variables are absolutely necessary
 117 $(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
 118 $(eval $(call SetupVariable,BOOT_JDK))
 119 $(eval $(call SetupVariable,JT_HOME))
 120 
 121 # These can have default values based on the ones above
 122 $(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
 123 $(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))


 220   PATH_SEP:=:
 221 endif
 222 
 223 # Check number of cores and memory in MB
 224 ifeq ($(OPENJDK_TARGET_OS), linux)
 225   NUM_CORES := $(shell $(CAT) /proc/cpuinfo  | $(GREP) -c processor)
 226   MEMORY_SIZE := $(shell \
 227       $(EXPR) `$(CAT) /proc/meminfo | $(GREP) MemTotal | $(AWK) '{print $$2}'` / 1024 \
 228   )
 229 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 230   NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
 231   MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
 232 else ifeq ($(OPENJDK_TARGET_OS), solaris)
 233   NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
 234   MEMORY_SIZE := $(shell \
 235       /usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
 236   )
 237 else ifeq ($(OPENJDK_TARGET_OS), windows)
 238   NUM_CORES := $(NUMBER_OF_PROCESSORS)
 239   MEMORY_SIZE := $(shell \
 240       $(EXPR) `wmic computersystem get totalphysicalmemory -value \
 241           | $(GREP) = | $(SED) 's/\\r//g' \
 242           | $(CUT) -d "=" -f 2-` / 1024 / 1024 \
 243   )
 244 endif
 245 ifeq ($(NUM_CORES), )
 246   $(warn Could not find number of CPUs, assuming 1)
 247   NUM_CORES := 1
 248 endif
 249 ifeq ($(MEMORY_SIZE), )
 250   $(warn Could not find memory size, assuming 1024 MB)
 251   MEMORY_SIZE := 1024
 252 endif
 253 
 254 # Setup LD for AOT support
 255 ifneq ($(DEVKIT_HOME), )
 256   ifeq ($(OPENJDK_TARGET_OS), windows)
 257     LD_JAOTC := $(DEVKIT_HOME)/VC/bin/x64/link.exe
 258     LIBRARY_PREFIX :=
 259     SHARED_LIBRARY_SUFFIX := .dll

 260   else ifeq ($(OPENJDK_TARGET_OS), linux)
 261     LD_JAOTC := $(DEVKIT_HOME)/bin/ld
 262     LIBRARY_PREFIX := lib
 263     SHARED_LIBRARY_SUFFIX := .so

 264   else ifeq ($(OPENJDK_TARGET_OS), macosx)
 265     LD_JAOTC := $(DEVKIT_HOME)/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
 266     LIBRARY_PREFIX := lib
 267     SHARED_LIBRARY_SUFFIX := .dylib

 268   else ifeq ($(OPENJDK_TARGET_OS), solaris)
 269     # Prefer system linker for AOT on Solaris.
 270     LD_JAOTC := ld
 271     LIBRARY_PREFIX := lib
 272     SHARED_LIBRARY_SUFFIX := .so

 273   endif
 274 else
 275   LD := ld
 276 endif
 277 
 278 ifneq ($(wildcard $(JDK_IMAGE_DIR)/template.xml), )
 279   TEST_OPTS_JCOV := true
 280   JCOV_IMAGE_DIR := $(JDK_IMAGE_DIR)
 281 else
 282   TEST_OPTS_JCOV := false
 283   JCOV_IMAGE_DIR :=
 284 endif
 285 
 286 ################################################################################
 287 # Generate the ephemeral spec file
 288 ################################################################################
 289 
 290 # Now we can include additional custom support.
 291 # This might define CUSTOM_NEW_SPEC_LINE
 292 ifneq ($(CUSTOM_MAKE_DIR), )
 293   include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
 294 endif
 295 
 296 NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
 297 
 298 $(call CreateNewSpec, $(NEW_SPEC), \
 299     # Generated file -- do not edit!, \
 300     SPEC := $(NEW_SPEC), \
 301     TOPDIR := $(TOPDIR), \
 302     OUTPUTDIR := $(OUTPUTDIR), \
 303     BOOT_JDK := $(BOOT_JDK), \
 304     JT_HOME := $(JT_HOME), \
 305     JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
 306     JCOV_IMAGE_DIR := $(JCOV_IMAGE_DIR), \
 307     TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
 308     SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
 309     MAKE := $(MAKE), \
 310     BASH := $(BASH), \
 311     JIB_JAR := $(JIB_JAR), \
 312     FIXPATH := $(FIXPATH), \
 313     PATH_SEP := $(PATH_SEP), \
 314     OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
 315     OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
 316     OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
 317     OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \
 318     OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \
 319     OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \
 320     OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
 321     NUM_CORES := $(NUM_CORES), \
 322     MEMORY_SIZE := $(MEMORY_SIZE), \
 323     LD_JAOTC := $(LD_JAOTC), \
 324     LIBRARY_PREFIX := $(LIBRARY_PREFIX), \
 325     SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \

 326     include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
 327     TEST_OPTS_JCOV := $(TEST_OPTS_JCOV), \
 328     $(CUSTOM_NEW_SPEC_LINE), \
 329 )
 330 
 331 ################################################################################
 332 # The run-test-prebuilt target
 333 ################################################################################
 334 
 335 SPEC := $(NEW_SPEC)
 336 
 337 default: all
 338 
 339 run-test-prebuilt:
 340         # Need to make sure the failure logs output dir exists since
 341         # ExecuteWithLog is called in RunTests.gmk. The PrepareFailureLogs macro
 342         # is unfortunately not available at this point.
 343         $(call MakeDir, $(MAKESUPPORT_OUTPUTDIR)/failure-logs)
 344         @$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
 345         # The lazy initialization of the cache file in FindTests.gmk does not
 346         # always work with RunTests.gmk. To guarantee that the jtreg test groups
 347         # are always found and parsed, call FindTests.gmk stand alone once
 348         # before calling RunTests.gmk.
 349         @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/common/FindTests.gmk \
 350             SPEC=$(SPEC) FINDTESTS_STAND_ALONE=true
 351         @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
 352             TEST="$(TEST)"
 353 
 354 all: run-test-prebuilt
 355 
 356 .PHONY: default all
   1 #
   2 # Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  78   # and if wildcard is empty, then complain that the file is missing.
  79   ifeq ($3, MKDIR)
  80     ifneq ($$(findstring $$(LOG), info debug trace), )
  81       $$(info Creating directory for $1)
  82     endif
  83     $$(shell mkdir -p $$($1))
  84   else ifneq ($3, NO_CHECK)
  85     ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
  86       $$(info Error: Prebuilt variable $1 points to missing file/directory:)
  87       $$(info '$$($1)')
  88       $$(error Cannot continue.)
  89     endif
  90   endif
  91 endef
  92 
  93 # Create an ephemeral spec file
  94 #
  95 # $1: The output file name
  96 # $2..$N: The lines to output to the file
  97 define CreateNewSpec
  98   $(if $(strip $(31)), \
  99     $(error Internal makefile error: \
 100       Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
 101   ) \
 102   $(shell $(RM) $1) \
 103   $(foreach i, $(call sequence, 2, 30), \
 104     $(if $(strip $($i)), \
 105       $(call AppendFile, $(strip $($i)), $1) \
 106     ) \
 107   )
 108 endef
 109 
 110 ################################################################################
 111 # Check input and setup basic buildsystem support
 112 ################################################################################
 113 
 114 # Verify that user has given correct additional input.
 115 
 116 # These variables are absolutely necessary
 117 $(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
 118 $(eval $(call SetupVariable,BOOT_JDK))
 119 $(eval $(call SetupVariable,JT_HOME))
 120 
 121 # These can have default values based on the ones above
 122 $(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
 123 $(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))


 220   PATH_SEP:=:
 221 endif
 222 
 223 # Check number of cores and memory in MB
 224 ifeq ($(OPENJDK_TARGET_OS), linux)
 225   NUM_CORES := $(shell $(CAT) /proc/cpuinfo  | $(GREP) -c processor)
 226   MEMORY_SIZE := $(shell \
 227       $(EXPR) `$(CAT) /proc/meminfo | $(GREP) MemTotal | $(AWK) '{print $$2}'` / 1024 \
 228   )
 229 else ifeq ($(OPENJDK_TARGET_OS), macosx)
 230   NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
 231   MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
 232 else ifeq ($(OPENJDK_TARGET_OS), solaris)
 233   NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | $(GREP) -c on-line)
 234   MEMORY_SIZE := $(shell \
 235       /usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
 236   )
 237 else ifeq ($(OPENJDK_TARGET_OS), windows)
 238   NUM_CORES := $(NUMBER_OF_PROCESSORS)
 239   MEMORY_SIZE := $(shell \
 240       $(EXPR) `wmic computersystem get totalphysicalmemory -value | $(GREP) = \

 241           | $(CUT) -d "=" -f 2-` / 1024 / 1024 \
 242   )
 243 endif
 244 ifeq ($(NUM_CORES), )
 245   $(warn Could not find number of CPUs, assuming 1)
 246   NUM_CORES := 1
 247 endif
 248 ifeq ($(MEMORY_SIZE), )
 249   $(warn Could not find memory size, assuming 1024 MB)
 250   MEMORY_SIZE := 1024
 251 endif
 252 
 253 # Setup LD for AOT support
 254 ifneq ($(DEVKIT_HOME), )
 255   ifeq ($(OPENJDK_TARGET_OS), windows)
 256     LD := $(DEVKIT_HOME)/VC/bin/x64/link
 257     LIBRARY_PREFIX :=
 258     SHARED_LIBRARY_SUFFIX := .dll
 259     EXE_SUFFIX := .exe
 260   else ifeq ($(OPENJDK_TARGET_OS), linux)
 261     LD := $(DEVKIT_HOME)/bin/ld
 262     LIBRARY_PREFIX := lib
 263     SHARED_LIBRARY_SUFFIX := .so
 264     EXE_SUFFIX :=
 265   else ifeq ($(OPENJDK_TARGET_OS), macosx)
 266     LD := $(DEVKIT_HOME)/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
 267     LIBRARY_PREFIX := lib
 268     SHARED_LIBRARY_SUFFIX := .dylib
 269     EXE_SUFFIX :=
 270   else ifeq ($(OPENJDK_TARGET_OS), solaris)
 271     # Prefer system linker for AOT on Solaris.
 272     LD := ld
 273     LIBRARY_PREFIX := lib
 274     SHARED_LIBRARY_SUFFIX := .so
 275     EXE_SUFFIX :=
 276   endif
 277 else
 278   LD := ld
 279 endif
 280 








 281 ################################################################################
 282 # Generate the ephemeral spec file
 283 ################################################################################
 284 
 285 # Now we can include additional custom support.
 286 # This might define CUSTOM_NEW_SPEC_LINE
 287 ifneq ($(CUSTOM_MAKE_DIR), )
 288   include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
 289 endif
 290 
 291 NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
 292 
 293 $(call CreateNewSpec, $(NEW_SPEC), \
 294     # Generated file -- do not edit!, \
 295     SPEC := $(NEW_SPEC), \
 296     TOPDIR := $(TOPDIR), \
 297     OUTPUTDIR := $(OUTPUTDIR), \
 298     BOOT_JDK := $(BOOT_JDK), \
 299     JT_HOME := $(JT_HOME), \
 300     JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \

 301     TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
 302     SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
 303     MAKE := $(MAKE), \
 304     BASH := $(BASH), \
 305     JIB_JAR := $(JIB_JAR), \
 306     FIXPATH := $(FIXPATH), \
 307     PATH_SEP := $(PATH_SEP), \
 308     OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
 309     OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
 310     OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
 311     OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \
 312     OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \
 313     OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \
 314     OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
 315     NUM_CORES := $(NUM_CORES), \
 316     MEMORY_SIZE := $(MEMORY_SIZE), \
 317     LD := $(LD), \
 318     LIBRARY_PREFIX := $(LIBRARY_PREFIX), \
 319     SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \
 320     EXE_SUFFIX := $(EXE_SUFFIX), \
 321     include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \

 322     $(CUSTOM_NEW_SPEC_LINE), \
 323 )
 324 
 325 ################################################################################
 326 # The run-test-prebuilt target
 327 ################################################################################
 328 
 329 SPEC := $(NEW_SPEC)
 330 
 331 default: all
 332 
 333 run-test-prebuilt:




 334         @$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error






 335         @cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
 336             TEST="$(TEST)"
 337 
 338 all: run-test-prebuilt
 339 
 340 .PHONY: default all
< prev index next >