Makefile 30.3 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
3 4 5 6
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# 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 12 13 14 15 16 17 18 19 20
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
21 22 23
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
24 25 26 27
#

#
# Makefile to run various jdk tests
D
duke 已提交
28 29
#

30 31 32 33 34 35 36 37 38 39
# Empty these to get rid of some default rules
.SUFFIXES:
.SUFFIXES: .java
CO=
GET=

# Utilities used
AWK       = awk
CAT       = cat
CD        = cd
40
CHMOD     = chmod
41 42
CP        = cp
CUT       = cut
43
DIRNAME   = dirname
44 45 46
ECHO      = echo
EGREP     = egrep
EXPAND    = expand
47
FIND      = find
48 49 50 51 52 53 54 55 56 57 58 59
MKDIR     = mkdir
PWD       = pwd
SED       = sed
SORT      = sort
TEE       = tee
UNAME     = uname
UNIQ      = uniq
WC        = wc
ZIP       = zip

# Get OS name from uname
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 65 66 67

# Location of developer shared files
SLASH_JAVA = /java

# Platform specific settings
68 69 70 71
ifeq ($(UNAME_S), SunOS)
  OS_NAME     = solaris
  OS_ARCH    := $(shell $(UNAME) -p)
  OS_VERSION := $(shell $(UNAME) -r)
D
duke 已提交
72
endif
73 74 75
ifeq ($(UNAME_S), Linux)
  OS_NAME     = linux
  OS_ARCH    := $(shell $(UNAME) -m)
76 77 78 79
  # Check for unknown arch, try uname -p if uname -m says unknown
  ifeq ($(OS_ARCH),unknown)
    OS_ARCH    := $(shell $(UNAME) -p)
  endif
80
  OS_VERSION := $(shell $(UNAME) -r)
D
duke 已提交
81
endif
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
ifeq ($(OS_NAME),)
  OS_NAME = windows
  # GNU Make or MKS overrides $(PROCESSOR_ARCHITECTURE) to always
  # return "x86". Use the first word of $(PROCESSOR_IDENTIFIER) instead.
  ifeq ($(PROCESSOR_IDENTIFIER),)
    PROC_ARCH:=$(shell $(UNAME) -m)
  else
    PROC_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER))
  endif
  OS_ARCH:=$(PROC_ARCH)
  SLASH_JAVA = J:
  EXESUFFIX = .exe
  # These need to be different depending on MKS or CYGWIN
  ifeq ($(findstring cygdrive,$(shell ($(CD) C:/ && $(PWD)))), )
    GETMIXEDPATH  = dosname -s
    OS_VERSION   := $(shell $(UNAME) -r)
  else
    GETMIXEDPATH  = cygpath -m -s
    OS_VERSION   := $(shell $(UNAME) -s | $(CUT) -d'-' -f2)
D
duke 已提交
101
  endif
102 103 104 105 106
endif

# Only want major and minor numbers from os version
OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2)

107 108 109 110 111 112 113 114 115 116
# Name to use for x86_64 arch (historically amd64, but should change someday)
OS_ARCH_X64_NAME:=amd64
#OS_ARCH_X64_NAME:=x64

# Alternate arch names (in case this arch is known by a second name)
#   PROBLEM_LISTS may use either name.
OS_ARCH2-amd64:=x64
#OS_ARCH2-x64:=amd64

# Try and use the arch names consistently
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
OS_ARCH:=$(patsubst x64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst X64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst AMD64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst amd64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst x86_64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst 8664,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst EM64T,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst em64t,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst Intel64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst INTEL64,$(OS_ARCH_X64_NAME),$(OS_ARCH))
OS_ARCH:=$(patsubst IA64,ia64,$(OS_ARCH))
OS_ARCH:=$(patsubst X86,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst x86,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst i386,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst i486,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst i686,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst 386,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst 486,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst 586,i586,$(OS_ARCH))
OS_ARCH:=$(patsubst 686,i586,$(OS_ARCH))
138

139 140 141 142 143 144 145 146 147 148 149
# Default  ARCH_DATA_MODEL settings
ARCH_DATA_MODEL-i586 = 32
ARCH_DATA_MODEL-$(OS_ARCH_X64_NAME) = 64
ARCH_DATA_MODEL-ia64 = 64
ARCH_DATA_MODEL-sparc = 32
ARCH_DATA_MODEL-sparcv9 = 64

# If ARCH_DATA_MODEL is not defined, try and pick a reasonable default
ifndef ARCH_DATA_MODEL
  ARCH_DATA_MODEL:=$(ARCH_DATA_MODEL-$(OS_ARCH))
endif
150 151 152
ifndef ARCH_DATA_MODEL
  ARCH_DATA_MODEL=32
endif
153 154 155 156 157

# Platform directory name
PLATFORM_OS = $(OS_NAME)-$(OS_ARCH)

# 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 162
  ifeq ($(PLATFORM_OS),solaris-i586)
    OS_ARCH=$(OS_ARCH_X64_NAME)
163
  endif
164
  ifeq ($(PLATFORM_OS),solaris-sparc)
165 166 167 168 169 170 171 172 173 174
    OS_ARCH=sparcv9
  endif
  ifeq ($(OS_ARCH),i586)
    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
  endif
  ifeq ($(OS_ARCH),sparc)
    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
  endif
else
  ifeq ($(ARCH_DATA_MODEL),32)
175
    ifeq ($(OS_ARCH),$(OS_ARCH_X64_NAME))
176 177 178 179 180 181 182 183
      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
    endif
    ifeq ($(OS_ARCH),ia64)
      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
    endif
    ifeq ($(OS_ARCH),sparcv9)
      x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
    endif
184
  else
185
    x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)")
186
  endif
D
duke 已提交
187 188
endif

189 190 191 192 193 194
# Alternate OS_ARCH name (defaults to OS_ARCH)
OS_ARCH2:=$(OS_ARCH2-$(OS_ARCH))
ifeq ($(OS_ARCH2),)
  OS_ARCH2:=$(OS_ARCH)
endif

D
duke 已提交
195
# Root of this test area (important to use full paths in some places)
196
TEST_ROOT := $(shell $(PWD))
D
duke 已提交
197

198 199 200
# Root of all test results
ifdef ALT_OUTPUTDIR
  ABS_OUTPUTDIR = $(ALT_OUTPUTDIR)
D
duke 已提交
201
else
202
  ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(PLATFORM_OS)
D
duke 已提交
203
endif
204 205
ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
D
duke 已提交
206

207 208 209
# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ifndef PRODUCT_HOME
  # Try to use j2sdk-image if it exists
210 211 212 213 214 215 216
  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/j2sdk-image
  PRODUCT_HOME :=                       		\
    $(shell                             		\
      if [ -d $(ABS_JDK_IMAGE) ] ; then 		\
         $(ECHO) "$(ABS_JDK_IMAGE)";    		\
       else                             		\
         $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";		\
217 218 219
       fi)
  PRODUCT_HOME := $(PRODUCT_HOME)
endif
D
duke 已提交
220

221 222
# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
#   Should be passed into 'java' only.
223
#   Could include: -d64 -server -client OR any java option
224 225 226
ifdef JPRT_PRODUCT_ARGS
  JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
endif
D
duke 已提交
227

228 229 230 231 232
# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
#   Should be passed into anything running the vm (java, javac, javadoc, ...).
ifdef JPRT_PRODUCT_VM_ARGS
  JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
endif
D
duke 已提交
233

234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
# Check JAVA_ARGS arguments based on ARCH_DATA_MODEL etc.
ifeq ($(OS_NAME),solaris)
  D64_ERROR_MESSAGE=Mismatch between ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) and use of -d64 in JAVA_ARGS=$(JAVA_ARGS)
  ifeq ($(ARCH_DATA_MODEL),32)
    ifneq ($(findstring -d64,$(JAVA_ARGS)),)
      x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
    endif
  endif
  ifeq ($(ARCH_DATA_MODEL),64)
    ifeq ($(findstring -d64,$(JAVA_ARGS)),)
      x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)")
    endif
  endif
endif

249 250 251
# Macro to run make and set the shared library permissions
define SharedLibraryPermissions
$(MAKE) SHARED_LIBRARY_DIR=$1 UNIQUE_DIR=$@ shared_library_permissions
252 253
endef

254 255 256 257 258 259 260 261
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ifdef JPRT_ARCHIVE_BUNDLE
  ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
endif

# How to create the test bundle (pass or fail, we want to create this)
#   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
262
ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
263 264
	           && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
	           && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
265 266 267 268 269 270
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt
STATS_TXT_NAME = Stats.txt
STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/$(STATS_TXT_NAME)
RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt
PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt
FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt
271 272 273 274 275 276 277 278 279
EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt

TESTEXIT = \
  if [ ! -s $(EXITCODE) ] ; then \
    $(ECHO) "ERROR: EXITCODE file not filled in."; \
    $(ECHO) "1" > $(EXITCODE); \
  fi ; \
  testExitCode=`$(CAT) $(EXITCODE)`; \
  $(ECHO) "EXIT CODE: $${testExitCode}"; \
280
  exit $${testExitCode}
281

282 283
BUNDLE_UP_AND_EXIT = \
( \
284
  jtregExitCode=$$? && \
285
  _summary="$(SUMMARY_TXT)"; \
286 287
  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
288
  if [ -r "$${_summary}" ] ; then \
289
    $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
290 291 292 293 294 295 296 297
    $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
    $(EGREP) ' Passed\.' $(RUNLIST) \
      | $(EGREP) -v ' Error\.' \
      | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
    ( $(EGREP) ' Failed\.' $(RUNLIST); \
      $(EGREP) ' Error\.' $(RUNLIST); \
      $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
      | $(SORT) | $(UNIQ) > $(FAILLIST); \
298
    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
299 300 301
      $(EXPAND) $(FAILLIST) \
        | $(CUT) -d' ' -f1 \
        | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
302 303 304
      if [ $${jtregExitCode} = 0 ] ; then \
        jtregExitCode=1; \
      fi; \
305 306 307 308 309
    fi; \
    runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
    passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
    failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
    exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
310
    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
311 312 313 314 315
      >> $(STATS_TXT); \
  else \
    $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
  fi; \
  $(CAT) $(STATS_TXT); \
316
  $(ZIP_UP_RESULTS) ; \
317
  $(TESTEXIT) \
318
)
319 320 321 322 323 324 325 326 327 328

################################################################

# Default make rule (runs jtreg_tests)
all: jtreg_tests
	@$(ECHO) "Testing completed successfully"

# Prep for output
prep: clean
	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
329
	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
D
duke 已提交
330 331 332

# Cleanup
clean:
333 334 335 336 337 338 339 340
	$(RM) -r $(ABS_TEST_OUTPUT_DIR)
	$(RM) $(ARCHIVE_BUNDLE)

################################################################

# jtreg tests

# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
341 342 343 344 345
ifndef JT_HOME
  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
  ifdef JPRT_JTREG_HOME
    JT_HOME = $(JPRT_JTREG_HOME)
  endif
346 347 348 349
endif

# Expect JPRT to set TESTDIRS to the jtreg test dirs
ifndef TESTDIRS
350
  TESTDIRS = demo
351 352
endif

353 354 355 356 357 358
# Samevm settings (default is false)
ifndef USE_JTREG_SAMEVM
  USE_JTREG_SAMEVM=false
endif
# With samevm, you cannot use -javaoptions?
ifeq ($(USE_JTREG_SAMEVM),true)
359 360
  JTREG_SAMEVM_OPTION = -samevm
  EXTRA_JTREG_OPTIONS += $(JTREG_SAMEVM_OPTION) $(JAVA_ARGS) $(JAVA_ARGS:%=-vmoption:%)
361 362 363 364 365 366 367
  JTREG_TEST_OPTIONS = $(JAVA_VM_ARGS:%=-vmoption:%)
else
  JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
endif

# Some tests annoy me and fail frequently
PROBLEM_LIST=ProblemList.txt
368
PROBLEM_LISTS=$(PROBLEM_LIST) $(wildcard closed/$(PROBLEM_LIST))
369 370 371 372
EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt

# Create exclude list for this platform and arch
ifdef NO_EXCLUDES
373
$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
374 375
	@$(ECHO) "NOTHING_EXCLUDED" > $@
else
376
$(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
377
	@$(RM) $@ $@.temp1 $@.temp2
378
	@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
379
	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
380
	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)'  ) ;\
381 382
	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
383
	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH2)'     ) ;\
384 385
          ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all'             ) ;\
          ($(ECHO) "#") ;\
386 387 388 389 390 391 392 393 394 395
        ) | $(SED) -e 's@^[\ ]*@@' \
          | $(EGREP) -v '^#' > $@.temp1
	@for tdir in $(TESTDIRS) ; do \
          ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \
        done
	@$(ECHO) "# at least one line" >> $@.temp2
	@( $(EGREP) -v '^#' $@.temp2 ; true ) > $@
	@$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items"
endif

396 397 398 399
# Select list of directories that exist
define TestDirs
$(foreach i,$1,$(wildcard ${i})) $(foreach i,$1,$(wildcard closed/${i}))
endef
400 401
# Running batches of tests with or without samevm
define RunSamevmBatch
402 403
$(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)"
$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests
404 405
endef
define RunOthervmBatch
406 407
$(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)"
$(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests
408 409
endef
define SummaryInfo
410
$(ECHO) "########################################################"
411
$(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
412
$(ECHO) "########################################################"
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438
endef

# ------------------------------------------------------------------

# Batches of tests (somewhat arbitrary assigments to jdk_* targets)
JDK_ALL_TARGETS =

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has problems, and doesn't help performance as much as others.
JDK_ALL_TARGETS += jdk_awt
jdk_awt: com/sun/awt java/awt sun/awt
	$(call RunOthervmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_beans1
jdk_beans1: java/beans/beancontext java/beans/PropertyChangeSupport \
            java/beans/Introspector java/beans/Performance \
            java/beans/VetoableChangeSupport java/beans/Statement
	$(call RunSamevmBatch)

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_beans2
jdk_beans2: java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \
            java/beans/PropertyEditor
	$(call RunOthervmBatch)
439 440 441

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
442 443 444 445
JDK_ALL_TARGETS += jdk_beans3
jdk_beans3: java/beans/XMLEncoder
	$(call RunOthervmBatch)

446
# All beans tests
447 448 449
jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3
	@$(SummaryInfo)

450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_io
jdk_io: java/io
	$(call RunSamevmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_lang
jdk_lang: java/lang
	$(call RunSamevmBatch)

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_management1
jdk_management1: javax/management
	$(call RunOthervmBatch)

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_management2
jdk_management2: com/sun/jmx com/sun/management sun/management
	$(call RunOthervmBatch)

472
# All management tests
473 474 475
jdk_management: jdk_management1 jdk_management2
	@$(SummaryInfo)

476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_math
jdk_math: java/math
	$(call RunSamevmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_misc
jdk_misc: demo javax/imageio javax/naming javax/print javax/script \
          javax/smartcardio javax/sound com/sun/java com/sun/jndi \
	  com/sun/org sun/misc sun/pisces
	$(call RunSamevmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_net
jdk_net: com/sun/net java/net sun/net
	$(call RunSamevmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_nio1
jdk_nio1: java/nio/file
	$(call RunSamevmBatch)

498
# Stable samevm testruns (minus items from PROBLEM_LIST)
499 500 501
JDK_ALL_TARGETS += jdk_nio2
jdk_nio2: java/nio/Buffer java/nio/ByteOrder \
          java/nio/channels java/nio/BufferPoolMXBean java/nio/MappedByteBuffer
502
	$(call SharedLibraryPermissions,java/nio/channels)
503
	$(call RunSamevmBatch)
504

505
# Stable samevm testruns (minus items from PROBLEM_LIST)
506 507
JDK_ALL_TARGETS += jdk_nio3
jdk_nio3: com/sun/nio sun/nio
508
	$(call RunSamevmBatch)
509

510
# All nio tests
511 512 513
jdk_nio: jdk_nio1 jdk_nio2 jdk_nio3
	@$(SummaryInfo)

514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_rmi
jdk_rmi: java/rmi javax/rmi sun/rmi
	$(call RunOthervmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_security1
jdk_security1: java/security
	$(call RunSamevmBatch)

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
JDK_ALL_TARGETS += jdk_security2
jdk_security2: javax/crypto com/sun/crypto
	$(call RunOthervmBatch)
530 531 532

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
533 534
JDK_ALL_TARGETS += jdk_security3
jdk_security3: com/sun/security lib/security javax/security sun/security
535
	$(call SharedLibraryPermissions,sun/security)
536 537
	$(call RunOthervmBatch)

538
# All security tests
539 540 541
jdk_security: jdk_security1 jdk_security2 jdk_security3
	@$(SummaryInfo)

542 543 544 545 546 547 548 549 550 551 552
# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has problems, and doesn't help performance as much as others.
JDK_ALL_TARGETS += jdk_swing
jdk_swing: javax/swing sun/java2d
	$(call RunOthervmBatch)

# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_text
jdk_text: java/text sun/text
	$(call RunSamevmBatch)

553
# Stable samevm testruns (minus items from PROBLEM_LIST)
554 555
JDK_ALL_TARGETS += jdk_tools1
jdk_tools1: com/sun/jdi
556
	$(call RunSamevmBatch)
557 558 559

# Stable othervm testruns (minus items from PROBLEM_LIST)
#   Using samevm has serious problems with these tests
560 561
JDK_ALL_TARGETS += jdk_tools2
jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
562
	$(call SharedLibraryPermissions,tools/launcher)
563
	$(call RunSamevmBatch)
564

565
# All tools tests
566 567 568
jdk_tools: jdk_tools1 jdk_tools2
	@$(SummaryInfo)

569 570 571 572 573 574 575 576
# Stable samevm testruns (minus items from PROBLEM_LIST)
JDK_ALL_TARGETS += jdk_util
jdk_util: java/util sun/util
	$(call RunSamevmBatch)

# ------------------------------------------------------------------

# Run all tests
577 578 579
FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing
JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS))
jdk_all: $(JDK_ALL_STABLE_TARGETS)
580 581 582 583 584 585 586
	@$(SummaryInfo)

# These are all phony targets
PHONY_LIST += $(JDK_ALL_TARGETS)

# ------------------------------------------------------------------

587 588
# Default JTREG to run (win32 script works for everybody)
JTREG = $(JT_HOME)/win32/bin/jtreg
589 590 591 592
# Add any extra options (samevm etc.)
JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
# Only run automatic tests
JTREG_BASIC_OPTIONS += -a
593 594 595
# Always turn on assertions
JTREG_ASSERT_OPTION = -ea -esa
JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
596 597 598 599 600
# Report details on all failed or error tests, times too
JTREG_BASIC_OPTIONS += -v:fail,error,time
# Retain all files for failing tests
JTREG_BASIC_OPTIONS += -retain:fail,error
# Ignore tests are not run and completely silent about it
601 602
JTREG_IGNORE_OPTION = -ignore:quiet
JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
603
# Multiple by 4 the timeout numbers
604 605
JTREG_TIMEOUT_OPTION =  -timeoutFactor:4
JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
606
# Boost the max memory for jtreg to avoid gc thrashing
607 608
JTREG_MEMORY_OPTION = -J-Xmx512m
JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629

# Make sure jtreg exists
$(JTREG): $(JT_HOME)

# Run jtreg
jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST)
	@$(EXPAND) $(EXCLUDELIST) \
            | $(CUT) -d' ' -f1 \
            | $(SED) -e 's@^@Excluding: @'
	(                                                                    \
	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
            export JT_HOME;                                                  \
            $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
              $(JTREG_BASIC_OPTIONS)                                         \
              -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \
              -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \
              -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
              -exclude:$(shell $(GETMIXEDPATH) "$(EXCLUDELIST)")             \
              $(JTREG_TEST_OPTIONS)                                          \
              $(TESTDIRS)                                                    \
	  ) ; $(BUNDLE_UP_AND_EXIT)                                          \
630
	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
631

632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
# Rule that may change execute permissions on shared library files.
#  Files in repositories should never have execute permissions, but there
#  are some tests that have pre-built shared libraries, and these windows
#  dll files must have execute permission. Adding execute permission
#  may happen automatically on windows when using certain versions of mercurial
#  but it cannot be guaranteed. And blindly adding execute permission might
#  be seen as a mercurial 'change', so we avoid adding execute permission to
#  repository files. But testing from a plain source tree needs the chmod a+rx.
#  Used on select directories and applying the chmod to all shared libraries
#  not just dll files. On windows, this may not work with MKS if the files
#  were installed with CYGWIN unzip or untar (MKS chmod may not do anything).
#  And with CYGWIN and sshd service, you may need CYGWIN=ntsec for this to work.
#
shared_library_permissions: $(SHARED_LIBRARY_DIR)
	if [ ! -d $(TEST_ROOT)/../.hg ] ; then                          \
	  $(FIND) $< \( -name \*.dll -o -name \*.DLL -o -name \*.so \)  \
	        -exec $(CHMOD) a+rx {} \; ;                             \
        fi

PHONY_LIST += jtreg_tests shared_library_permissions
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680

################################################################

# packtest

# Expect JPRT to set JPRT_PACKTEST_HOME.
PACKTEST_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/packtest
ifdef JPRT_PACKTEST_HOME
  PACKTEST_HOME = $(JPRT_PACKTEST_HOME)
endif

packtest: prep $(PACKTEST_HOME)/ptest $(PRODUCT_HOME)
	( $(CD) $(PACKTEST_HOME) &&            \
	    $(PACKTEST_HOME)/ptest             \
		 -t "$(PRODUCT_HOME)"          \
	         $(PACKTEST_STRESS_OPTION)     \
		 $(EXTRA_PACKTEST_OPTIONS)     \
		 -W $(ABS_TEST_OUTPUT_DIR)     \
                 $(JAVA_ARGS:%=-J %)           \
                 $(JAVA_VM_ARGS:%=-J %)        \
	 ) ; $(BUNDLE_UP_AND_EXIT)

packtest_stress: PACKTEST_STRESS_OPTION=-s
packtest_stress: packtest

PHONY_LIST += packtest packtest_stress

################################################################

681 682 683
# perftest to collect statistics  

# Expect JPRT to set JPRT_PACKTEST_HOME.
684
PERFTEST_HOME = $(TEST_ROOT)/perf
685 686 687 688 689 690 691 692 693 694 695 696 697 698 699
ifdef JPRT_PERFTEST_HOME
  PERFTEST_HOME = $(JPRT_PERFTEST_HOME)
endif

perftest: ( $(PERFTEST_HOME)/perftest          \
                 -t $(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")               \
                 -w $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)") \
                 -h $(PERFTEST_HOME) \
	 ) ; $(BUNDLE_UP_AND_EXIT)


PHONY_LIST += perftest

################################################################

700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738
# vmsqe tests

# Expect JPRT to set JPRT_VMSQE_HOME.
VMSQE_HOME = /java/sqe/comp/vm/testbase/sqe/vm/current/build/latest/vm
ifdef JPRT_VMSQE_HOME
  VMSQE_HOME = $(JPRT_VMSQE_HOME)
endif

# Expect JPRT to set JPRT_RUNVMSQE_HOME.
RUNVMSQE_HOME = /net/jprt-web.sfbay.sun.com/jprt/allproducts/runvmsqe
ifdef JPRT_RUNVMSQE_HOME
  RUNVMSQE_HOME = $(JPRT_RUNVMSQE_HOME)
endif

# Expect JPRT to set JPRT_TONGA3_HOME.
TONGA3_HOME = /java/sqe//tools/gtee/harness/tonga
ifdef JPRT_TONGA3_HOME
  TONGA3_HOME = $(JPRT_TONGA3_HOME)
endif

RUNVMSQE_BIN = $(RUNVMSQE_HOME)/bin/runvmsqe

vmsqe_tests: prep $(VMSQE_HOME)/vm $(TONGA3_HOME) $(RUNVMSQE_BIN) $(PRODUCT_HOME)
	$(RM) -r $(ABS_TEST_OUTPUT_DIR)/vmsqe
	( $(CD) $(ABS_TEST_OUTPUT_DIR) &&          \
	    $(RUNVMSQE_BIN)                        \
		 -jdk "$(PRODUCT_HOME)"            \
		 -o "$(ABS_TEST_OUTPUT_DIR)/vmsqe" \
		 -testbase "$(VMSQE_HOME)/vm"      \
		 -tonga "$(TONGA3_HOME)"           \
		 -tongajdk "$(ALT_BOOTDIR)"        \
                 $(JAVA_ARGS)                      \
                 $(JAVA_VM_ARGS)                   \
	         $(RUNVMSQE_TEST_OPTION)           \
		 $(EXTRA_RUNVMSQE_OPTIONS)         \
	 ) ; $(BUNDLE_UP_AND_EXIT)

vmsqe_jdwp: RUNVMSQE_TEST_OPTION=-jdwp
vmsqe_jdwp: vmsqe_tests
D
duke 已提交
739

740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
vmsqe_jdi: RUNVMSQE_TEST_OPTION=-jdi
vmsqe_jdi: vmsqe_tests

vmsqe_jdb: RUNVMSQE_TEST_OPTION=-jdb
vmsqe_jdb: vmsqe_tests

vmsqe_quick-jdi: RUNVMSQE_TEST_OPTION=-quick-jdi
vmsqe_quick-jdi: vmsqe_tests

vmsqe_sajdi: RUNVMSQE_TEST_OPTION=-sajdi
vmsqe_sajdi: vmsqe_tests

vmsqe_jvmti: RUNVMSQE_TEST_OPTION=-jvmti
vmsqe_jvmti: vmsqe_tests

vmsqe_hprof: RUNVMSQE_TEST_OPTION=-hprof
vmsqe_hprof: vmsqe_tests

vmsqe_monitoring: RUNVMSQE_TEST_OPTION=-monitoring
vmsqe_monitoring: vmsqe_tests

PHONY_LIST += vmsqe_jdwp vmsqe_jdi vmsqe_jdb vmsqe_quick-jdi vmsqe_sajdi \
              vmsqe_jvmti vmsqe_hprof vmsqe_monitoring vmsqe_tests

################################################################

# jck tests

JCK_WORK_DIR     = $(ABS_TEST_OUTPUT_DIR)/JCKwork
JCK_REPORT_DIR   = $(ABS_TEST_OUTPUT_DIR)/JCKreport
JCK_PROPERTIES   = $(ABS_TEST_OUTPUT_DIR)/jck.properties
JCK_CONFIG       = $(ABS_TEST_OUTPUT_DIR)/jck.config

JCK_JAVA_EXE     = $(PRODUCT_HOME)/bin/java$(EXESUFFIX)

JCK_JAVATEST_JAR = $(JCK_HOME)/lib/javatest.jar
JCK_JAVATEST     = $(ALT_BOOTDIR)/bin/java -jar $(JCK_JAVATEST_JAR)

$(JCK_CONFIG): $(TEST_ROOT)/JCK-$(JCK_BUNDLE_NAME)-$(JCK_RELEASE)-base.jti
	$(RM) $@
	$(MKDIR) -p $(@D)
	$(CP) $< $@

$(JCK_PROPERTIES): $(PRODUCT_HOME) $(JCK_JAVA_EXE)
	$(RM) $@
	$(MKDIR) -p $(@D)
	$(ECHO) "jck.env.compiler.compRefExecute.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
	$(ECHO) "jck.env.compiler.compRefExecute.systemRoot=$(SYSTEMROOT)" >> $@
	$(ECHO) "jck.env.compiler.testCompile.testCompileAPImultiJVM.cmdAsFile=$(JCK_JAVA_EXE)" >> $@
	$(ECHO) "jck.tests.tests=$(JCK_BUNDLE_TESTDIRS)" >> $@

jck_tests: prep $(JCK_HOME) $(JCK_PROPERTIES) $(JCK_CONFIG) $(JCK_JAVATEST_JAR)
	$(MKDIR) -p $(JCK_WORK_DIR)
	( $(JCK_JAVATEST)                            \
		-verbose:commands,non-pass           \
		-testSuite    $(JCK_HOME)            \
		-workDir      $(JCK_WORK_DIR)        \
		-config       $(JCK_CONFIG)          \
		-set -file    $(JCK_PROPERTIES)      \
		-runtests                            \
		-writeReport  $(JCK_REPORT_DIR)      \
        ) ; $(BUNDLE_UP_AND_EXIT)

PHONY_LIST += jck_tests

################################################################

# jck6 tests

JCK6_RELEASE = 6b
JCK6_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK6_RELEASE)/archive/fcs/binaries

# Expect JPRT to set JPRT_JCK6COMPILER_HOME.
JCK6COMPILER_HOME = $(JCK6_DEFAULT_HOME)/JCK-compiler-$(JCK6_RELEASE)
ifdef JPRT_JCK6COMPILER_HOME
  JCK6COMPILER_HOME = $(JPRT_JCK6COMPILER_HOME)
endif

# Expect JPRT to set JPRT_JCK6RUNTIME_HOME.
JCK6RUNTIME_HOME = $(JCK6_DEFAULT_HOME)/JCK-runtime-$(JCK6_RELEASE)
ifdef JPRT_JCK6RUNTIME_HOME
  JCK6RUNTIME_HOME = $(JPRT_JCK6RUNTIME_HOME)
endif

# Expect JPRT to set JPRT_JCK6DEVTOOLS_HOME.
JCK6DEVTOOLS_HOME = $(JCK6_DEFAULT_HOME)/JCK-devtools-$(JCK6_RELEASE)
ifdef JPRT_JCK6DEVTOOLS_HOME
  JCK6DEVTOOLS_HOME = $(JPRT_JCK6DEVTOOLS_HOME)
endif

jck6_tests: JCK_HOME=$(JCK6_HOME)
jck6_tests: JCK_RELEASE=$(JCK6_RELEASE)
jck6_tests: jck_tests

jck6compiler: JCK6_HOME=$(JCK6COMPILER_HOME)
jck6compiler: JCK_BUNDLE_NAME=compiler
jck6compiler: jck6_tests

jck6compiler_lang: JCK_BUNDLE_TESTDIRS=lang
jck6compiler_lang: jck6compiler

jck6runtime: JCK6_HOME=$(JCK6RUNTIME_HOME)
jck6runtime: JCK_BUNDLE_NAME=runtime
jck6runtime: jck6_tests

jck6runtime_lang: JCK_BUNDLE_TESTDIRS=lang
jck6runtime_lang: jck6runtime

jck6devtools: JCK6_HOME=$(JCK6DEVTOOLS_HOME)
jck6devtools: JCK_BUNDLE_NAME=devtools
jck6devtools: jck6_tests

jck6devtools_lang: JCK_BUNDLE_TESTDIRS=lang
jck6devtools_lang: jck6devtools

PHONY_LIST += jck6compiler jck6runtime jck6devtools jck6_tests \
	      jck6compiler_lang jck6runtime_lang jck6devtools_lang

################################################################

# jck7 tests

JCK7_RELEASE = 7
JCK7_DEFAULT_HOME = $(SLASH_JAVA)/re/jck/$(JCK7_RELEASE)/archive/fcs/binaries

# Expect JPRT to set JPRT_JCK7COMPILER_HOME.
JCK7COMPILER_HOME = $(JCK7_DEFAULT_HOME)/JCK-compiler-$(JCK7_RELEASE)
ifdef JPRT_JCK7COMPILER_HOME
  JCK7COMPILER_HOME = $(JPRT_JCK7COMPILER_HOME)
endif

# Expect JPRT to set JPRT_JCK7RUNTIME_HOME.
JCK7RUNTIME_HOME = $(JCK7_DEFAULT_HOME)/JCK-runtime-$(JCK7_RELEASE)
ifdef JPRT_JCK7RUNTIME_HOME
  JCK7RUNTIME_HOME = $(JPRT_JCK7RUNTIME_HOME)
endif

# Expect JPRT to set JPRT_JCK7DEVTOOLS_HOME.
JCK7DEVTOOLS_HOME = $(JCK7_DEFAULT_HOME)/JCK-devtools-$(JCK7_RELEASE)
ifdef JPRT_JCK7DEVTOOLS_HOME
  JCK7DEVTOOLS_HOME = $(JPRT_JCK7DEVTOOLS_HOME)
endif

jck7_tests: JCK_HOME=$(JCK7_HOME)
jck7_tests: JCK_RELEASE=$(JCK7_RELEASE)
jck7_tests: jck_tests

jck7compiler: JCK7_HOME=$(JCK7COMPILER_HOME)
jck7compiler: JCK_BUNDLE_NAME=compiler
jck7compiler: jck7_tests

jck7compiler_lang: JCK_BUNDLE_TESTDIRS=lang
jck7compiler_lang: jck7compiler

jck7runtime: JCK7_HOME=$(JCK7RUNTIME_HOME)
jck7runtime: JCK_BUNDLE_NAME=runtime
jck7runtime: jck7_tests

jck7runtime_lang: JCK_BUNDLE_TESTDIRS=lang
jck7runtime_lang: jck7runtime

jck7devtools: JCK7_HOME=$(JCK7DEVTOOLS_HOME)
jck7devtools: JCK_BUNDLE_NAME=devtools
jck7devtools: jck7_tests

jck7devtools_lang: JCK_BUNDLE_TESTDIRS=lang
jck7devtools_lang: jck7devtools

PHONY_LIST += jck7compiler jck7runtime jck7devtools jck7_tests \
	      jck7compiler_lang jck7runtime_lang jck7devtools_lang

################################################################
D
duke 已提交
912 913

# Phony targets (e.g. these are not filenames)
914 915 916
.PHONY: all clean prep $(PHONY_LIST)

################################################################
D
duke 已提交
917