annotate test/TestCommon.gmk @ 49034:a2d550f08617

8196524: Align MaxRAMPercentage settings between open and closed Reviewed-by: dholmes, tbell
author erikj
date Thu, 01 Feb 2018 09:07:25 -0800
parents 62b6e9b1dfdc
children ab7784555b4c
rev   line source
ihse@42424 1 #
bobv@46192 2 # Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
ihse@42424 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ihse@42424 4 #
ihse@42424 5 # This code is free software; you can redistribute it and/or modify it
ihse@42424 6 # under the terms of the GNU General Public License version 2 only, as
ihse@42424 7 # published by the Free Software Foundation. Oracle designates this
ihse@42424 8 # particular file as subject to the "Classpath" exception as provided
ihse@42424 9 # by Oracle in the LICENSE file that accompanied this code.
ihse@42424 10 #
ihse@42424 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ihse@42424 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ihse@42424 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ihse@42424 14 # version 2 for more details (a copy is included in the LICENSE file that
ihse@42424 15 # accompanied this code).
ihse@42424 16 #
ihse@42424 17 # You should have received a copy of the GNU General Public License version
ihse@42424 18 # 2 along with this work; if not, write to the Free Software Foundation,
ihse@42424 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ihse@42424 20 #
ihse@42424 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ihse@42424 22 # or visit www.oracle.com if you need additional information or have any
ihse@42424 23 # questions.
ihse@42424 24 #
ihse@42424 25
ihse@42424 26 #
ihse@42424 27 # Common logic to run various tests for a component, to be included by the
ihse@42424 28 # component specific test makefiles.
ihse@42424 29 #
ihse@42424 30
ihse@42424 31 # Default values for some properties that can be overridden by components.
ihse@42424 32 USE_JTREG_VERSION ?= 4.2
ihse@42424 33 JTREG_VM_TYPE ?= -agentvm
ihse@42424 34 USE_JTREG_ASSERT ?= true
ihse@42424 35 LIMIT_JTREG_VM_MEMORY ?= true
ihse@42424 36
ihse@42424 37 .DEFAULT : all
ihse@42424 38
ihse@42424 39 # Empty these to get rid of some default rules
ihse@42424 40 .SUFFIXES:
ihse@42424 41 .SUFFIXES: .java
ihse@42424 42 CO=
ihse@42424 43 GET=
ihse@42424 44
ihse@42424 45 # Utilities used
ihse@42424 46 AWK = awk
ihse@42424 47 CAT = cat
ihse@42424 48 CD = cd
ihse@42424 49 CHMOD = chmod
ihse@42424 50 CP = cp
ihse@42424 51 CUT = cut
ihse@42424 52 DIRNAME = dirname
ihse@42424 53 ECHO = echo
ihse@42424 54 EGREP = egrep
ihse@42424 55 EXPAND = expand
ihse@42424 56 FIND = find
ihse@42424 57 MKDIR = mkdir
ihse@42424 58 PWD = pwd
ihse@42424 59 RM = rm -f
ihse@42424 60 SED = sed
ihse@42424 61 SORT = sort
ihse@42424 62 TEE = tee
ihse@42424 63 UNAME = uname
ihse@42424 64 UNIQ = uniq
ihse@42424 65 WC = wc
ihse@42424 66 ZIPEXE = zip
ihse@42424 67
ihse@42424 68 # Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
ihse@42424 69 UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
ihse@42424 70
ihse@42424 71 # Commands to run on paths to make mixed paths for java on windows
ihse@42424 72 ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN)
ihse@42424 73 # Location of developer shared files
ihse@42424 74 SLASH_JAVA = J:
ihse@42424 75 GETMIXEDPATH = cygpath -m
ihse@42424 76 PLATFORM = windows
ihse@42424 77 else
ihse@42424 78 # Location of developer shared files
ihse@42424 79 SLASH_JAVA = /java
ihse@42424 80 GETMIXEDPATH = $(ECHO)
ihse@42424 81 PLATFORM = unix # we only care about windows or bsd.
ihse@42424 82 ifeq ($(UNAME_S), Darwin)
ihse@42424 83 PLATFORM = bsd
ihse@42424 84 endif
ihse@42424 85 ifeq ($(findstring BSD,$(UNAME_S)), BSD)
ihse@42424 86 PLATFORM = bsd
ihse@42424 87 endif
ihse@42424 88 endif
ihse@42424 89
ihse@42424 90 ifdef ALT_SLASH_JAVA
ihse@42424 91 SLASH_JAVA = $(ALT_SLASH_JAVA)
ihse@42424 92 endif
ihse@42424 93
ihse@42424 94 # Root of this test area (important to use full paths in some places)
ihse@42424 95 TEST_ROOT := $(shell $(PWD))
ihse@42424 96
ihse@42424 97 # Root of all test results
ihse@42424 98 ifdef TEST_OUTPUT_DIR
ihse@42424 99 $(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg)
ihse@42424 100 ABS_TEST_OUTPUT_DIR := \
ihse@42424 101 $(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD))
ihse@42424 102 else
ihse@42424 103 ifdef ALT_OUTPUTDIR
ihse@42424 104 ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
ihse@42424 105 else
ihse@42424 106 ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
ihse@42424 107 endif
ihse@42424 108
ihse@42424 109 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
ihse@42424 110 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
ihse@42424 111 endif
ihse@42424 112
ihse@42424 113 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ihse@42424 114 ifndef PRODUCT_HOME
ihse@42424 115 # Try to use images/jdk if it exists
ihse@42424 116 ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk
ihse@42424 117 PRODUCT_HOME := \
ihse@42424 118 $(shell \
ihse@42424 119 if [ -d $(ABS_JDK_IMAGE) ] ; then \
ihse@42424 120 $(ECHO) "$(ABS_JDK_IMAGE)"; \
ihse@42424 121 else \
ihse@42424 122 $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \
ihse@42424 123 fi)
ihse@42424 124 PRODUCT_HOME := $(PRODUCT_HOME)
ihse@42424 125 endif
ihse@42424 126
ihse@42424 127 # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
ihse@42424 128 # Should be passed into 'java' only.
ihse@42424 129 # Could include: -d64 -server -client OR any java option
ihse@42424 130 ifdef JPRT_PRODUCT_ARGS
ihse@42424 131 JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
ihse@42424 132 endif
ihse@42424 133
ihse@42424 134 # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
ihse@42424 135 # Should be passed into anything running the vm (java, javac, javadoc, ...).
ihse@42424 136 ifdef JPRT_PRODUCT_VM_ARGS
ihse@42424 137 JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
ihse@42424 138 endif
ihse@42424 139
ihse@42424 140 ifneq ($(NATIVE_TEST_PATH), )
ihse@42424 141 # jtreg -nativepath <dir>
ihse@42424 142 #
ihse@42424 143 # Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
ihse@42424 144 # should be JPRT_TESTNATIVE_PATH
ihse@42424 145 ifdef TEST_IMAGE_DIR
ihse@42424 146 TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
ihse@42424 147 else ifdef JPRT_TESTNATIVE_PATH
ihse@42424 148 TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
ihse@42424 149 endif
ihse@42424 150 ifdef TESTNATIVE_DIR
ihse@42424 151 JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/$(NATIVE_TEST_PATH)")
ihse@42424 152 endif
ihse@42424 153 endif
ihse@42424 154
ihse@42424 155 ifeq ($(USE_FAILURE_HANDLER), true)
ihse@42424 156 # jtreg failure handler config
ihse@42424 157 ifeq ($(FAILURE_HANDLER_DIR), )
ihse@42424 158 ifneq ($(TESTNATIVE_DIR), )
ihse@42424 159 FAILURE_HANDLER_DIR := $(TESTNATIVE_DIR)/failure_handler
ihse@42424 160 endif
ihse@42424 161 endif
ihse@42424 162 ifneq ($(FAILURE_HANDLER_DIR), )
ihse@42424 163 FAILURE_HANDLER_DIR_MIXED := $(shell $(GETMIXEDPATH) "$(FAILURE_HANDLER_DIR)")
ihse@42424 164 JTREG_FAILURE_HANDLER_OPTIONS := \
ihse@42424 165 -timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
ihse@42424 166 -observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
ihse@42424 167 -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
ihse@42424 168 -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
ihse@42424 169 -timeoutHandlerTimeout:0
ihse@42424 170 ifeq ($(PLATFORM), windows)
ihse@42424 171 JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)"
ihse@42424 172 endif
ihse@42424 173 endif
ihse@42424 174 endif
ihse@42424 175
ihse@42424 176 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ihse@42424 177 ifdef JPRT_ARCHIVE_BUNDLE
ihse@42424 178 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
ihse@42424 179 endif
ihse@42424 180
ihse@42424 181 # How to create the test bundle (pass or fail, we want to create this)
ihse@42424 182 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
erikj@47565 183 ifneq ($(ARCHIVE_BUNDLE), )
erikj@47565 184 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
ihse@42424 185 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
ihse@42424 186 && $(CHMOD) -R a+r . \
erikj@47565 187 && $(ZIPEXE) -q -r $(ARCHIVE_BUNDLE) . ) ;
erikj@47565 188 CLEAN_ARCHIVE_BUNDLE = @$(RM) $(ARCHIVE_BUNDLE)
erikj@47565 189 endif
ihse@42424 190
asmotrak@47625 191 # AddressSanitizer
asmotrak@47625 192 ifeq ($(ASAN_ENABLED), yes)
asmotrak@47625 193 export ASAN_OPTIONS="handle_segv=0 detect_leaks=0"
asmotrak@47625 194 JTREG_BASIC_OPTIONS += -e:ASAN_OPTIONS=$(ASAN_OPTIONS)
asmotrak@47625 195 ifneq ($(DEVKIT_LIB_DIR),)
asmotrak@47625 196 export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(DEVKIT_LIB_DIR)
asmotrak@47625 197 JTREG_BASIC_OPTIONS += -e:LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)
asmotrak@47625 198 endif
asmotrak@47625 199 endif
asmotrak@47625 200
ihse@42424 201 # important results files
ihse@42424 202 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
ihse@42424 203 STATS_TXT_NAME = Stats.txt
ihse@42424 204 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
ihse@42424 205 RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
ihse@42424 206 PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
ihse@42424 207 FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
ihse@42424 208 EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
ihse@42424 209
ihse@42424 210 TESTEXIT = \
ihse@42424 211 if [ ! -s $(EXITCODE) ] ; then \
ihse@42424 212 $(ECHO) "ERROR: EXITCODE file not filled in."; \
ihse@42424 213 $(ECHO) "1" > $(EXITCODE); \
ihse@42424 214 fi ; \
ihse@42424 215 testExitCode=`$(CAT) $(EXITCODE)`; \
ihse@42424 216 $(ECHO) "EXIT CODE: $${testExitCode}"; \
ihse@42424 217 exit $${testExitCode}
ihse@42424 218
ihse@42424 219 ifeq ($(TREAT_EXIT_CODE_1_AS_0), true)
ihse@42424 220 ADJUST_EXIT_CODE := \
ihse@42424 221 if [ $${jtregExitCode} = 1 ] ; then \
ihse@42424 222 jtregExitCode=0; \
ihse@42424 223 fi
ihse@42424 224 else
ihse@42424 225 # colon is the shell no-op
ihse@42424 226 ADJUST_EXIT_CODE := :
ihse@42424 227 endif
ihse@42424 228
ihse@42424 229 BUNDLE_UP_AND_EXIT = \
ihse@42424 230 ( \
ihse@42424 231 jtregExitCode=$$? && \
ihse@42424 232 _summary="$(SUMMARY_TXT)"; \
ihse@42424 233 $(ADJUST_EXIT_CODE) ; \
ihse@42424 234 $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
ihse@42424 235 $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
ihse@42424 236 if [ -r "$${_summary}" ] ; then \
ihse@42424 237 $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
ihse@42424 238 $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
ihse@42424 239 $(EGREP) ' Passed\.' $(RUNLIST) \
ihse@42424 240 | $(EGREP) -v ' Error\.' \
ihse@42424 241 | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
ihse@42424 242 ( $(EGREP) ' Failed\.' $(RUNLIST); \
ihse@42424 243 $(EGREP) ' Error\.' $(RUNLIST); \
ihse@42424 244 $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
ihse@42424 245 | $(SORT) | $(UNIQ) > $(FAILLIST); \
ihse@42424 246 if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
ihse@42424 247 $(EXPAND) $(FAILLIST) \
ihse@42424 248 | $(CUT) -d' ' -f1 \
ihse@42424 249 | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
ihse@42424 250 if [ $${jtregExitCode} = 0 ] ; then \
ihse@42424 251 jtregExitCode=1; \
ihse@42424 252 fi; \
ihse@42424 253 fi; \
ihse@42424 254 runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 255 passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 256 failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 257 exclc="FIXME CODETOOLS-7900176"; \
ihse@42424 258 $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \
ihse@42424 259 >> $(STATS_TXT); \
ihse@42424 260 else \
ihse@42424 261 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
ihse@42424 262 fi; \
ihse@42424 263 if [ -f $(STATS_TXT) ] ; then \
ihse@42424 264 $(CAT) $(STATS_TXT); \
ihse@42424 265 fi; \
erikj@47565 266 $(ZIP_UP_RESULTS) \
ihse@42424 267 $(TESTEXIT) \
ihse@42424 268 )
ihse@42424 269
ihse@42424 270 ################################################################
ihse@42424 271
ihse@42424 272 # Prep for output
ihse@42424 273 # Change execute permissions on shared library files.
ihse@42424 274 # Files in repositories should never have execute permissions, but
ihse@42424 275 # there are some tests that have pre-built shared libraries, and these
ihse@42424 276 # windows dll files must have execute permission. Adding execute
ihse@42424 277 # permission may happen automatically on windows when using certain
ihse@42424 278 # versions of mercurial but it cannot be guaranteed. And blindly
ihse@42424 279 # adding execute permission might be seen as a mercurial 'change', so
ihse@42424 280 # we avoid adding execute permission to repository files. But testing
ihse@42424 281 # from a plain source tree needs the chmod a+rx. Applying the chmod to
ihse@42424 282 # all shared libraries not just dll files. And with CYGWIN and sshd
ihse@42424 283 # service, you may need CYGWIN=ntsec for this to work.
ihse@42424 284 prep:
ihse@42424 285 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
mcimadamore@47330 286 @if [ ! -d $(TEST_ROOT)/../../.hg ] && [ ! -d $(TEST_ROOT)/../../../.hg ]; then \
ihse@42424 287 $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
ihse@42424 288 -exec $(CHMOD) a+rx {} \; ; \
ihse@42424 289 fi
ihse@42424 290
ihse@42424 291 ifeq ($(CLEAN_BEFORE_PREP), true)
ihse@42424 292 prep: clean
ihse@42424 293
ihse@42424 294 endif
ihse@42424 295
ihse@42424 296 # Cleanup
ihse@42424 297 clean:
ihse@42424 298 @$(RM) -r $(ABS_TEST_OUTPUT_DIR)
erikj@47565 299 $(CLEAN_ARCHIVE_BUNDLE)
ihse@42424 300
ihse@42424 301 ################################################################
ihse@42424 302
ihse@42424 303 # jtreg tests
ihse@42424 304
ihse@42424 305 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ihse@42424 306 ifndef JT_HOME
ihse@42424 307 JT_HOME = $(SLASH_JAVA)/re/jtreg/$(USE_JTREG_VERSION)/promoted/latest/binaries/jtreg
ihse@42424 308 ifdef JPRT_JTREG_HOME
ihse@42424 309 JT_HOME = $(JPRT_JTREG_HOME)
ihse@42424 310 endif
ihse@42424 311 endif
ihse@42424 312
ihse@42424 313 # Problematic tests to be excluded
erikj@47218 314 PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt))
ihse@42424 315
ihse@42424 316 # Create exclude list for this platform and arch
ihse@42424 317 ifdef NO_EXCLUDES
ihse@42424 318 JTREG_EXCLUSIONS =
ihse@42424 319 else
ihse@42424 320 JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
ihse@42424 321 endif
ihse@42424 322
ihse@42424 323 # convert list of directories to dos paths
ihse@42424 324 define MixedDirs
ihse@42424 325 $(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
ihse@42424 326 endef
ihse@42424 327
ihse@42424 328 # ------------------------------------------------------------------
ihse@42424 329
ihse@42424 330 # When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
ihse@42424 331 ifdef TESTDIRS
ihse@42424 332 TEST_SELECTION = $(TESTDIRS)
ihse@42424 333 endif
ihse@42424 334
ctornqvi@49018 335 ifeq ($(UNAME_S), SunOS)
ctornqvi@49018 336 NUM_CORES := $(shell LC_MESSAGES=C /usr/sbin/psrinfo -v | grep -c on-line)
ihse@42424 337 endif
ctornqvi@49018 338 ifeq ($(UNAME_S), Linux)
ctornqvi@49018 339 NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor)
ctornqvi@49018 340 endif
ctornqvi@49018 341 ifeq ($(UNAME_S), Darwin)
ctornqvi@49018 342 NUM_CORES := $(shell /usr/sbin/sysctl -n hw.ncpu)
ctornqvi@49018 343 endif
ctornqvi@49018 344 ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN)
ctornqvi@49018 345 ifneq ($(NUMBER_OF_PROCESSORS), )
ctornqvi@49018 346 NUM_CORES := $(NUMBER_OF_PROCESSORS)
ctornqvi@49018 347 else
ctornqvi@49018 348 ifneq ($(HOTSPOT_BUILD_JOBS), )
ctornqvi@49018 349 NUM_CORES := $(HOTSPOT_BUILD_JOBS)
ctornqvi@49018 350 else
ctornqvi@49018 351 NUM_CORES := 1 # fallback
ctornqvi@49018 352 endif
ctornqvi@49018 353 endif
ctornqvi@49018 354 endif
ctornqvi@49018 355
ctornqvi@49018 356 ifndef CONCURRENCY_FACTOR
ctornqvi@49018 357 CONCURRENCY_FACTOR = 1
ctornqvi@49018 358 endif
ctornqvi@49018 359
ctornqvi@49018 360 # Concurrency based on min(cores / 2, 12) * CONCURRENCY_FACTOR
erikj@49034 361 CONCURRENCY := $(shell $(AWK) \
ctornqvi@49018 362 'BEGIN { \
ctornqvi@49018 363 c = $(NUM_CORES) / 2; \
ctornqvi@49018 364 if (c > 12) c = 12; \
ctornqvi@49018 365 c = c * $(CONCURRENCY_FACTOR); \
ctornqvi@49018 366 if (c < 1) c = 1; \
ctornqvi@49018 367 printf "%.0f", c; \
ctornqvi@49018 368 }')
ctornqvi@49018 369 JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
ctornqvi@49018 370
erikj@49034 371 # Make sure MaxRAMPercentage is low enough to not cause OOM or swapping since
erikj@49034 372 # we may end up with a lot of JVM's
erikj@49034 373 MAX_RAM_PERCENTAGE := $(shell expr 25 / $(CONCURRENCY))
erikj@49034 374 JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(MAX_RAM_PERCENTAGE)
ctornqvi@49018 375
ihse@42424 376 ifdef EXTRA_JTREG_OPTIONS
ihse@42424 377 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
ihse@42424 378 endif
ihse@42424 379
ihse@42424 380 # Default JTREG to run
ihse@42424 381 JTREG = $(JT_HOME)/bin/jtreg
ihse@42424 382 # run in agentvm/othervm mode
ihse@42424 383 JTREG_BASIC_OPTIONS += $(JTREG_VM_TYPE)
ihse@42424 384 # Only run automatic tests
ihse@42424 385 JTREG_BASIC_OPTIONS += -a
ihse@42424 386 # Always turn on assertions
ihse@42424 387 ifeq ($(USE_JTREG_ASSERT), true)
ihse@42424 388 JTREG_ASSERT_OPTION = -ea -esa
ihse@42424 389 endif
ihse@42424 390 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
ihse@42424 391 # jtreg verbosity setting
ihse@42424 392 # Default is to report details on all failed or error tests, times too
ihse@42424 393 JTREG_VERBOSE ?= fail,error,time
ihse@42424 394 JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE))
ihse@42424 395 # Retain all files for failing tests
ihse@42424 396 JTREG_BASIC_OPTIONS += -retain:fail,error
ihse@42424 397 # Ignore tests are not run and completely silent about it
ihse@42424 398 JTREG_IGNORE_OPTION = -ignore:quiet
ihse@42424 399 JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
ihse@42424 400 # Multiply by 4 the timeout factor
ihse@42424 401 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
ihse@42424 402 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
ihse@42424 403 ifeq ($(LIMIT_JTREG_VM_MEMORY), true)
ihse@42424 404 # Set the max memory for jtreg control vm
ihse@42424 405 JTREG_MEMORY_OPTION = -J-Xmx512m
ihse@42424 406 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
ihse@42424 407 # Set the max memory for jtreg target test vms
ihse@42424 408 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
ihse@42424 409 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
ihse@42424 410 endif
ctornqvi@47418 411 # Make it possible to specify the JIB_DATA_DIR for tests using the
ctornqvi@47418 412 # JIB Artifact resolver
ctornqvi@47418 413 JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
ihse@42424 414 # Give tests access to JT_JAVA, see JDK-8141609
ihse@42424 415 JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
bobv@46192 416 # Give aot tests access to Visual Studio installation
bobv@46192 417 ifneq ($(VS120COMNTOOLS), )
bobv@46192 418 JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)")
bobv@46192 419 endif
ihse@42424 420 # Set other vm and test options
ctornqvi@46248 421 JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
ctornqvi@46196 422 ifneq ($(JIB_JAR), )
ctornqvi@46196 423 JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)")
ctornqvi@46196 424 endif
ihse@42424 425 ifeq ($(IGNORE_MARKED_TESTS), true)
ihse@42424 426 # Option to tell jtreg to not run tests marked with "ignore"
ihse@42424 427 ifeq ($(PLATFORM), windows)
ihse@42424 428 JTREG_KEY_OPTION = -k:!ignore
ihse@42424 429 else
ihse@42424 430 JTREG_KEY_OPTION = -k:\!ignore
ihse@42424 431 endif
ihse@42424 432 JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION)
ihse@42424 433 endif
ihse@42424 434
ihse@42424 435 # Make sure jtreg exists
ihse@42424 436 ifeq ($(USE_WINDOWS_EXISTENCE_CHECK), true)
ihse@42424 437 jtreg_exists:
ihse@42424 438 test -d $(shell $(GETMIXEDPATH) "$(JT_HOME)")
ihse@42424 439 test -f $(shell $(GETMIXEDPATH) "$(JTREG)")
ihse@42424 440
ihse@42424 441 else
ihse@42424 442 jtreg_exists: $(JT_HOME)
ihse@42424 443 endif
ihse@42424 444 PHONY_LIST += jtreg_exists
ihse@42424 445
ihse@42424 446 # Run jtreg
ihse@42424 447 jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
ihse@42424 448 ( \
ihse@42424 449 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
ihse@42424 450 export JT_HOME; \
ihse@42424 451 $(shell $(GETMIXEDPATH) "$(JTREG)") \
ihse@42424 452 $(JTREG_BASIC_OPTIONS) \
ihse@42424 453 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
ihse@42424 454 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
ihse@42424 455 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
ihse@42424 456 $(JTREG_NATIVE_PATH) \
ihse@42424 457 $(JTREG_FAILURE_HANDLER_OPTIONS) \
ihse@42424 458 $(JTREG_EXCLUSIONS) \
ihse@42424 459 $(JTREG_TEST_OPTIONS) \
ihse@42424 460 $(TEST_SELECTION) \
ihse@42424 461 ) ; \
ihse@42424 462 $(BUNDLE_UP_AND_EXIT) \
ihse@42424 463 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
ihse@42424 464
ihse@42424 465 PHONY_LIST += jtreg_tests
ihse@42424 466
erikj@47218 467 # Make it possible to call this with <component>_jtreg_tests
erikj@47218 468 %_jtreg_tests: jtreg_tests
erikj@47218 469 # Must have a fake recipe here to prevent make from matching any other rule
erikj@47218 470
ihse@42424 471 ################################################################
ihse@42424 472
ihse@42424 473 # Phony targets (e.g. these are not filenames)
ihse@42424 474 .PHONY: all clean prep $(PHONY_LIST)
ihse@42424 475
ihse@42424 476 ################################################################