annotate test/TestCommon.gmk @ 47418:43b33ee91ea0

8189115: Pass JIB_DATA_DIR to jtreg harness Reviewed-by: erikj
author ctornqvi
date Wed, 11 Oct 2017 16:14:47 -0400
parents 7513299d1cd0
children 7be5c153e8a4
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 else
ihse@42424 180 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ihse@42424 181 endif
ihse@42424 182
ihse@42424 183 # How to create the test bundle (pass or fail, we want to create this)
ihse@42424 184 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
ihse@42424 185 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
ihse@42424 186 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
ihse@42424 187 && $(CHMOD) -R a+r . \
ihse@42424 188 && $(ZIPEXE) -q -r $(ARCHIVE_BUNDLE) . )
ihse@42424 189
ihse@42424 190 # important results files
ihse@42424 191 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
ihse@42424 192 STATS_TXT_NAME = Stats.txt
ihse@42424 193 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
ihse@42424 194 RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
ihse@42424 195 PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
ihse@42424 196 FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
ihse@42424 197 EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
ihse@42424 198
ihse@42424 199 TESTEXIT = \
ihse@42424 200 if [ ! -s $(EXITCODE) ] ; then \
ihse@42424 201 $(ECHO) "ERROR: EXITCODE file not filled in."; \
ihse@42424 202 $(ECHO) "1" > $(EXITCODE); \
ihse@42424 203 fi ; \
ihse@42424 204 testExitCode=`$(CAT) $(EXITCODE)`; \
ihse@42424 205 $(ECHO) "EXIT CODE: $${testExitCode}"; \
ihse@42424 206 exit $${testExitCode}
ihse@42424 207
ihse@42424 208 ifeq ($(TREAT_EXIT_CODE_1_AS_0), true)
ihse@42424 209 ADJUST_EXIT_CODE := \
ihse@42424 210 if [ $${jtregExitCode} = 1 ] ; then \
ihse@42424 211 jtregExitCode=0; \
ihse@42424 212 fi
ihse@42424 213 else
ihse@42424 214 # colon is the shell no-op
ihse@42424 215 ADJUST_EXIT_CODE := :
ihse@42424 216 endif
ihse@42424 217
ihse@42424 218 BUNDLE_UP_AND_EXIT = \
ihse@42424 219 ( \
ihse@42424 220 jtregExitCode=$$? && \
ihse@42424 221 _summary="$(SUMMARY_TXT)"; \
ihse@42424 222 $(ADJUST_EXIT_CODE) ; \
ihse@42424 223 $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
ihse@42424 224 $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
ihse@42424 225 if [ -r "$${_summary}" ] ; then \
ihse@42424 226 $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
ihse@42424 227 $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
ihse@42424 228 $(EGREP) ' Passed\.' $(RUNLIST) \
ihse@42424 229 | $(EGREP) -v ' Error\.' \
ihse@42424 230 | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
ihse@42424 231 ( $(EGREP) ' Failed\.' $(RUNLIST); \
ihse@42424 232 $(EGREP) ' Error\.' $(RUNLIST); \
ihse@42424 233 $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
ihse@42424 234 | $(SORT) | $(UNIQ) > $(FAILLIST); \
ihse@42424 235 if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
ihse@42424 236 $(EXPAND) $(FAILLIST) \
ihse@42424 237 | $(CUT) -d' ' -f1 \
ihse@42424 238 | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
ihse@42424 239 if [ $${jtregExitCode} = 0 ] ; then \
ihse@42424 240 jtregExitCode=1; \
ihse@42424 241 fi; \
ihse@42424 242 fi; \
ihse@42424 243 runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 244 passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 245 failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ihse@42424 246 exclc="FIXME CODETOOLS-7900176"; \
ihse@42424 247 $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \
ihse@42424 248 >> $(STATS_TXT); \
ihse@42424 249 else \
ihse@42424 250 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
ihse@42424 251 fi; \
ihse@42424 252 if [ -f $(STATS_TXT) ] ; then \
ihse@42424 253 $(CAT) $(STATS_TXT); \
ihse@42424 254 fi; \
ihse@42424 255 $(ZIP_UP_RESULTS) ; \
ihse@42424 256 $(TESTEXIT) \
ihse@42424 257 )
ihse@42424 258
ihse@42424 259 ################################################################
ihse@42424 260
ihse@42424 261 # Prep for output
ihse@42424 262 # Change execute permissions on shared library files.
ihse@42424 263 # Files in repositories should never have execute permissions, but
ihse@42424 264 # there are some tests that have pre-built shared libraries, and these
ihse@42424 265 # windows dll files must have execute permission. Adding execute
ihse@42424 266 # permission may happen automatically on windows when using certain
ihse@42424 267 # versions of mercurial but it cannot be guaranteed. And blindly
ihse@42424 268 # adding execute permission might be seen as a mercurial 'change', so
ihse@42424 269 # we avoid adding execute permission to repository files. But testing
ihse@42424 270 # from a plain source tree needs the chmod a+rx. Applying the chmod to
ihse@42424 271 # all shared libraries not just dll files. And with CYGWIN and sshd
ihse@42424 272 # service, you may need CYGWIN=ntsec for this to work.
ihse@42424 273 prep:
ihse@42424 274 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
ihse@42424 275 @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
mcimadamore@47330 276 @if [ ! -d $(TEST_ROOT)/../../.hg ] && [ ! -d $(TEST_ROOT)/../../../.hg ]; then \
ihse@42424 277 $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
ihse@42424 278 -exec $(CHMOD) a+rx {} \; ; \
ihse@42424 279 fi
ihse@42424 280
ihse@42424 281 ifeq ($(CLEAN_BEFORE_PREP), true)
ihse@42424 282 prep: clean
ihse@42424 283
ihse@42424 284 endif
ihse@42424 285
ihse@42424 286 # Cleanup
ihse@42424 287 clean:
ihse@42424 288 @$(RM) -r $(ABS_TEST_OUTPUT_DIR)
ihse@42424 289 @$(RM) $(ARCHIVE_BUNDLE)
ihse@42424 290
ihse@42424 291 ################################################################
ihse@42424 292
ihse@42424 293 # jtreg tests
ihse@42424 294
ihse@42424 295 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ihse@42424 296 ifndef JT_HOME
ihse@42424 297 JT_HOME = $(SLASH_JAVA)/re/jtreg/$(USE_JTREG_VERSION)/promoted/latest/binaries/jtreg
ihse@42424 298 ifdef JPRT_JTREG_HOME
ihse@42424 299 JT_HOME = $(JPRT_JTREG_HOME)
ihse@42424 300 endif
ihse@42424 301 endif
ihse@42424 302
ihse@42424 303 # Problematic tests to be excluded
erikj@47218 304 PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt))
ihse@42424 305
ihse@42424 306 # Create exclude list for this platform and arch
ihse@42424 307 ifdef NO_EXCLUDES
ihse@42424 308 JTREG_EXCLUSIONS =
ihse@42424 309 else
ihse@42424 310 JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
ihse@42424 311 endif
ihse@42424 312
ihse@42424 313 # convert list of directories to dos paths
ihse@42424 314 define MixedDirs
ihse@42424 315 $(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
ihse@42424 316 endef
ihse@42424 317
ihse@42424 318 # ------------------------------------------------------------------
ihse@42424 319
ihse@42424 320 # When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
ihse@42424 321 ifdef TESTDIRS
ihse@42424 322 TEST_SELECTION = $(TESTDIRS)
ihse@42424 323 endif
ihse@42424 324
ihse@42424 325 ifdef CONCURRENCY
ihse@42424 326 JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
ihse@42424 327 endif
ihse@42424 328 ifdef EXTRA_JTREG_OPTIONS
ihse@42424 329 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
ihse@42424 330 endif
ihse@42424 331
ihse@42424 332 # Default JTREG to run
ihse@42424 333 JTREG = $(JT_HOME)/bin/jtreg
ihse@42424 334 # run in agentvm/othervm mode
ihse@42424 335 JTREG_BASIC_OPTIONS += $(JTREG_VM_TYPE)
ihse@42424 336 # Only run automatic tests
ihse@42424 337 JTREG_BASIC_OPTIONS += -a
ihse@42424 338 # Always turn on assertions
ihse@42424 339 ifeq ($(USE_JTREG_ASSERT), true)
ihse@42424 340 JTREG_ASSERT_OPTION = -ea -esa
ihse@42424 341 endif
ihse@42424 342 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
ihse@42424 343 # jtreg verbosity setting
ihse@42424 344 # Default is to report details on all failed or error tests, times too
ihse@42424 345 JTREG_VERBOSE ?= fail,error,time
ihse@42424 346 JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE))
ihse@42424 347 # Retain all files for failing tests
ihse@42424 348 JTREG_BASIC_OPTIONS += -retain:fail,error
ihse@42424 349 # Ignore tests are not run and completely silent about it
ihse@42424 350 JTREG_IGNORE_OPTION = -ignore:quiet
ihse@42424 351 JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
ihse@42424 352 # Multiply by 4 the timeout factor
ihse@42424 353 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
ihse@42424 354 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
ihse@42424 355 ifeq ($(LIMIT_JTREG_VM_MEMORY), true)
ihse@42424 356 # Set the max memory for jtreg control vm
ihse@42424 357 JTREG_MEMORY_OPTION = -J-Xmx512m
ihse@42424 358 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
ihse@42424 359 # Set the max memory for jtreg target test vms
ihse@42424 360 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
ihse@42424 361 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
ihse@42424 362 endif
ctornqvi@47418 363 # Make it possible to specify the JIB_DATA_DIR for tests using the
ctornqvi@47418 364 # JIB Artifact resolver
ctornqvi@47418 365 JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
ihse@42424 366 # Give tests access to JT_JAVA, see JDK-8141609
ihse@42424 367 JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
bobv@46192 368 # Give aot tests access to Visual Studio installation
bobv@46192 369 ifneq ($(VS120COMNTOOLS), )
bobv@46192 370 JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)")
bobv@46192 371 endif
ihse@42424 372 # Set other vm and test options
ctornqvi@46248 373 JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
ctornqvi@46196 374 ifneq ($(JIB_JAR), )
ctornqvi@46196 375 JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)")
ctornqvi@46196 376 endif
ihse@42424 377 ifeq ($(IGNORE_MARKED_TESTS), true)
ihse@42424 378 # Option to tell jtreg to not run tests marked with "ignore"
ihse@42424 379 ifeq ($(PLATFORM), windows)
ihse@42424 380 JTREG_KEY_OPTION = -k:!ignore
ihse@42424 381 else
ihse@42424 382 JTREG_KEY_OPTION = -k:\!ignore
ihse@42424 383 endif
ihse@42424 384 JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION)
ihse@42424 385 endif
ihse@42424 386
ihse@42424 387 # Make sure jtreg exists
ihse@42424 388 ifeq ($(USE_WINDOWS_EXISTENCE_CHECK), true)
ihse@42424 389 jtreg_exists:
ihse@42424 390 test -d $(shell $(GETMIXEDPATH) "$(JT_HOME)")
ihse@42424 391 test -f $(shell $(GETMIXEDPATH) "$(JTREG)")
ihse@42424 392
ihse@42424 393 else
ihse@42424 394 jtreg_exists: $(JT_HOME)
ihse@42424 395 endif
ihse@42424 396 PHONY_LIST += jtreg_exists
ihse@42424 397
ihse@42424 398 # Run jtreg
ihse@42424 399 jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
ihse@42424 400 ( \
ihse@42424 401 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
ihse@42424 402 export JT_HOME; \
ihse@42424 403 $(shell $(GETMIXEDPATH) "$(JTREG)") \
ihse@42424 404 $(JTREG_BASIC_OPTIONS) \
ihse@42424 405 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
ihse@42424 406 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
ihse@42424 407 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
ihse@42424 408 $(JTREG_NATIVE_PATH) \
ihse@42424 409 $(JTREG_FAILURE_HANDLER_OPTIONS) \
ihse@42424 410 $(JTREG_EXCLUSIONS) \
ihse@42424 411 $(JTREG_TEST_OPTIONS) \
ihse@42424 412 $(TEST_SELECTION) \
ihse@42424 413 ) ; \
ihse@42424 414 $(BUNDLE_UP_AND_EXIT) \
ihse@42424 415 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
ihse@42424 416
ihse@42424 417 PHONY_LIST += jtreg_tests
ihse@42424 418
erikj@47218 419 # Make it possible to call this with <component>_jtreg_tests
erikj@47218 420 %_jtreg_tests: jtreg_tests
erikj@47218 421 # Must have a fake recipe here to prevent make from matching any other rule
erikj@47218 422
ihse@42424 423 ################################################################
ihse@42424 424
ihse@42424 425 # Phony targets (e.g. these are not filenames)
ihse@42424 426 .PHONY: all clean prep $(PHONY_LIST)
ihse@42424 427
ihse@42424 428 ################################################################