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