1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
|
#
# Copyright (c) 2017, 2019, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
# Initial bootstrapping, copied and stripped down from Makefile and Init.gmk
################################################################################
# In Cygwin, the MAKE variable gets prepended with the current directory if the
# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
ifneq ($(findstring :, $(MAKE)), )
export MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
endif
# Locate this Makefile
ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
else
makefile_path := $(lastword $(MAKEFILE_LIST))
endif
TOPDIR := $(strip $(patsubst %/make/, %, $(dir $(makefile_path))))
################################################################################
# Functions
################################################################################
# Setup a required or optional variable, and/or check that it is properly
# given.
# Note: No spaces are allowed around the arguments.
#
# $1: The name of the variable
# $2: The default value, if any, or OPTIONAL (do not provide a default but
# do not exit if it is missing)
# $3: If NO_CHECK, disable checking for target file/directory existence
# If MKDIR, create the default directory
define SetupVariable
ifeq ($$($1), )
ifeq ($2, )
$$(info Error: Prebuilt variable $1 is missing, needed for run-tests-prebuilt)
$$(error Cannot continue.)
else ifeq ($2, OPTIONAL)
ifneq ($$(findstring $$(LOG), info debug trace), )
$$(info Prebuilt variable $1 is not provided)
endif
else
ifneq ($$(findstring $$(LOG), info debug trace), )
$$(info Prebuilt variable $1=$2 (default value))
endif
$1:=$2
endif
else
ifneq ($$(findstring $$(LOG), info debug trace), )
$$(info Prebuilt variable $1=$$($1))
endif
endif
# If $1 has a value (is not optional), and $3 is not set (to NO_CHECK),
# and if wildcard is empty, then complain that the file is missing.
ifeq ($3, MKDIR)
ifneq ($$(findstring $$(LOG), info debug trace), )
$$(info Creating directory for $1)
endif
$$(shell mkdir -p $$($1))
else ifneq ($3, NO_CHECK)
ifeq ($$(strip $$(if $$($1), , OPTIONAL) $$(wildcard $$($1))), )
$$(info Error: Prebuilt variable $1 points to missing file/directory:)
$$(info '$$($1)')
$$(error Cannot continue.)
endif
endif
endef
# Create an ephemeral spec file
#
# $1: The output file name
# $2..$N: The lines to output to the file
define CreateNewSpec
$(if $(strip $(31)), \
$(error Internal makefile error: \
Too many arguments to macro, please update CreateNewSpec in RunTestsPrebuilt.gmk) \
) \
$(shell $(RM) $1) \
$(foreach i, $(call sequence, 2, 30), \
$(if $(strip $($i)), \
$(call AppendFile, $(strip $($i)), $1) \
) \
)
endef
################################################################################
# Check input and setup basic buildsystem support
################################################################################
# Verify that user has given correct additional input.
# These variables are absolutely necessary
$(eval $(call SetupVariable,OUTPUTDIR,$(TOPDIR)/build/run-test-prebuilt,MKDIR))
$(eval $(call SetupVariable,BOOT_JDK))
$(eval $(call SetupVariable,JT_HOME))
# These can have default values based on the ones above
$(eval $(call SetupVariable,JDK_IMAGE_DIR,$(OUTPUTDIR)/images/jdk))
$(eval $(call SetupVariable,TEST_IMAGE_DIR,$(OUTPUTDIR)/images/test))
$(eval $(call SetupVariable,SYMBOLS_IMAGE_DIR,$(OUTPUTDIR)/images/symbols,NO_CHECK))
$(eval $(call SetupVariable,JTREG_JDK,$(BOOT_JDK)))
# Provide default values for tools that we need
$(eval $(call SetupVariable,MAKE,make,NO_CHECK))
$(eval $(call SetupVariable,BASH,bash,NO_CHECK))
# Check optional variables
$(eval $(call SetupVariable,JIB_JAR,OPTIONAL))
# Now that we have verified that we have the required variables available, we
# can include the prebuilt spec file ourselves, without an ephemeral spec
# wrapper. This is required so we can include MakeBase which is needed for
# CreateNewSpec.
HAS_SPEC :=
include $(TOPDIR)/make/InitSupport.gmk
$(eval $(call CheckDeprecatedEnvironment))
$(eval $(call CheckInvalidMakeFlags))
$(eval $(call ParseLogLevel))
SPEC := $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk
include $(SPEC)
include $(TOPDIR)/make/common/MakeBase.gmk
################################################################################
# Determine what platform we're running on
################################################################################
UNAME := uname
# Get OS name from uname (Cygwin inexplicably adds _NT-x.x)
UNAME_OS := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
ifeq ($(UNAME_OS), CYGWIN)
OPENJDK_TARGET_OS := windows
OPENJDK_TARGET_OS_TYPE := windows
OPENJDK_TARGET_OS_ENV := windows.cygwin
else ifeq ($(UNAME_OS), MINGW64)
OPENJDK_TARGET_OS := windows
OPENJDK_TARGET_OS_TYPE := windows
OPENJDK_TARGET_OS_ENV := windows.msys2
else
OPENJDK_TARGET_OS_TYPE:=unix
ifeq ($(UNAME_OS), Linux)
OPENJDK_TARGET_OS := linux
else ifeq ($(UNAME_OS), Darwin)
OPENJDK_TARGET_OS := macosx
else ifeq ($(UNAME_OS), SunOS)
OPENJDK_TARGET_OS := solaris
else
OPENJDK_TARGET_OS := $(UNAME_OS)
endif
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS)
endif
# Sanity check env detection
$(info Detected target OS, type and env: [$(OPENJDK_TARGET_OS)] [$(OPENJDK_TARGET_OS_TYPE)] [$(OPENJDK_TARGET_OS_ENV)])
# Assume little endian unless otherwise specified
OPENJDK_TARGET_CPU_ENDIAN := little
ifeq ($(OPENJDK_TARGET_OS), solaris)
# On solaris, use uname -p
UNAME_CPU := $(shell $(UNAME) -p)
# Assume 64-bit platform
OPENJDK_TARGET_CPU_BITS := 64
ifeq ($(UNAME_CPU), i386)
OPENJDK_TARGET_CPU := x86_64
else ifeq ($(UNAME_CPU), sparc)
OPENJDK_TARGET_CPU := sparcv9
OPENJDK_TARGET_CPU_ENDIAN := big
else
OPENJDK_TARGET_CPU := $(UNAME_CPU)
endif
else
# ... all others use uname -m
UNAME_CPU := $(shell $(UNAME) -m)
ifeq ($(UNAME_CPU), i686)
OPENJDK_TARGET_CPU := x86
OPENJDK_TARGET_CPU_BITS := 32
else
# Assume all others are 64-bit. We use the same CPU name as uname for
# at least x86_64 and aarch64.
OPENJDK_TARGET_CPU := $(UNAME_CPU)
OPENJDK_TARGET_CPU_BITS := 64
endif
endif
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU)
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
OPENJDK_TARGET_CPU_ARCH := x86
else ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
OPENJDK_TARGET_CPU_ARCH := sparc
endif
ifeq ($(OPENJDK_TARGET_OS), windows)
FIXPATH := $(BASH) $(TOPDIR)/make/scripts/fixpath.sh exec
else
FIXPATH :=
endif
# Check number of cores and memory in MB
ifeq ($(OPENJDK_TARGET_OS), linux)
NUM_CORES := $(shell $(CAT) /proc/cpuinfo | $(GREP) -c processor)
MEMORY_SIZE := $(shell \
$(EXPR) `$(CAT) /proc/meminfo | $(GREP) MemTotal | $(AWK) '{print $$2}'` / 1024 \
)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
MEMORY_SIZE := $(shell $(EXPR) `/usr/sbin/sysctl -n hw.memsize` / 1024 / 1024)
else ifeq ($(OPENJDK_TARGET_OS), solaris)
NUM_CORES := $(shell /usr/sbin/psrinfo -v | $(GREP) -c on-line)
MEMORY_SIZE := $(shell \
/usr/sbin/prtconf 2> /dev/null | $(GREP) "^Memory [Ss]ize" | $(AWK) '{print $$3}' \
)
else ifeq ($(OPENJDK_TARGET_OS), windows)
NUM_CORES := $(NUMBER_OF_PROCESSORS)
MEMORY_SIZE := $(shell \
$(EXPR) `wmic computersystem get totalphysicalmemory -value \
| $(GREP) = | $(SED) 's/\\r//g' \
| $(CUT) -d "=" -f 2-` / 1024 / 1024 \
)
endif
ifeq ($(NUM_CORES), )
$(warn Could not find number of CPUs, assuming 1)
NUM_CORES := 1
endif
ifeq ($(MEMORY_SIZE), )
$(warn Could not find memory size, assuming 1024 MB)
MEMORY_SIZE := 1024
endif
# Setup LD for AOT support
ifneq ($(DEVKIT_HOME), )
ifeq ($(OPENJDK_TARGET_OS), windows)
LD_JAOTC := $(DEVKIT_HOME)/VC/bin/x64/link.exe
LIBRARY_PREFIX :=
SHARED_LIBRARY_SUFFIX := .dll
else ifeq ($(OPENJDK_TARGET_OS), linux)
LD_JAOTC := $(DEVKIT_HOME)/bin/ld
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .so
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LD_JAOTC := $(DEVKIT_HOME)/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .dylib
else ifeq ($(OPENJDK_TARGET_OS), solaris)
# Prefer system linker for AOT on Solaris.
LD_JAOTC := ld
LIBRARY_PREFIX := lib
SHARED_LIBRARY_SUFFIX := .so
endif
else
LD := ld
endif
################################################################################
# Generate the ephemeral spec file
################################################################################
# Now we can include additional custom support.
# This might define CUSTOM_NEW_SPEC_LINE
ifneq ($(CUSTOM_MAKE_DIR), )
include $(CUSTOM_MAKE_DIR)/RunTestsPrebuilt.gmk
endif
NEW_SPEC := $(OUTPUTDIR)/run-test-spec.gmk
$(call CreateNewSpec, $(NEW_SPEC), \
# Generated file -- do not edit!, \
SPEC := $(NEW_SPEC), \
TOPDIR := $(TOPDIR), \
OUTPUTDIR := $(OUTPUTDIR), \
BOOT_JDK := $(BOOT_JDK), \
JTREG_JDK := $(JTREG_JDK), \
JT_HOME := $(JT_HOME), \
JDK_IMAGE_DIR := $(JDK_IMAGE_DIR), \
TEST_IMAGE_DIR := $(TEST_IMAGE_DIR), \
SYMBOLS_IMAGE_DIR := $(SYMBOLS_IMAGE_DIR), \
MAKE := $(MAKE), \
BASH := $(BASH), \
JIB_JAR := $(JIB_JAR), \
FIXPATH := $(FIXPATH), \
OPENJDK_TARGET_OS := $(OPENJDK_TARGET_OS), \
OPENJDK_TARGET_OS_TYPE := $(OPENJDK_TARGET_OS_TYPE), \
OPENJDK_TARGET_OS_ENV := $(OPENJDK_TARGET_OS_ENV), \
OPENJDK_TARGET_CPU := $(OPENJDK_TARGET_CPU), \
OPENJDK_TARGET_CPU_ARCH := $(OPENJDK_TARGET_CPU_ARCH), \
OPENJDK_TARGET_CPU_BITS := $(OPENJDK_TARGET_CPU_BITS), \
OPENJDK_TARGET_CPU_ENDIAN := $(OPENJDK_TARGET_CPU_ENDIAN), \
NUM_CORES := $(NUM_CORES), \
MEMORY_SIZE := $(MEMORY_SIZE), \
LD_JAOTC := $(LD_JAOTC), \
LIBRARY_PREFIX := $(LIBRARY_PREFIX), \
SHARED_LIBRARY_SUFFIX := $(SHARED_LIBRARY_SUFFIX), \
include $(TOPDIR)/make/RunTestsPrebuiltSpec.gmk, \
$(CUSTOM_NEW_SPEC_LINE), \
)
################################################################################
# The run-test-prebuilt target
################################################################################
SPEC := $(NEW_SPEC)
default: all
run-test-prebuilt:
@$(RM) -f $(MAKESUPPORT_OUTPUTDIR)/exit-with-error
@cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -f make/RunTests.gmk run-test \
TEST="$(TEST)"
all: run-test-prebuilt
.PHONY: default all
|