1 #
   2 # Copyright (c) 1995, 2012, 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
  23 # questions.
  24 #
  25 
  26 #
  27 # Makefile to run various jdk tests
  28 #
  29 
  30 # Empty these to get rid of some default rules
  31 .SUFFIXES:
  32 .SUFFIXES: .java
  33 CO=
  34 GET=
  35 
  36 # Utilities used
  37 AWK       = awk
  38 CAT       = cat
  39 CD        = cd
  40 CHMOD     = chmod
  41 CP        = cp
  42 CUT       = cut
  43 DIRNAME   = dirname
  44 ECHO      = echo
  45 EGREP     = egrep
  46 EXPAND    = expand
  47 FIND      = find
  48 MKDIR     = mkdir
  49 PWD       = pwd
  50 SED       = sed
  51 SORT      = sort
  52 TEE       = tee
  53 UNAME     = uname
  54 UNIQ      = uniq
  55 WC        = wc
  56 ZIP       = zip
  57 
  58 # Get OS name from uname
  59 UNAME_S := $(shell $(UNAME) -s)
  60 
  61 # Commands to run on paths to make mixed paths for java on windows
  62 GETMIXEDPATH=$(ECHO)
  63 
  64 # Location of developer shared files
  65 SLASH_JAVA = /java
  66 
  67 # Platform specific settings
  68 ifeq ($(UNAME_S), SunOS)
  69   OS_NAME     = solaris
  70   OS_ARCH    := $(shell $(UNAME) -p)
  71   OS_VERSION := $(shell $(UNAME) -r)
  72 endif
  73 ifeq ($(UNAME_S), Linux)
  74   OS_NAME     = linux
  75   OS_ARCH    := $(shell $(UNAME) -m)
  76   # Check for unknown arch, try uname -p if uname -m says unknown
  77   ifeq ($(OS_ARCH),unknown)
  78     OS_ARCH    := $(shell $(UNAME) -p)
  79   endif
  80   OS_VERSION := $(shell $(UNAME) -r)
  81 endif
  82 ifeq ($(UNAME_S), Darwin)
  83   OS_NAME     = macosx
  84   OS_ARCH    := $(shell $(UNAME) -m)
  85   # Check for unknown arch, try uname -p if uname -m says unknown
  86   ifeq ($(OS_ARCH),unknown)
  87     OS_ARCH    := $(shell $(UNAME) -p)
  88   endif
  89   OS_VERSION := $(shell $(UNAME) -r)
  90 endif
  91 ifeq ($(OS_NAME),)
  92   OS_NAME = windows
  93   # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
  94   # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
  95   ifeq ($(PROCESSOR_IDENTIFIER),)
  96     PROC_ARCH:=$(shell $(UNAME) -m)
  97   else
  98     PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
  99   endif
 100   OS_ARCH:=$(PROC_ARCH)
 101   SLASH_JAVA = J:
 102   EXESUFFIX = .exe
 103   # These need to be different depending on MKS or CYGWIN
 104   ifeq ($(findstring cygdrive,$(shell ($(CD) C:/ && $(PWD)))), )
 105     GETMIXEDPATH  = dosname -s
 106     OS_VERSION   := $(shell $(UNAME) -r)
 107   else
 108     GETMIXEDPATH  = cygpath -m -s
 109     OS_VERSION   := $(shell $(UNAME) -s | $(CUT) -d'-' -f2)
 110   endif
 111 endif
 112 
 113 # Only want major and minor numbers from os version
 114 OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)
 115 
 116 # Name to use for x86_64 arch (historically amd64, but should change someday)
 117 OS_ARCH_X64_NAME:=amd64
 118 #OS_ARCH_X64_NAME:=x64
 119 
 120 # Alternate arch names (in case this arch is known by a second name)
 121 #   PROBLEM_LISTS may use either name.
 122 OS_ARCH2-amd64:=x64
 123 #OS_ARCH2-x64:=amd64
 124 
 125 # Try and use the arch names consistently
 126 OS_ARCH:=$(patsubst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 127 OS_ARCH:=$(patsubst X64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 128 OS_ARCH:=$(patsubst AMD64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 129 OS_ARCH:=$(patsubst amd64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 130 OS_ARCH:=$(patsubst x86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 131 OS_ARCH:=$(patsubst 86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 132 OS_ARCH:=$(patsubst 8664,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 133 OS_ARCH:=$(patsubst EM64T,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 134 OS_ARCH:=$(patsubst em64t,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 135 OS_ARCH:=$(patsubst intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 136 OS_ARCH:=$(patsubst Intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 137 OS_ARCH:=$(patsubst INTEL64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
 138 OS_ARCH:=$(patsubst IA64,ia64,$(OS_ARCH))
 139 OS_ARCH:=$(patsubst X86,i586,$(OS_ARCH))
 140 OS_ARCH:=$(patsubst x86,i586,$(OS_ARCH))
 141 OS_ARCH:=$(patsubst i386,i586,$(OS_ARCH))
 142 OS_ARCH:=$(patsubst i486,i586,$(OS_ARCH))
 143 OS_ARCH:=$(patsubst i686,i586,$(OS_ARCH))
 144 OS_ARCH:=$(patsubst 386,i586,$(OS_ARCH))
 145 OS_ARCH:=$(patsubst 486,i586,$(OS_ARCH))
 146 OS_ARCH:=$(patsubst 586,i586,$(OS_ARCH))
 147 OS_ARCH:=$(patsubst 686,i586,$(OS_ARCH))
 148 
 149 # Default  ARCH_DATA_MODEL settings
 150 ARCH_DATA_MODEL-i586 = 32
 151 ARCH_DATA_MODEL-$(OS_ARCH_X64_NAME) = 64
 152 ARCH_DATA_MODEL-ia64 = 64
 153 ARCH_DATA_MODEL-sparc = 32
 154 ARCH_DATA_MODEL-sparcv9 = 64
 155 
 156 # If ARCH_DATA_MODEL is not defined, try and pick a reasonable default
 157 ifndef ARCH_DATA_MODEL
 158   ARCH_DATA_MODEL:=$(ARCH_DATA_MODEL-$(OS_ARCH))
 159 endif
 160 ifndef ARCH_DATA_MODEL
 161   ARCH_DATA_MODEL=32
 162 endif
 163 
 164 # Platform directory name
 165 PLATFORM_OS = $(OS_NAME)-$(OS_ARCH)
 166 
 167 # Check ARCH_DATA_MODEL, adjust OS_ARCH accordingly on solaris
 168 ARCH_DATA_MODEL_ERROR= \
 169   ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(PLATFORM_OS)
 170 ifeq ($(ARCH_DATA_MODEL),64)
 171   ifeq ($(PLATFORM_OS),solaris-i586)
 172     OS_ARCH=$(OS_ARCH_X64_NAME)
 173   endif
 174   ifeq ($(PLATFORM_OS),solaris-sparc)
 175     OS_ARCH=sparcv9
 176   endif
 177   ifeq ($(OS_ARCH),i586)
 178     x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 179   endif
 180   ifeq ($(OS_ARCH),sparc)
 181     x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 182   endif
 183 else
 184   ifeq ($(ARCH_DATA_MODEL),32)
 185     ifeq ($(OS_ARCH),$(OS_ARCH_X64_NAME))
 186       x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 187     endif
 188     ifeq ($(OS_ARCH),ia64)
 189       x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 190     endif
 191     ifeq ($(OS_ARCH),sparcv9)
 192       x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 193     endif
 194   else
 195     x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
 196   endif
 197 endif
 198 
 199 # Alternate OS_ARCH name (defaults to OS_ARCH)
 200 OS_ARCH2:=$(OS_ARCH2-$(OS_ARCH))
 201 ifeq ($(OS_ARCH2),)
 202   OS_ARCH2:=$(OS_ARCH)
 203 endif
 204 
 205 # Root of this test area (important to use full paths in some places)
 206 TEST_ROOT := $(shell $(PWD))
 207 
 208 # Root of all test results
 209 ifdef ALT_OUTPUTDIR
 210   ABS_OUTPUTDIR = $(ALT_OUTPUTDIR)
 211 else
 212   ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(PLATFORM_OS)
 213 endif
 214 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
 215 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
 216 
 217 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
 218 ifndef PRODUCT_HOME
 219   # Try to use j2sdk-image if it exists
 220   ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/j2sdk-image
 221   PRODUCT_HOME :=                                       \
 222     $(shell                                             \
 223       if [ -d $(ABS_JDK_IMAGE) ] ; then                 \
 224          $(ECHO) "$(ABS_JDK_IMAGE)";                    \
 225        else                                             \
 226          $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";          \
 227        fi)
 228   PRODUCT_HOME := $(PRODUCT_HOME)
 229 endif
 230 
 231 # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
 232 #   Should be passed into 'java' only.
 233 #   Could include: -d64 -server -client OR any java option
 234 ifdef JPRT_PRODUCT_ARGS
 235   JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
 236 endif
 237 
 238 # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
 239 #   Should be passed into anything running the vm (java, javac, javadoc, ...).
 240 ifdef JPRT_PRODUCT_VM_ARGS
 241   JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
 242 endif
 243 
 244 # Check JAVA_ARGS arguments based on ARCH_DATA_MODEL etc.
 245 ifeq ($(OS_NAME),solaris)
 246   D64_ERROR_MESSAGE=Mismatch between ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) and use of -d64 in JAVA_ARGS=$(JAVA_ARGS)
 247   ifeq ($(ARCH_DATA_MODEL),32)
 248     ifneq ($(findstring -d64,$(JAVA_ARGS)),)
 249       x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
 250     endif
 251   endif
 252   ifeq ($(ARCH_DATA_MODEL),64)
 253     ifeq ($(findstring -d64,$(JAVA_ARGS)),)
 254       x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
 255     endif
 256   endif
 257 endif
 258 
 259 # Macro to run make and set the shared library permissions
 260 define SharedLibraryPermissions
 261 $(MAKE) SHARED_LIBRARY_DIR=$1 UNIQUE_DIR=$@ shared_library_permissions
 262 endef
 263 
 264 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
 265 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
 266 ifdef JPRT_ARCHIVE_BUNDLE
 267   ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
 268 endif
 269 
 270 # How to create the test bundle (pass or fail, we want to create this)
 271 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 272 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
 273                    && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
 274                    && $(CHMOD) -R a+r . \
 275                    && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
 276 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
 277 STATS_TXT_NAME = Stats.txt
 278 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/$(STATS_TXT_NAME)
 279 RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
 280 PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
 281 FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
 282 EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt
 283 
 284 TESTEXIT = \
 285   if [ ! -s $(EXITCODE) ] ; then \
 286     $(ECHO) "ERROR: EXITCODE file not filled in."; \
 287     $(ECHO) "1" > $(EXITCODE); \
 288   fi ; \
 289   testExitCode=`$(CAT) $(EXITCODE)`; \
 290   $(ECHO) "EXIT CODE: $${testExitCode}"; \
 291   exit $${testExitCode}
 292 
 293 BUNDLE_UP_AND_EXIT = \
 294 ( \
 295   jtregExitCode=$$? && \
 296   _summary="$(SUMMARY_TXT)"; \
 297   $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
 298   $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
 299   if [ -r "$${_summary}" ] ; then \
 300     $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
 301     $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
 302     $(EGREP) ' Passed\.' $(RUNLIST) \
 303       | $(EGREP) -v ' Error\.' \
 304       | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
 305     ( $(EGREP) ' Failed\.' $(RUNLIST); \
 306       $(EGREP) ' Error\.' $(RUNLIST); \
 307       $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
 308       | $(SORT) | $(UNIQ) > $(FAILLIST); \
 309     if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
 310       $(EXPAND) $(FAILLIST) \
 311         | $(CUT) -d' ' -f1 \
 312         | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
 313       if [ $${jtregExitCode} = 0 ] ; then \
 314         jtregExitCode=1; \
 315       fi; \
 316     fi; \
 317     runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 318     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 319     failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 320     exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
 321     $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
 322       >> $(STATS_TXT); \
 323   else \
 324     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
 325   fi; \
 326   if [ -f $(STATS_TXT) ] ; then \
 327     $(CAT) $(STATS_TXT); \
 328   fi; \
 329   $(ZIP_UP_RESULTS) ; \
 330   $(TESTEXIT) \
 331 )
 332 
 333 ################################################################
 334 
 335 # Default make rule (runs jtreg_tests)
 336 all: jtreg_tests
 337         @$(ECHO) "Testing completed successfully"
 338 
 339 # Prep for output
 340 prep: clean
 341         @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
 342         @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
 343 
 344 # Cleanup
 345 clean:
 346         $(RM) -r $(ABS_TEST_OUTPUT_DIR)
 347         $(RM) $(ARCHIVE_BUNDLE)
 348 
 349 ################################################################
 350 
 351 # jtreg tests
 352 
 353 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
 354 ifndef JT_HOME
 355   JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
 356   ifdef JPRT_JTREG_HOME
 357     JT_HOME = $(JPRT_JTREG_HOME)
 358   endif
 359 endif
 360 
 361 # Expect JPRT to set TESTDIRS to the jtreg test dirs
 362 ifndef TESTDIRS
 363   TESTDIRS = demo
 364 endif
 365 
 366 # Agentvm settings (default is false)
 367 ifndef USE_JTREG_AGENTVM
 368   USE_JTREG_AGENTVM=false
 369 endif
 370 # With agentvm, you cannot use -javaoptions?
 371 ifeq ($(USE_JTREG_AGENTVM),true)
 372   JTREG_AGENTVM_OPTION = -agentvm
 373   EXTRA_JTREG_OPTIONS += $(JTREG_AGENTVM_OPTION) $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%)
 374   JTREG_TEST_OPTIONS = $(JAVA_VM_ARGS:%=-vmoption:%)
 375 else
 376   JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
 377 endif
 378 
 379 ifdef CONCURRENCY
 380   EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
 381 endif
 382 
 383 # Some tests annoy me and fail frequently
 384 PROBLEM_LIST=ProblemList.txt
 385 PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
 386 EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt
 387 
 388 # Create exclude list for this platform and arch
 389 ifdef NO_EXCLUDES
 390 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
 391         @$(ECHO) "NOTHING_EXCLUDED" > $@
 392 else
 393 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TEST_DEPENDENCIES)
 394         @$(RM) $@ $@.temp1 $@.temp2
 395         @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
 396           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
 397           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)'  ) ;\
 398           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
 399           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
 400           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH2)'     ) ;\
 401           ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all'             ) ;\
 402           ($(ECHO) "#") ;\
 403         ) | $(SED) -e 's@^[\ ]*@@' \
 404           | $(EGREP) -v '^#' > $@.temp1
 405         for tdir in $(TESTDIRS) SOLARIS_10_SH_BUG_NO_EMPTY_FORS ; do \
 406           ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
 407         done
 408         @$(ECHO) "# at least one line" >> $@.temp2
 409         @( $(EGREP) -v '^#' $@.temp2 ; true ) > $@
 410         @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
 411 endif
 412 
 413 # Select list of directories that exist
 414 define TestDirs
 415 $(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
 416 endef
 417 # Running batches of tests with or without agentvm
 418 define RunAgentvmBatch
 419 $(ECHO) "Running tests in agentvm mode: $?"
 420 $(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_AGENTVM=true  UNIQUE_DIR=$@ jtreg_tests
 421 endef
 422 define RunOthervmBatch
 423 $(ECHO) "Running tests in othervm mode: $?"
 424 $(MAKE) TEST_DEPENDENCIES="$?" TESTDIRS="$?" USE_JTREG_AGENTVM=false UNIQUE_DIR=$@ jtreg_tests
 425 endef
 426 define SummaryInfo
 427 $(ECHO) "########################################################"
 428 $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
 429 $(ECHO) "########################################################"
 430 endef
 431 
 432 # ------------------------------------------------------------------
 433 
 434 # Batches of tests (somewhat arbitrary assigments to jdk_* targets)
 435 JDK_ALL_TARGETS =
 436 
 437 # Stable othervm testruns (minus items from PROBLEM_LIST)
 438 #   Using samevm has problems, and doesn't help performance as much as others.
 439 JDK_ALL_TARGETS += jdk_awt
 440 jdk_awt: $(call TestDirs, com/sun/awt java/awt sun/awt \
 441          javax/imageio javax/print sun/pisces)
 442         $(call RunOthervmBatch)
 443 
 444 # Stable samevm testruns (minus items from PROBLEM_LIST)
 445 JDK_ALL_TARGETS += jdk_beans1
 446 jdk_beans1: $(call TestDirs, \
 447             java/beans/beancontext java/beans/PropertyChangeSupport \
 448             java/beans/Introspector java/beans/Performance \
 449             java/beans/VetoableChangeSupport java/beans/Statement)
 450         $(call RunAgentvmBatch)
 451 
 452 # Stable othervm testruns (minus items from PROBLEM_LIST)
 453 #   Using samevm has serious problems with these tests
 454 JDK_ALL_TARGETS += jdk_beans2
 455 jdk_beans2: $(call TestDirs, \
 456             java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
 457             java/beans/PropertyEditor)
 458         $(call RunOthervmBatch)
 459 
 460 # Stable othervm testruns (minus items from PROBLEM_LIST)
 461 #   Using agentvm has serious problems with these tests
 462 JDK_ALL_TARGETS += jdk_beans3
 463 jdk_beans3: $(call TestDirs, java/beans/XMLEncoder)
 464         $(call RunOthervmBatch)
 465 
 466 # All beans tests
 467 jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
 468         @$(SummaryInfo)
 469 
 470 # Stable agentvm testruns (minus items from PROBLEM_LIST)
 471 JDK_ALL_TARGETS += jdk_io
 472 jdk_io: $(call TestDirs, java/io)
 473         $(call RunAgentvmBatch)
 474 
 475 # Stable othervm testruns (minus items from PROBLEM_LIST)
 476 #   Using agentvm has serious problems with these tests
 477 ifdef OPENJDK
 478 jdk_jfr:
 479 else
 480 JDK_ALL_TARGETS += jdk_jfr
 481 jdk_jfr: $(call TestDirs, com/oracle/jfr)
 482         $(call RunOthervmBatch)
 483 endif
 484 
 485 # Stable agentvm testruns (minus items from PROBLEM_LIST)
 486 JDK_ALL_TARGETS += jdk_lang
 487 jdk_lang: $(call TestDirs, java/lang sun/invoke sun/misc vm)
 488         $(call RunAgentvmBatch)
 489 
 490 # Stable othervm testruns (minus items from PROBLEM_LIST)
 491 #   Using agentvm has serious problems with these tests
 492 JDK_ALL_TARGETS += jdk_jmx
 493 jdk_jmx: $(call TestDirs, javax/management com/sun/jmx)
 494         $(call RunOthervmBatch)
 495 
 496 # Stable othervm testruns (minus items from PROBLEM_LIST)
 497 #   Using agentvm has serious problems with these tests
 498 JDK_ALL_TARGETS += jdk_management
 499 jdk_management: $(call TestDirs, com/sun/management sun/management)
 500         $(call RunOthervmBatch)
 501 
 502 # Stable samevm testruns (minus items from PROBLEM_LIST)
 503 JDK_ALL_TARGETS += jdk_math
 504 jdk_math: $(call TestDirs, java/math)
 505         $(call RunAgentvmBatch)
 506 
 507 # Stable samevm testruns (minus items from PROBLEM_LIST)
 508 JDK_ALL_TARGETS += jdk_other
 509 jdk_other: $(call TestDirs, \
 510           demo/jvmti demo/zipfs \
 511           javax/naming com/sun/jndi \
 512           javax/script \
 513           java/sql javax/sql \
 514           javax/smartcardio \
 515           javax/xml/soap \
 516           javax/xml/jaxp \
 517           com/sun/xml \
 518           javax/xml/ws com/sun/internal/ws \
 519           com/sun/org/apache/xerces \
 520           com/sun/corba \
 521           com/sun/tracing \
 522           sun/usagetracker) 
 523         $(call RunAgentvmBatch)
 524 
 525 # Stable samevm testruns (minus items from PROBLEM_LIST)
 526 JDK_ALL_TARGETS += jdk_net
 527 jdk_net: $(call TestDirs, com/sun/net java/net sun/net com/oracle/net)
 528         $(call RunAgentvmBatch)
 529 
 530 # Stable samevm testruns (minus items from PROBLEM_LIST)
 531 jdk_nio: $(call TestDirs, java/nio sun/nio com/oracle/nio)
 532         $(call SharedLibraryPermissions,java/nio/channels)
 533         $(call RunAgentvmBatch)
 534 
 535 # Stable samevm testruns (minus items from PROBLEM_LIST)
 536 jdk_sctp: $(call TestDirs, com/sun/nio/sctp)
 537         $(call RunAgentvmBatch)
 538 
 539 # Stable othervm testruns (minus items from PROBLEM_LIST)
 540 #   Using samevm has serious problems with these tests
 541 JDK_ALL_TARGETS += jdk_rmi
 542 jdk_rmi: $(call TestDirs, java/rmi sun/rmi javax/rmi/ssl)
 543         $(call RunOthervmBatch)
 544 
 545 # Stable samevm testruns (minus items from PROBLEM_LIST)
 546 JDK_ALL_TARGETS += jdk_security1
 547 jdk_security1: $(call TestDirs, java/security)
 548         $(call RunAgentvmBatch)
 549 
 550 # Stable othervm testruns (minus items from PROBLEM_LIST)
 551 #   Using samevm has serious problems with these tests
 552 JDK_ALL_TARGETS += jdk_security2
 553 jdk_security2: $(call TestDirs, javax/crypto com/sun/crypto)
 554         $(call RunAgentvmBatch)
 555 
 556 # Stable othervm testruns (minus items from PROBLEM_LIST)
 557 #   Using samevm has serious problems with these tests
 558 JDK_ALL_TARGETS += jdk_security3
 559 jdk_security3: $(call TestDirs, com/sun/security lib/security \
 560                 javax/security sun/security \
 561                 com/sun/org/apache/xml/internal/security \
 562                 com/oracle/security)
 563         $(call SharedLibraryPermissions,sun/security)
 564         $(call RunAgentvmBatch)
 565 
 566 # All security tests
 567 jdk_security: jdk_security1 jdk_security2 jdk_security3
 568         @$(SummaryInfo)
 569 
 570 # Stable samevm testruns (minus items from PROBLEM_LIST)
 571 JDK_ALL_TARGETS += jdk_sound
 572 jdk_sound: $(call TestDirs, javax/sound)
 573         $(call RunAgentvmBatch)
 574 
 575 # Stable othervm testruns (minus items from PROBLEM_LIST)
 576 #   Using samevm has problems, and doesn't help performance as much as others.
 577 JDK_ALL_TARGETS += jdk_swing
 578 jdk_swing: $(call TestDirs, javax/swing sun/java2d \
 579            demo/jfc com/sun/java/swing)
 580         $(call RunOthervmBatch)
 581 
 582 # Stable samevm testruns (minus items from PROBLEM_LIST)
 583 JDK_ALL_TARGETS += jdk_text
 584 jdk_text: $(call TestDirs, java/text sun/text)
 585         $(call RunAgentvmBatch)
 586 
 587 # Stable samevm testruns (minus items from PROBLEM_LIST)
 588 JDK_ALL_TARGETS += jdk_jdi
 589 jdk_jdi: $(call TestDirs, com/sun/jdi)
 590         $(call RunAgentvmBatch)
 591 
 592 # Stable othervm testruns (minus items from PROBLEM_LIST)
 593 #   Using samevm has serious problems with these tests
 594 JDK_ALL_TARGETS += jdk_tools
 595 jdk_tools: $(call TestDirs, \
 596                 com/sun/tools sun/jvmstat sun/tools tools \
 597                 com/sun/tracing)
 598         $(call SharedLibraryPermissions,tools/launcher)
 599         $(call RunAgentvmBatch)
 600 
 601 # Stable samevm testruns (minus items from PROBLEM_LIST)
 602 JDK_ALL_TARGETS += jdk_util
 603 jdk_util: $(call TestDirs, java/util sun/util)
 604         $(call RunAgentvmBatch)
 605 
 606 # ------------------------------------------------------------------
 607 
 608 # Run all tests
 609 FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing
 610 JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS))
 611 jdk_all: $(JDK_ALL_STABLE_TARGETS)
 612         @$(SummaryInfo)
 613 
 614 # These are all phony targets
 615 PHONY_LIST += $(JDK_ALL_TARGETS)
 616 
 617 # ------------------------------------------------------------------
 618 
 619 # Default JTREG to run (win32 script works for everybody)
 620 JTREG = $(JT_HOME)/win32/bin/jtreg
 621 # Add any extra options (agentvm etc.)
 622 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
 623 # Only run automatic tests
 624 JTREG_BASIC_OPTIONS += -a
 625 # Always turn on assertions
 626 JTREG_ASSERT_OPTION = -ea -esa
 627 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
 628 # Report details on all failed or error tests, times too
 629 JTREG_BASIC_OPTIONS += -v:fail,error,time
 630 # Retain all files for failing tests
 631 JTREG_BASIC_OPTIONS += -retain:fail,error
 632 # Ignore tests are not run and completely silent about it
 633 JTREG_IGNORE_OPTION = -ignore:quiet
 634 JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
 635 # Multiple by 4 the timeout numbers
 636 JTREG_TIMEOUT_OPTION =  -timeoutFactor:4
 637 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
 638 # Boost the max memory for jtreg to avoid gc thrashing
 639 JTREG_MEMORY_OPTION = -J-Xmx512m
 640 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
 641 
 642 # Make sure jtreg exists
 643 $(JTREG): $(JT_HOME)
 644 
 645 # Run jtreg
 646 jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST)
 647         @$(EXPAND) $(EXCLUDELIST) \
 648             | $(CUT) -d' ' -f1 \
 649             | $(SED) -e 's@^@Excluding: @'
 650         (                                                                    \
 651           ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
 652             export JT_HOME;                                                  \
 653             $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
 654               $(JTREG_BASIC_OPTIONS)                                         \
 655               -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
 656               -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
 657               -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
 658               -exclude:$(shell $(GETMIXEDPATH) "$(EXCLUDELIST)")             \
 659               $(JTREG_TEST_OPTIONS)                                          \
 660               $(TESTDIRS)                                                    \
 661           ) ; $(BUNDLE_UP_AND_EXIT)                                          \
 662         ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
 663 
 664 # Rule that may change execute permissions on shared library files.
 665 #  Files in repositories should never have execute permissions, but there
 666 #  are some tests that have pre-built shared libraries, and these windows
 667 #  dll files must have execute permission. Adding execute permission
 668 #  may happen automatically on windows when using certain versions of mercurial
 669 #  but it cannot be guaranteed. And blindly adding execute permission might
 670 #  be seen as a mercurial 'change', so we avoid adding execute permission to
 671 #  repository files. But testing from a plain source tree needs the chmod a+rx.
 672 #  Used on select directories and applying the chmod to all shared libraries
 673 #  not just dll files. On windows, this may not work with MKS if the files
 674 #  were installed with CYGWIN unzip or untar (MKS chmod may not do anything).
 675 #  And with CYGWIN and sshd service, you may need CYGWIN=ntsec for this to work.
 676 #
 677 shared_library_permissions: $(SHARED_LIBRARY_DIR)
 678         if [ ! -d $(TEST_ROOT)/../.hg ] ; then                          \
 679           $(FIND) $< \( -name \*.dll -o -name \*.DLL -o -name \*.so \)  \
 680                 -exec $(CHMOD) a+rx {} \; ;                             \
 681         fi
 682 
 683 PHONY_LIST += jtreg_tests shared_library_permissions
 684 
 685 ################################################################
 686 
 687 # packtest
 688 
 689 # Expect JPRT to set JPRT_PACKTEST_HOME.
 690 PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
 691 ifdef JPRT_PACKTEST_HOME
 692   PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
 693 endif
 694 
 695 packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
 696         ( $(CD) $(PACKTEST_HOME) &&            \
 697             $(PACKTEST_HOME)/ptest             \
 698                  -t "$(PRODUCT_HOME)"          \
 699                  $(PACKTEST_STRESS_OPTION)     \
 700                  $(EXTRA_PACKTEST_OPTIONS)     \
 701                  -W $(ABS_TEST_OUTPUT_DIR)     \
 702                  $(JAVA_ARGS:%=-J %)           \
 703                  $(JAVA_VM_ARGS:%=-J %)        \
 704          ) ; $(BUNDLE_UP_AND_EXIT)
 705 
 706 packtest_stress: PACKTEST_STRESS_OPTION=-s
 707 packtest_stress: packtest
 708 
 709 PHONY_LIST += packtest packtest_stress
 710 
 711 ################################################################
 712 
 713 # perftest to collect statistics
 714 
 715 # Expect JPRT to set JPRT_PACKTEST_HOME.
 716 PERFTEST_HOME = $(TEST_ROOT)/perf
 717 ifdef JPRT_PERFTEST_HOME
 718   PERFTEST_HOME = $(JPRT_PERFTEST_HOME)
 719 endif
 720 
 721 perftest: ( $(PERFTEST_HOME)/perftest          \
 722                  -t $(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")               \
 723                  -w $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)") \
 724                  -h $(PERFTEST_HOME) \
 725          ) ; $(BUNDLE_UP_AND_EXIT)
 726 
 727 
 728 PHONY_LIST += perftest
 729 
 730 ################################################################
 731 
 732 # vmsqe tests
 733 
 734 # Expect JPRT to set JPRT_VMSQE_HOME.
 735 VMSQE_HOME = $(SLASH_JAVA)/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
 736 ifdef JPRT_VMSQE_HOME
 737   VMSQE_HOME = $(JPRT_VMSQE_HOME)
 738 endif
 739 
 740 # Expect JPRT to set JPRT_RUNVMSQE_HOME.
 741 RUNVMSQE_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/runvmsqe
 742 ifdef JPRT_RUNVMSQE_HOME
 743   RUNVMSQE_HOME = $(JPRT_RUNVMSQE_HOME)
 744 endif
 745 
 746 # Expect JPRT to set JPRT_TONGA3_HOME.
 747 TONGA3_HOME = $(SLASH_JAVA)/sqe/tools/gtee/harness/tonga
 748 ifdef JPRT_TONGA3_HOME
 749   TONGA3_HOME = $(JPRT_TONGA3_HOME)
 750 endif
 751 
 752 RUNVMSQE_BIN = $(RUNVMSQE_HOME)/bin/runvmsqe
 753 
 754 vmsqe_tests: prep $(VMSQE_HOME)/vm $(TONGA3_HOME) $(RUNVMSQE_BIN) $(PRODUCT_HOME)
 755         $(RM) -r $(ABS_TEST_OUTPUT_DIR)/vmsqe
 756         ( $(CD) $(ABS_TEST_OUTPUT_DIR) &&          \
 757             $(RUNVMSQE_BIN)                        \
 758                  -jdk "$(PRODUCT_HOME)"            \
 759                  -o "$(ABS_TEST_OUTPUT_DIR)/vmsqe" \
 760                  -testbase "$(VMSQE_HOME)/vm"      \
 761                  -tonga "$(TONGA3_HOME)"           \
 762                  -tongajdk "$(ALT_BOOTDIR)"        \
 763                  $(JAVA_ARGS)                      \
 764                  $(JAVA_VM_ARGS)                   \
 765                  $(RUNVMSQE_TEST_OPTION)           \
 766                  $(EXTRA_RUNVMSQE_OPTIONS)         \
 767          ) ; $(BUNDLE_UP_AND_EXIT)
 768 
 769 vmsqe_jdwp: RUNVMSQE_TEST_OPTION=-jdwp
 770 vmsqe_jdwp: vmsqe_tests
 771 
 772 vmsqe_jdi: RUNVMSQE_TEST_OPTION=-jdi
 773 vmsqe_jdi: vmsqe_tests
 774 
 775 vmsqe_jdb: RUNVMSQE_TEST_OPTION=-jdb
 776 vmsqe_jdb: vmsqe_tests
 777 
 778 vmsqe_quick-jdi: RUNVMSQE_TEST_OPTION=-quick-jdi
 779 vmsqe_quick-jdi: vmsqe_tests
 780 
 781 vmsqe_sajdi: RUNVMSQE_TEST_OPTION=-sajdi
 782 vmsqe_sajdi: vmsqe_tests
 783 
 784 vmsqe_jvmti: RUNVMSQE_TEST_OPTION=-jvmti
 785 vmsqe_jvmti: vmsqe_tests
 786 
 787 vmsqe_hprof: RUNVMSQE_TEST_OPTION=-hprof
 788 vmsqe_hprof: vmsqe_tests
 789 
 790 vmsqe_monitoring: RUNVMSQE_TEST_OPTION=-monitoring
 791 vmsqe_monitoring: vmsqe_tests
 792 
 793 PHONY_LIST += vmsqe_jdwp vmsqe_jdi vmsqe_jdb vmsqe_quick-jdi vmsqe_sajdi \
 794               vmsqe_jvmti vmsqe_hprof vmsqe_monitoring vmsqe_tests
 795 
 796 ################################################################
 797 
 798 # jck tests
 799 
 800 # Default is to use jck 7 from /java/re
 801 JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/7/promoted/latest/binaries
 802 
 803 # Expect JPRT to set JPRT_JCK7COMPILER_HOME.
 804 JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-7
 805 ifdef JPRT_JCK7COMPILER_HOME
 806   JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)/JCK-compiler-7
 807 endif
 808 
 809 # Expect JPRT to set JPRT_JCK7RUNTIME_HOME.
 810 JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-7
 811 ifdef JPRT_JCK7RUNTIME_HOME
 812   JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)/JCK-runtime-7
 813 endif
 814 
 815 # Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME.
 816 JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-7
 817 ifdef JPRT_JCK7DEVTOOLS_HOME
 818   JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)/JCK-devtools-7
 819 endif
 820 
 821 # The jtjck.jar utility to use to run the tests
 822 JTJCK_JAR = $(JCK_HOME)/lib/jtjck.jar
 823 JTJCK_JAVA_ARGS =  -XX:MaxPermSize=256m -Xmx512m
 824 JTJCK_OPTIONS = -headless -v
 825 
 826 # Default tests to run
 827 ifndef JCK_COMPILER_TESTS
 828   JCK_COMPILER_TESTS =
 829 endif
 830 ifndef JCK_RUNTIME_TESTS
 831   JCK_RUNTIME_TESTS  =
 832 endif
 833 ifndef JCK_DEVTOOLS_TESTS
 834   JCK_DEVTOOLS_TESTS =
 835 endif
 836 
 837 # Generic rule used to run jck tests
 838 _generic_jck_tests: prep $(PRODUCT_HOME) $(EXCLUDELIST)
 839         @$(EXPAND) $(EXCLUDELIST) \
 840             | $(CUT) -d' ' -f1 \
 841             | $(SED) -e 's@^@Excluding: @'
 842         ( $(CD) $(ABS_TEST_OUTPUT_DIR) &&                                  \
 843           $(PRODUCT_HOME)/bin/java $(JTJCK_JAVA_ARGS)                      \
 844             -jar "$(JTJCK_JAR)"                                            \
 845             $(JTJCK_OPTIONS)                                               \
 846             -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
 847             -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
 848             -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
 849             $(TESTDIRS)                                                    \
 850         ) ; $(BUNDLE_UP_AND_EXIT)
 851 
 852 # JCK7 compiler tests
 853 jck7compiler:
 854         $(MAKE) UNIQUE_DIR=$@ \
 855                 JCK_HOME=$(JCK7COMPILER_HOME) \
 856                 TESTDIRS="$(JCK_COMPILER_TESTS)" \
 857                 _generic_jck_tests
 858 
 859 # JCK7 runtime tests
 860 jck7runtime:
 861         $(MAKE) UNIQUE_DIR=$@ \
 862                 JCK_HOME=$(JCK7RUNTIME_HOME) \
 863                 TESTDIRS="$(JCK_RUNTIME_TESTS)" \
 864                 _generic_jck_tests
 865 
 866 # JCK7 devtools tests
 867 jck7devtools:
 868         $(MAKE) UNIQUE_DIR=$@ \
 869                 JCK_HOME=$(JCK7DEVTOOLS_HOME) \
 870                 TESTDIRS="$(JCK_DEVTOOLS_TESTS)" \
 871                 _generic_jck_tests
 872 
 873 # Run all 3 sets of JCK7 tests
 874 jck_all: jck7runtime jck7devtools jck7compiler
 875 
 876 PHONY_LIST += jck_all _generic_jck_tests \
 877               jck7compiler jck7runtime jck7devtools
 878 
 879 ################################################################
 880 
 881 # Phony targets (e.g. these are not filenames)
 882 .PHONY: all clean prep $(PHONY_LIST)
 883 
 884 ################################################################
 885