| 1 | # | 
|---|
| 2 | # Copyright 1995-2009 Sun Microsystems, Inc.  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.  Sun designates this | 
|---|
| 8 | # particular file as subject to the "Classpath" exception as provided | 
|---|
| 9 | # by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | 
|---|
| 22 | # CA 95054 USA or visit www.sun.com if you need additional information or | 
|---|
| 23 | # have any 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 | ECHO      = echo | 
|---|
| 44 | EGREP     = egrep | 
|---|
| 45 | EXPAND    = expand | 
|---|
| 46 | EXPR      = expr | 
|---|
| 47 | KILL      = /usr/bin/kill | 
|---|
| 48 | MKDIR     = mkdir | 
|---|
| 49 | NOHUP     = nohup | 
|---|
| 50 | PWD       = pwd | 
|---|
| 51 | SED       = sed | 
|---|
| 52 | SLEEP     = sleep | 
|---|
| 53 | SORT      = sort | 
|---|
| 54 | TEE       = tee | 
|---|
| 55 | UNAME     = uname | 
|---|
| 56 | UNIQ      = uniq | 
|---|
| 57 | WC        = wc | 
|---|
| 58 | XHOST     = xhost | 
|---|
| 59 | ZIP       = zip | 
|---|
| 60 |  | 
|---|
| 61 | # Get OS name from uname | 
|---|
| 62 | UNAME_S := $(shell $(UNAME) -s) | 
|---|
| 63 |  | 
|---|
| 64 | # Commands to run on paths to make mixed paths for java on windows | 
|---|
| 65 | GETMIXEDPATH=$(ECHO) | 
|---|
| 66 |  | 
|---|
| 67 | # Location of developer shared files | 
|---|
| 68 | SLASH_JAVA = /java | 
|---|
| 69 |  | 
|---|
| 70 | # Platform specific settings | 
|---|
| 71 | ifeq ($(UNAME_S), SunOS) | 
|---|
| 72 | OS_NAME     = solaris | 
|---|
| 73 | OS_ARCH    := $(shell $(UNAME) -p) | 
|---|
| 74 | OS_VERSION := $(shell $(UNAME) -r) | 
|---|
| 75 | endif | 
|---|
| 76 | ifeq ($(UNAME_S), Linux) | 
|---|
| 77 | OS_NAME     = linux | 
|---|
| 78 | OS_ARCH    := $(shell $(UNAME) -m) | 
|---|
| 79 | OS_VERSION := $(shell $(UNAME) -r) | 
|---|
| 80 | endif | 
|---|
| 81 | ifndef OS_NAME | 
|---|
| 82 | ifneq ($(PROCESSOR_IDENTIFIER), ) | 
|---|
| 83 | OS_NAME = windows | 
|---|
| 84 | SLASH_JAVA = J: | 
|---|
| 85 | # A variety of ways to say X64 arch :^( | 
|---|
| 86 | OS_ARCH:=$(word 1, $(PROCESSOR_IDENTIFIER)) | 
|---|
| 87 | EXESUFFIX = .exe | 
|---|
| 88 | # These need to be different depending on MKS or CYGWIN | 
|---|
| 89 | ifeq ($(findstring cygdrive,$(shell ($(CD) C:/ && $(PWD)))), ) | 
|---|
| 90 | GETMIXEDPATH  = dosname -s | 
|---|
| 91 | OS_VERSION   := $(shell $(UNAME) -r) | 
|---|
| 92 | else | 
|---|
| 93 | GETMIXEDPATH  = cygpath -m -s | 
|---|
| 94 | OS_VERSION   := $(shell $(UNAME) -s | $(CUT) -d'-' -f2) | 
|---|
| 95 | endif | 
|---|
| 96 | endif | 
|---|
| 97 | endif | 
|---|
| 98 |  | 
|---|
| 99 | # Only want major and minor numbers from os version | 
|---|
| 100 | OS_VERSION := $(shell $(ECHO) "$(OS_VERSION)" | $(CUT) -d'.' -f1,2) | 
|---|
| 101 |  | 
|---|
| 102 | # Try and use names i586, x64, and ia64 consistently | 
|---|
| 103 | OS_ARCH:=$(subst X64,x64,$(OS_ARCH)) | 
|---|
| 104 | OS_ARCH:=$(subst AMD64,x64,$(OS_ARCH)) | 
|---|
| 105 | OS_ARCH:=$(subst amd64,x64,$(OS_ARCH)) | 
|---|
| 106 | OS_ARCH:=$(subst x86_64,x64,$(OS_ARCH)) | 
|---|
| 107 | OS_ARCH:=$(subst EM64T,x64,$(OS_ARCH)) | 
|---|
| 108 | OS_ARCH:=$(subst em64t,x64,$(OS_ARCH)) | 
|---|
| 109 | OS_ARCH:=$(subst intel64,x64,$(OS_ARCH)) | 
|---|
| 110 | OS_ARCH:=$(subst Intel64,x64,$(OS_ARCH)) | 
|---|
| 111 | OS_ARCH:=$(subst INTEL64,x64,$(OS_ARCH)) | 
|---|
| 112 | OS_ARCH:=$(subst IA64,ia64,$(OS_ARCH)) | 
|---|
| 113 | OS_ARCH:=$(subst X86,i586,$(OS_ARCH)) | 
|---|
| 114 | OS_ARCH:=$(subst x86,i586,$(OS_ARCH)) | 
|---|
| 115 | OS_ARCH:=$(subst i386,i586,$(OS_ARCH)) | 
|---|
| 116 | OS_ARCH:=$(subst i486,i586,$(OS_ARCH)) | 
|---|
| 117 | OS_ARCH:=$(subst i686,i586,$(OS_ARCH)) | 
|---|
| 118 |  | 
|---|
| 119 | # Check for ARCH_DATA_MODEL, adjust OS_ARCH accordingly | 
|---|
| 120 | ifndef ARCH_DATA_MODEL | 
|---|
| 121 | ARCH_DATA_MODEL=32 | 
|---|
| 122 | endif | 
|---|
| 123 | ARCH_DATA_MODEL_ERROR= \ | 
|---|
| 124 | ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) cannot be used with $(OS_NAME)-$(ARCH) | 
|---|
| 125 | ifeq ($(ARCH_DATA_MODEL),64) | 
|---|
| 126 | ifeq ($(OS_NAME)-$(OS_ARCH),solaris-i586) | 
|---|
| 127 | OS_ARCH=x64 | 
|---|
| 128 | endif | 
|---|
| 129 | ifeq ($(OS_NAME)-$(OS_ARCH),solaris-sparc) | 
|---|
| 130 | OS_ARCH=sparcv9 | 
|---|
| 131 | endif | 
|---|
| 132 | ifeq ($(OS_ARCH),i586) | 
|---|
| 133 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 134 | endif | 
|---|
| 135 | ifeq ($(OS_ARCH),sparc) | 
|---|
| 136 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 137 | endif | 
|---|
| 138 | else | 
|---|
| 139 | ifeq ($(ARCH_DATA_MODEL),32) | 
|---|
| 140 | ifeq ($(OS_ARCH),x64) | 
|---|
| 141 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 142 | endif | 
|---|
| 143 | ifeq ($(OS_ARCH),ia64) | 
|---|
| 144 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 145 | endif | 
|---|
| 146 | ifeq ($(OS_ARCH),sparcv9) | 
|---|
| 147 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 148 | endif | 
|---|
| 149 | else | 
|---|
| 150 | x:=$(warning "WARNING: $(ARCH_DATA_MODEL_ERROR)") | 
|---|
| 151 | endif | 
|---|
| 152 | endif | 
|---|
| 153 |  | 
|---|
| 154 | # Root of this test area (important to use full paths in some places) | 
|---|
| 155 | TEST_ROOT := $(shell $(PWD)) | 
|---|
| 156 |  | 
|---|
| 157 | # Root of all test results | 
|---|
| 158 | ifdef ALT_OUTPUTDIR | 
|---|
| 159 | ABS_OUTPUTDIR = $(ALT_OUTPUTDIR) | 
|---|
| 160 | else | 
|---|
| 161 | ABS_OUTPUTDIR = $(TEST_ROOT)/../build/$(OS_NAME)-$(OS_ARCH) | 
|---|
| 162 | endif | 
|---|
| 163 | ABS_BUILD_ROOT = $(ABS_OUTPUTDIR) | 
|---|
| 164 | ABS_TEST_OUTPUT_DIR := $(ABS_BUILD_ROOT)/testoutput/$(UNIQUE_DIR) | 
|---|
| 165 |  | 
|---|
| 166 | # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test) | 
|---|
| 167 | ifndef PRODUCT_HOME | 
|---|
| 168 | # Try to use j2sdk-image if it exists | 
|---|
| 169 | ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image | 
|---|
| 170 | PRODUCT_HOME :=                       \ | 
|---|
| 171 | $(shell                             \ | 
|---|
| 172 | if [ -d $(ABS_JDK_IMAGE) ] ; then \ | 
|---|
| 173 | $(ECHO) "$(ABS_JDK_IMAGE)";    \ | 
|---|
| 174 | else                             \ | 
|---|
| 175 | $(ECHO) "$(ABS_BUILD_ROOT)";   \ | 
|---|
| 176 | fi) | 
|---|
| 177 | PRODUCT_HOME := $(PRODUCT_HOME) | 
|---|
| 178 | endif | 
|---|
| 179 |  | 
|---|
| 180 | # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.) | 
|---|
| 181 | #   Should be passed into 'java' only. | 
|---|
| 182 | #   Could include: -d64 -server -client OR any java option | 
|---|
| 183 | ifdef JPRT_PRODUCT_ARGS | 
|---|
| 184 | JAVA_ARGS = $(JPRT_PRODUCT_ARGS) | 
|---|
| 185 | endif | 
|---|
| 186 |  | 
|---|
| 187 | # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.) | 
|---|
| 188 | #   Should be passed into anything running the vm (java, javac, javadoc, ...). | 
|---|
| 189 | ifdef JPRT_PRODUCT_VM_ARGS | 
|---|
| 190 | JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS) | 
|---|
| 191 | endif | 
|---|
| 192 |  | 
|---|
| 193 | # Check JAVA_ARGS arguments based on ARCH_DATA_MODEL etc. | 
|---|
| 194 | ifeq ($(OS_NAME),solaris) | 
|---|
| 195 | D64_ERROR_MESSAGE=Mismatch between ARCH_DATA_MODEL=$(ARCH_DATA_MODEL) and use of -d64 in JAVA_ARGS=$(JAVA_ARGS) | 
|---|
| 196 | ifeq ($(ARCH_DATA_MODEL),32) | 
|---|
| 197 | ifneq ($(findstring -d64,$(JAVA_ARGS)),) | 
|---|
| 198 | x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)") | 
|---|
| 199 | endif | 
|---|
| 200 | endif | 
|---|
| 201 | ifeq ($(ARCH_DATA_MODEL),64) | 
|---|
| 202 | ifeq ($(findstring -d64,$(JAVA_ARGS)),) | 
|---|
| 203 | x:=$(warning "WARNING: $(D64_ERROR_MESSAGE)") | 
|---|
| 204 | endif | 
|---|
| 205 | endif | 
|---|
| 206 | endif | 
|---|
| 207 |  | 
|---|
| 208 | # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results) | 
|---|
| 209 | ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip | 
|---|
| 210 | ifdef JPRT_ARCHIVE_BUNDLE | 
|---|
| 211 | ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE) | 
|---|
| 212 | endif | 
|---|
| 213 |  | 
|---|
| 214 | # DISPLAY settings for virtual frame buffer | 
|---|
| 215 | START_XVFB = start-Xvfb.sh | 
|---|
| 216 | NOHUP_OUTPUT = $(ABS_TEST_OUTPUT_DIR)/start-Xvfb.nohup-output.txt | 
|---|
| 217 | DISPLAY_PID_FILE=$(ABS_TEST_OUTPUT_DIR)/xvfb-display-number.txt | 
|---|
| 218 | DISPLAY_SLEEP_TIME=10 | 
|---|
| 219 | DISPLAY_MAX_SLEEPS=10 | 
|---|
| 220 | ifeq ($(OS_NAME),solaris) | 
|---|
| 221 | VIRTUAL_FRAME_BUFFER = true | 
|---|
| 222 | endif | 
|---|
| 223 | ifeq ($(OS_NAME),linux) | 
|---|
| 224 | VIRTUAL_FRAME_BUFFER = true | 
|---|
| 225 | endif | 
|---|
| 226 |  | 
|---|
| 227 | # Does not work yet, display dies as soon as it gets used. :^( | 
|---|
| 228 | VIRTUAL_FRAME_BUFFER = false | 
|---|
| 229 |  | 
|---|
| 230 | # Are we using a VIRTUAL_FRAME_BUFFER (Xvfb) | 
|---|
| 231 | ifeq ($(VIRTUAL_FRAME_BUFFER),true) | 
|---|
| 232 |  | 
|---|
| 233 | PREP_DISPLAY = \ | 
|---|
| 234 | $(CP) $(START_XVFB) $(ABS_TEST_OUTPUT_DIR); \ | 
|---|
| 235 | $(CHMOD) a+x $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB); \ | 
|---|
| 236 | ( $(CD) $(ABS_TEST_OUTPUT_DIR) && \ | 
|---|
| 237 | $(NOHUP) $(ABS_TEST_OUTPUT_DIR)/$(START_XVFB) $(DISPLAY_PID_FILE) > $(NOHUP_OUTPUT) 2>&1 && \ | 
|---|
| 238 | $(SLEEP) $(DISPLAY_SLEEP_TIME) ) & \ | 
|---|
| 239 | count=1; \ | 
|---|
| 240 | while [ ! -s $(DISPLAY_PID_FILE) ] ; do \ | 
|---|
| 241 | $(ECHO) "Sleeping $(DISPLAY_SLEEP_TIME) more seconds, DISPLAY not ready"; \ | 
|---|
| 242 | $(SLEEP) $(DISPLAY_SLEEP_TIME); \ | 
|---|
| 243 | count=`$(EXPR) $${count} '+' 1`; \ | 
|---|
| 244 | if [ $${count} -gt $(DISPLAY_MAX_SLEEPS) ] ; then \ | 
|---|
| 245 | $(ECHO) "ERROR: DISPLAY not ready, giving up on DISPLAY"; \ | 
|---|
| 246 | exit 9; \ | 
|---|
| 247 | fi; \ | 
|---|
| 248 | done ; \ | 
|---|
| 249 | DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \ | 
|---|
| 250 | export DISPLAY; \ | 
|---|
| 251 | $(CAT) $(NOHUP_OUTPUT); \ | 
|---|
| 252 | $(ECHO) "Prepared DISPLAY=$${DISPLAY}"; \ | 
|---|
| 253 | $(XHOST) || \ | 
|---|
| 254 | ( $(ECHO) "ERROR: No display" ; exit 8) | 
|---|
| 255 |  | 
|---|
| 256 | KILL_DISPLAY = \ | 
|---|
| 257 | ( \ | 
|---|
| 258 | DISPLAY=":`$(CAT) $(DISPLAY_PID_FILE)`"; \ | 
|---|
| 259 | export DISPLAY; \ | 
|---|
| 260 | if [ -s "$(DISPLAY_PID_FILE)" ] ; then \ | 
|---|
| 261 | $(KILL) `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \ | 
|---|
| 262 | $(KILL) -9 `$(CAT) $(DISPLAY_PID_FILE)` > /dev/null 2>&1; \ | 
|---|
| 263 | fi; \ | 
|---|
| 264 | $(ECHO) "Killed DISPLAY=$${DISPLAY}"; \ | 
|---|
| 265 | ) | 
|---|
| 266 |  | 
|---|
| 267 | else | 
|---|
| 268 |  | 
|---|
| 269 | PREP_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)" | 
|---|
| 270 | KILL_DISPLAY = $(ECHO) "VIRTUAL_FRAME_BUFFER=$(VIRTUAL_FRAME_BUFFER)" | 
|---|
| 271 |  | 
|---|
| 272 | endif | 
|---|
| 273 |  | 
|---|
| 274 | # How to create the test bundle (pass or fail, we want to create this) | 
|---|
| 275 | #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed. | 
|---|
| 276 | ZIP_UP_RESULTS = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`     \ | 
|---|
| 277 | && $(CD) $(ABS_TEST_OUTPUT_DIR)             \ | 
|---|
| 278 | && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . ) | 
|---|
| 279 | SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport/text/summary.txt | 
|---|
| 280 | STATS_TXT_NAME = Stats.txt | 
|---|
| 281 | STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/$(STATS_TXT_NAME) | 
|---|
| 282 | RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/runlist.txt | 
|---|
| 283 | PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/passlist.txt | 
|---|
| 284 | FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/faillist.txt | 
|---|
| 285 | EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/exitcode.txt | 
|---|
| 286 |  | 
|---|
| 287 | TESTEXIT = \ | 
|---|
| 288 | if [ ! -s $(EXITCODE) ] ; then \ | 
|---|
| 289 | $(ECHO) "ERROR: EXITCODE file not filled in."; \ | 
|---|
| 290 | $(ECHO) "1" > $(EXITCODE); \ | 
|---|
| 291 | fi ; \ | 
|---|
| 292 | testExitCode=`$(CAT) $(EXITCODE)`; \ | 
|---|
| 293 | $(ECHO) "EXIT CODE: $${testExitCode}"; \ | 
|---|
| 294 | exit $${testExitCode} | 
|---|
| 295 |  | 
|---|
| 296 | BUNDLE_UP_AND_EXIT = \ | 
|---|
| 297 | ( \ | 
|---|
| 298 | jtregExitCode=$$? && \ | 
|---|
| 299 | _summary="$(SUMMARY_TXT)"; \ | 
|---|
| 300 | $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \ | 
|---|
| 301 | $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \ | 
|---|
| 302 | if [ -r "$${_summary}" ] ; then \ | 
|---|
| 303 | $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \ | 
|---|
| 304 | $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \ | 
|---|
| 305 | $(EGREP) ' Passed\.' $(RUNLIST) \ | 
|---|
| 306 | | $(EGREP) -v ' Error\.' \ | 
|---|
| 307 | | $(EGREP) -v ' Failed\.' > $(PASSLIST); \ | 
|---|
| 308 | ( $(EGREP) ' Failed\.' $(RUNLIST); \ | 
|---|
| 309 | $(EGREP) ' Error\.' $(RUNLIST); \ | 
|---|
| 310 | $(EGREP) -v ' Passed\.' $(RUNLIST) ) \ | 
|---|
| 311 | | $(SORT) | $(UNIQ) > $(FAILLIST); \ | 
|---|
| 312 | if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \ | 
|---|
| 313 | $(EXPAND) $(FAILLIST) \ | 
|---|
| 314 | | $(CUT) -d' ' -f1 \ | 
|---|
| 315 | | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \ | 
|---|
| 316 | if [ $${jtregExitCode} = 0 ] ; then \ | 
|---|
| 317 | jtregExitCode=1; \ | 
|---|
| 318 | fi; \ | 
|---|
| 319 | fi; \ | 
|---|
| 320 | runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \ | 
|---|
| 321 | passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \ | 
|---|
| 322 | failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \ | 
|---|
| 323 | exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \ | 
|---|
| 324 | $(ECHO) "TEST STATS: run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \ | 
|---|
| 325 | >> $(STATS_TXT); \ | 
|---|
| 326 | else \ | 
|---|
| 327 | $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \ | 
|---|
| 328 | fi; \ | 
|---|
| 329 | $(CAT) $(STATS_TXT); \ | 
|---|
| 330 | $(ZIP_UP_RESULTS) && $(KILL_DISPLAY) ; \ | 
|---|
| 331 | $(TESTEXIT) \ | 
|---|
| 332 | ) | 
|---|
| 333 |  | 
|---|
| 334 | ################################################################ | 
|---|
| 335 |  | 
|---|
| 336 | # Default make rule (runs jtreg_tests) | 
|---|
| 337 | all: jtreg_tests | 
|---|
| 338 | @$(ECHO) "Testing completed successfully" | 
|---|
| 339 |  | 
|---|
| 340 | # Prep for output | 
|---|
| 341 | prep: clean | 
|---|
| 342 | @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR) | 
|---|
| 343 | @$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)` | 
|---|
| 344 |  | 
|---|
| 345 | # Cleanup | 
|---|
| 346 | clean: | 
|---|
| 347 | $(RM) -r $(ABS_TEST_OUTPUT_DIR) | 
|---|
| 348 | $(RM) $(ARCHIVE_BUNDLE) | 
|---|
| 349 |  | 
|---|
| 350 | ################################################################ | 
|---|
| 351 |  | 
|---|
| 352 | # jtreg tests | 
|---|
| 353 |  | 
|---|
| 354 | # Expect JT_HOME to be set for jtreg tests. (home for jtreg) | 
|---|
| 355 | ifndef JT_HOME | 
|---|
| 356 | JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg | 
|---|
| 357 | ifdef JPRT_JTREG_HOME | 
|---|
| 358 | JT_HOME = $(JPRT_JTREG_HOME) | 
|---|
| 359 | endif | 
|---|
| 360 | endif | 
|---|
| 361 |  | 
|---|
| 362 | # Expect JPRT to set TESTDIRS to the jtreg test dirs | 
|---|
| 363 | ifndef TESTDIRS | 
|---|
| 364 | TESTDIRS = demo | 
|---|
| 365 | endif | 
|---|
| 366 |  | 
|---|
| 367 | # Samevm settings (default is false) | 
|---|
| 368 | ifndef USE_JTREG_SAMEVM | 
|---|
| 369 | USE_JTREG_SAMEVM=false | 
|---|
| 370 | endif | 
|---|
| 371 | # With samevm, you cannot use -javaoptions? | 
|---|
| 372 | ifeq ($(USE_JTREG_SAMEVM),true) | 
|---|
| 373 | EXTRA_JTREG_OPTIONS += -samevm $(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 | # Some tests annoy me and fail frequently | 
|---|
| 380 | PROBLEM_LIST=ProblemList.txt | 
|---|
| 381 | PROBLEM_LISTS=$(PROBLEM_LIST) | 
|---|
| 382 | EXCLUDELIST=$(ABS_TEST_OUTPUT_DIR)/excludelist.txt | 
|---|
| 383 |  | 
|---|
| 384 | # Create exclude list for this platform and arch | 
|---|
| 385 | ifdef NO_EXCLUDES | 
|---|
| 386 | $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) | 
|---|
| 387 | @$(ECHO) "NOTHING_EXCLUDED" > $@ | 
|---|
| 388 | else | 
|---|
| 389 | $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS) | 
|---|
| 390 | @$(RM) $@ $@.temp1 $@.temp2 | 
|---|
| 391 | @(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\ | 
|---|
| 392 | ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)'   ) ;\ | 
|---|
| 393 | ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\ | 
|---|
| 394 | ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\ | 
|---|
| 395 | ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-all'             ) ;\ | 
|---|
| 396 | ($(ECHO) "#") ;\ | 
|---|
| 397 | ) | $(SED) -e 's@^[\ ]*@@' \ | 
|---|
| 398 | | $(EGREP) -v '^#' > $@.temp1 | 
|---|
| 399 | @for tdir in $(TESTDIRS) ; do \ | 
|---|
| 400 | ( ( $(CAT) $@.temp1 | $(EGREP) "^$${tdir}" ) ; $(ECHO) "#" ) >> $@.temp2 ; \ | 
|---|
| 401 | done | 
|---|
| 402 | @$(ECHO) "# at least one line" >> $@.temp2 | 
|---|
| 403 | @( $(EGREP) -v '^#' $@.temp2 ; true ) > $@ | 
|---|
| 404 | @$(ECHO) "Excluding list contains `$(EXPAND) $@ | $(WC) -l` items" | 
|---|
| 405 | endif | 
|---|
| 406 |  | 
|---|
| 407 | # Select list of directories that exist | 
|---|
| 408 | define TestDirs | 
|---|
| 409 | $(foreach i,$1,$(wildcard ${i})) | 
|---|
| 410 | endef | 
|---|
| 411 | # Running batches of tests with or without samevm | 
|---|
| 412 | define RunSamevmBatch | 
|---|
| 413 | $(ECHO) "Running tests in samevm mode: $(call TestDirs, $?)" | 
|---|
| 414 | $(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=true  UNIQUE_DIR=$@ jtreg_tests | 
|---|
| 415 | endef | 
|---|
| 416 | define RunOthervmBatch | 
|---|
| 417 | $(ECHO) "Running tests in othervm mode: $(call TestDirs, $?)" | 
|---|
| 418 | $(MAKE) TESTDIRS="$(call TestDirs, $?)" USE_JTREG_SAMEVM=false UNIQUE_DIR=$@ jtreg_tests | 
|---|
| 419 | endef | 
|---|
| 420 | define SummaryInfo | 
|---|
| 421 | $(ECHO) "########################################################" | 
|---|
| 422 | $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME)) | 
|---|
| 423 | $(ECHO) "########################################################" | 
|---|
| 424 | endef | 
|---|
| 425 |  | 
|---|
| 426 | # ------------------------------------------------------------------ | 
|---|
| 427 |  | 
|---|
| 428 | # Batches of tests (somewhat arbitrary assigments to jdk_* targets) | 
|---|
| 429 | JDK_ALL_TARGETS = | 
|---|
| 430 |  | 
|---|
| 431 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 432 | #   Using samevm has problems, and doesn't help performance as much as others. | 
|---|
| 433 | JDK_ALL_TARGETS += jdk_awt | 
|---|
| 434 | jdk_awt: com/sun/awt java/awt sun/awt | 
|---|
| 435 | $(call RunOthervmBatch) | 
|---|
| 436 |  | 
|---|
| 437 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 438 | JDK_ALL_TARGETS += jdk_beans1 | 
|---|
| 439 | jdk_beans1: java/beans/beancontext java/beans/PropertyChangeSupport \ | 
|---|
| 440 | java/beans/Introspector java/beans/Performance \ | 
|---|
| 441 | java/beans/VetoableChangeSupport java/beans/Statement | 
|---|
| 442 | $(call RunSamevmBatch) | 
|---|
| 443 |  | 
|---|
| 444 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 445 | #   Using samevm has serious problems with these tests | 
|---|
| 446 | JDK_ALL_TARGETS += jdk_beans2 | 
|---|
| 447 | jdk_beans2: java/beans/Beans java/beans/EventHandler java/beans/XMLDecoder \ | 
|---|
| 448 | java/beans/PropertyEditor | 
|---|
| 449 | $(call RunOthervmBatch) | 
|---|
| 450 |  | 
|---|
| 451 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 452 | #   Using samevm has serious problems with these tests | 
|---|
| 453 | JDK_ALL_TARGETS += jdk_beans3 | 
|---|
| 454 | jdk_beans3: java/beans/XMLEncoder | 
|---|
| 455 | $(call RunOthervmBatch) | 
|---|
| 456 |  | 
|---|
| 457 | # All beans tests | 
|---|
| 458 | jdk_beans: jdk_beans1 jdk_beans2 jdk_beans3 | 
|---|
| 459 | @$(SummaryInfo) | 
|---|
| 460 |  | 
|---|
| 461 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 462 | JDK_ALL_TARGETS += jdk_io | 
|---|
| 463 | jdk_io: java/io | 
|---|
| 464 | $(call RunSamevmBatch) | 
|---|
| 465 |  | 
|---|
| 466 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 467 | JDK_ALL_TARGETS += jdk_lang | 
|---|
| 468 | jdk_lang: java/lang | 
|---|
| 469 | $(call RunSamevmBatch) | 
|---|
| 470 |  | 
|---|
| 471 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 472 | #   Using samevm has serious problems with these tests | 
|---|
| 473 | JDK_ALL_TARGETS += jdk_management1 | 
|---|
| 474 | jdk_management1: javax/management | 
|---|
| 475 | $(call RunOthervmBatch) | 
|---|
| 476 |  | 
|---|
| 477 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 478 | #   Using samevm has serious problems with these tests | 
|---|
| 479 | JDK_ALL_TARGETS += jdk_management2 | 
|---|
| 480 | jdk_management2: com/sun/jmx com/sun/management sun/management | 
|---|
| 481 | $(call RunOthervmBatch) | 
|---|
| 482 |  | 
|---|
| 483 | # All management tests | 
|---|
| 484 | jdk_management: jdk_management1 jdk_management2 | 
|---|
| 485 | @$(SummaryInfo) | 
|---|
| 486 |  | 
|---|
| 487 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 488 | JDK_ALL_TARGETS += jdk_math | 
|---|
| 489 | jdk_math: java/math | 
|---|
| 490 | $(call RunSamevmBatch) | 
|---|
| 491 |  | 
|---|
| 492 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 493 | JDK_ALL_TARGETS += jdk_misc | 
|---|
| 494 | jdk_misc: demo javax/imageio javax/naming javax/print javax/script \ | 
|---|
| 495 | javax/smartcardio javax/sound com/sun/java com/sun/jndi \ | 
|---|
| 496 | com/sun/org sun/misc sun/pisces | 
|---|
| 497 | $(call RunSamevmBatch) | 
|---|
| 498 |  | 
|---|
| 499 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 500 | JDK_ALL_TARGETS += jdk_net | 
|---|
| 501 | jdk_net: com/sun/net java/net sun/net | 
|---|
| 502 | $(call RunSamevmBatch) | 
|---|
| 503 |  | 
|---|
| 504 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 505 | #   Using samevm has serious problems with these tests | 
|---|
| 506 | JDK_ALL_TARGETS += jdk_nio | 
|---|
| 507 | jdk_nio: java/nio sun/nio | 
|---|
| 508 | $(call RunOthervmBatch) | 
|---|
| 509 |  | 
|---|
| 510 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 511 | #   Using samevm has serious problems with these tests | 
|---|
| 512 | JDK_ALL_TARGETS += jdk_rmi | 
|---|
| 513 | jdk_rmi: java/rmi javax/rmi sun/rmi | 
|---|
| 514 | $(call RunOthervmBatch) | 
|---|
| 515 |  | 
|---|
| 516 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 517 | JDK_ALL_TARGETS += jdk_security1 | 
|---|
| 518 | jdk_security1: java/security | 
|---|
| 519 | $(call RunSamevmBatch) | 
|---|
| 520 |  | 
|---|
| 521 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 522 | #   Using samevm has serious problems with these tests | 
|---|
| 523 | JDK_ALL_TARGETS += jdk_security2 | 
|---|
| 524 | jdk_security2: javax/crypto com/sun/crypto | 
|---|
| 525 | $(call RunOthervmBatch) | 
|---|
| 526 |  | 
|---|
| 527 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 528 | #   Using samevm has serious problems with these tests | 
|---|
| 529 | JDK_ALL_TARGETS += jdk_security3 | 
|---|
| 530 | jdk_security3: com/sun/security lib/security javax/security sun/security | 
|---|
| 531 | $(call RunOthervmBatch) | 
|---|
| 532 |  | 
|---|
| 533 | # All security tests | 
|---|
| 534 | jdk_security: jdk_security1 jdk_security2 jdk_security3 | 
|---|
| 535 | @$(SummaryInfo) | 
|---|
| 536 |  | 
|---|
| 537 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 538 | #   Using samevm has problems, and doesn't help performance as much as others. | 
|---|
| 539 | JDK_ALL_TARGETS += jdk_swing | 
|---|
| 540 | jdk_swing: javax/swing sun/java2d | 
|---|
| 541 | $(call RunOthervmBatch) | 
|---|
| 542 |  | 
|---|
| 543 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 544 | JDK_ALL_TARGETS += jdk_text | 
|---|
| 545 | jdk_text: java/text sun/text | 
|---|
| 546 | $(call RunSamevmBatch) | 
|---|
| 547 |  | 
|---|
| 548 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 549 | #   Using samevm has serious problems with these tests, but just with openjdk6? | 
|---|
| 550 | #   Normally the com/sun/jdi tests should work with samevm. | 
|---|
| 551 | #   But on openjdk6 jtreg will occasionally complain with: | 
|---|
| 552 | #     Error. Error while cleaning up threads after test | 
|---|
| 553 | #  This could be a hotspot vm issue. So someday, change this to Samevm. | 
|---|
| 554 | JDK_ALL_TARGETS += jdk_tools1 | 
|---|
| 555 | jdk_tools1: com/sun/jdi | 
|---|
| 556 | $(call RunOthevmBatch) | 
|---|
| 557 |  | 
|---|
| 558 | # Stable othervm testruns (minus items from PROBLEM_LIST) | 
|---|
| 559 | #   Using samevm has serious problems with these tests | 
|---|
| 560 | JDK_ALL_TARGETS += jdk_tools2 | 
|---|
| 561 | jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm | 
|---|
| 562 | $(call RunOthervmBatch) | 
|---|
| 563 |  | 
|---|
| 564 | # All tools tests | 
|---|
| 565 | jdk_tools: jdk_tools1 jdk_tools2 | 
|---|
| 566 | @$(SummaryInfo) | 
|---|
| 567 |  | 
|---|
| 568 | # Stable samevm testruns (minus items from PROBLEM_LIST) | 
|---|
| 569 | JDK_ALL_TARGETS += jdk_util | 
|---|
| 570 | jdk_util: java/util sun/util | 
|---|
| 571 | $(call RunSamevmBatch) | 
|---|
| 572 |  | 
|---|
| 573 | # ------------------------------------------------------------------ | 
|---|
| 574 |  | 
|---|
| 575 | # Run all tests | 
|---|
| 576 | FILTER_OUT_LIST=jdk_awt jdk_rmi jdk_swing | 
|---|
| 577 | JDK_ALL_STABLE_TARGETS := $(filter-out $(FILTER_OUT_LIST), $(JDK_ALL_TARGETS)) | 
|---|
| 578 | jdk_all: $(JDK_ALL_STABLE_TARGETS) | 
|---|
| 579 | @$(SummaryInfo) | 
|---|
| 580 |  | 
|---|
| 581 | # These are all phony targets | 
|---|
| 582 | PHONY_LIST += $(JDK_ALL_TARGETS) | 
|---|
| 583 |  | 
|---|
| 584 | # ------------------------------------------------------------------ | 
|---|
| 585 |  | 
|---|
| 586 | # Default JTREG to run (win32 script works for everybody) | 
|---|
| 587 | JTREG = $(JT_HOME)/win32/bin/jtreg | 
|---|
| 588 | # Add any extra options (samevm etc.) | 
|---|
| 589 | JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) | 
|---|
| 590 | # Only run automatic tests | 
|---|
| 591 | JTREG_BASIC_OPTIONS += -a | 
|---|
| 592 | # Report details on all failed or error tests, times too | 
|---|
| 593 | JTREG_BASIC_OPTIONS += -v:fail,error,time | 
|---|
| 594 | # Retain all files for failing tests | 
|---|
| 595 | JTREG_BASIC_OPTIONS += -retain:fail,error | 
|---|
| 596 | # Ignore tests are not run and completely silent about it | 
|---|
| 597 | JTREG_BASIC_OPTIONS += -ignore:quiet | 
|---|
| 598 | # Multiple by 4 the timeout numbers | 
|---|
| 599 | JTREG_BASIC_OPTIONS += -timeoutFactor:4 | 
|---|
| 600 | # Boost the max memory for jtreg to avoid gc thrashing | 
|---|
| 601 | JTREG_BASIC_OPTIONS += -J-Xmx512m | 
|---|
| 602 |  | 
|---|
| 603 | # Make sure jtreg exists | 
|---|
| 604 | $(JTREG): $(JT_HOME) | 
|---|
| 605 |  | 
|---|
| 606 | # Run jtreg | 
|---|
| 607 | jtreg_tests: prep $(PRODUCT_HOME) $(JTREG) $(EXCLUDELIST) | 
|---|
| 608 | @$(EXPAND) $(EXCLUDELIST) \ | 
|---|
| 609 | | $(CUT) -d' ' -f1 \ | 
|---|
| 610 | | $(SED) -e 's@^@Excluding: @' | 
|---|
| 611 | (                                                                    \ | 
|---|
| 612 | ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \ | 
|---|
| 613 | export JT_HOME;                                                  \ | 
|---|
| 614 | $(PREP_DISPLAY) &&                                               \ | 
|---|
| 615 | $(shell $(GETMIXEDPATH) "$(JTREG)")                              \ | 
|---|
| 616 | $(JTREG_BASIC_OPTIONS)                                         \ | 
|---|
| 617 | -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport  \ | 
|---|
| 618 | -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork    \ | 
|---|
| 619 | -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \ | 
|---|
| 620 | -exclude:$(shell $(GETMIXEDPATH) "$(EXCLUDELIST)")             \ | 
|---|
| 621 | $(JTREG_TEST_OPTIONS)                                          \ | 
|---|
| 622 | $(TESTDIRS)                                                    \ | 
|---|
| 623 | ) ; $(BUNDLE_UP_AND_EXIT)                                          \ | 
|---|
| 624 | ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT) | 
|---|
| 625 |  | 
|---|
| 626 | PHONY_LIST += jtreg_tests | 
|---|
| 627 |  | 
|---|
| 628 | ################################################################ | 
|---|
| 629 |  | 
|---|
| 630 | # Phony targets (e.g. these are not filenames) | 
|---|
| 631 | .PHONY: all clean prep $(PHONY_LIST) | 
|---|
| 632 |  | 
|---|
| 633 | ################################################################ | 
|---|
| 634 |  | 
|---|