annotate test/TestCommon.gmk @ 47625:77a5f2ef1807

8189800: Add support for AddressSanitizer Reviewed-by: ihse, dholmes
author asmotrak
date Tue, 31 Oct 2017 17:03:02 +0300
parents 7be5c153e8a4
children 62b6e9b1dfdc
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
ihse@42424 335 ifdef CONCURRENCY
ihse@42424 336 JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
ihse@42424 337 endif
ihse@42424 338 ifdef EXTRA_JTREG_OPTIONS
ihse@42424 339 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
ihse@42424 340 endif
ihse@42424 341
ihse@42424 342 # Default JTREG to run
ihse@42424 343 JTREG = $(JT_HOME)/bin/jtreg
ihse@42424 344 # run in agentvm/othervm mode
ihse@42424 345 JTREG_BASIC_OPTIONS += $(JTREG_VM_TYPE)
ihse@42424 346 # Only run automatic tests
ihse@42424 347 JTREG_BASIC_OPTIONS += -a
ihse@42424 348 # Always turn on assertions
ihse@42424 349 ifeq ($(USE_JTREG_ASSERT), true)
ihse@42424 350 JTREG_ASSERT_OPTION = -ea -esa
ihse@42424 351 endif
ihse@42424 352 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
ihse@42424 353 # jtreg verbosity setting
ihse@42424 354 # Default is to report details on all failed or error tests, times too
ihse@42424 355 JTREG_VERBOSE ?= fail,error,time
ihse@42424 356 JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE))
ihse@42424 357 # Retain all files for failing tests
ihse@42424 358 JTREG_BASIC_OPTIONS += -retain:fail,error
ihse@42424 359 # Ignore tests are not run and completely silent about it
ihse@42424 360 JTREG_IGNORE_OPTION = -ignore:quiet
ihse@42424 361 JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
ihse@42424 362 # Multiply by 4 the timeout factor
ihse@42424 363 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
ihse@42424 364 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
ihse@42424 365 ifeq ($(LIMIT_JTREG_VM_MEMORY), true)
ihse@42424 366 # Set the max memory for jtreg control vm
ihse@42424 367 JTREG_MEMORY_OPTION = -J-Xmx512m
ihse@42424 368 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
ihse@42424 369 # Set the max memory for jtreg target test vms
ihse@42424 370 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
ihse@42424 371 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
ihse@42424 372 endif
ctornqvi@47418 373 # Make it possible to specify the JIB_DATA_DIR for tests using the
ctornqvi@47418 374 # JIB Artifact resolver
ctornqvi@47418 375 JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
ihse@42424 376 # Give tests access to JT_JAVA, see JDK-8141609
ihse@42424 377 JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
bobv@46192 378 # Give aot tests access to Visual Studio installation
bobv@46192 379 ifneq ($(VS120COMNTOOLS), )
bobv@46192 380 JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)")
bobv@46192 381 endif
ihse@42424 382 # Set other vm and test options
ctornqvi@46248 383 JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
ctornqvi@46196 384 ifneq ($(JIB_JAR), )
ctornqvi@46196 385 JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)")
ctornqvi@46196 386 endif
ihse@42424 387 ifeq ($(IGNORE_MARKED_TESTS), true)
ihse@42424 388 # Option to tell jtreg to not run tests marked with "ignore"
ihse@42424 389 ifeq ($(PLATFORM), windows)
ihse@42424 390 JTREG_KEY_OPTION = -k:!ignore
ihse@42424 391 else
ihse@42424 392 JTREG_KEY_OPTION = -k:\!ignore
ihse@42424 393 endif
ihse@42424 394 JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION)
ihse@42424 395 endif
ihse@42424 396
ihse@42424 397 # Make sure jtreg exists
ihse@42424 398 ifeq ($(USE_WINDOWS_EXISTENCE_CHECK), true)
ihse@42424 399 jtreg_exists:
ihse@42424 400 test -d $(shell $(GETMIXEDPATH) "$(JT_HOME)")
ihse@42424 401 test -f $(shell $(GETMIXEDPATH) "$(JTREG)")
ihse@42424 402
ihse@42424 403 else
ihse@42424 404 jtreg_exists: $(JT_HOME)
ihse@42424 405 endif
ihse@42424 406 PHONY_LIST += jtreg_exists
ihse@42424 407
ihse@42424 408 # Run jtreg
ihse@42424 409 jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
ihse@42424 410 ( \
ihse@42424 411 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
ihse@42424 412 export JT_HOME; \
ihse@42424 413 $(shell $(GETMIXEDPATH) "$(JTREG)") \
ihse@42424 414 $(JTREG_BASIC_OPTIONS) \
ihse@42424 415 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
ihse@42424 416 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
ihse@42424 417 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
ihse@42424 418 $(JTREG_NATIVE_PATH) \
ihse@42424 419 $(JTREG_FAILURE_HANDLER_OPTIONS) \
ihse@42424 420 $(JTREG_EXCLUSIONS) \
ihse@42424 421 $(JTREG_TEST_OPTIONS) \
ihse@42424 422 $(TEST_SELECTION) \
ihse@42424 423 ) ; \
ihse@42424 424 $(BUNDLE_UP_AND_EXIT) \
ihse@42424 425 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
ihse@42424 426
ihse@42424 427 PHONY_LIST += jtreg_tests
ihse@42424 428
erikj@47218 429 # Make it possible to call this with <component>_jtreg_tests
erikj@47218 430 %_jtreg_tests: jtreg_tests
erikj@47218 431 # Must have a fake recipe here to prevent make from matching any other rule
erikj@47218 432
ihse@42424 433 ################################################################
ihse@42424 434
ihse@42424 435 # Phony targets (e.g. these are not filenames)
ihse@42424 436 .PHONY: all clean prep $(PHONY_LIST)
ihse@42424 437
ihse@42424 438 ################################################################