annotate test/Makefile @ 8875:ed979f9b40cd

8022212: Intermittent test failures in java/net Reviewed-by: chegar
author tyan
date Thu, 21 Nov 2013 13:42:54 +0000
parents b48eded97dff
children 4a9f1b1135cb
rev   line source
duke@0 1 #
mduigou@6850 2 # Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
ohair@1008 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@1008 4 #
ohair@1008 5 # This code is free software; you can redistribute it and/or modify it
ohair@1008 6 # under the terms of the GNU General Public License version 2 only, as
ohair@2362 7 # published by the Free Software Foundation. Oracle designates this
ohair@1008 8 # particular file as subject to the "Classpath" exception as provided
ohair@2362 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@1008 10 #
ohair@1008 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@1008 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@1008 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@1008 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@1008 15 # accompanied this code).
ohair@1008 16 #
ohair@1008 17 # You should have received a copy of the GNU General Public License version
ohair@1008 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@1008 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@1008 20 #
ohair@2362 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 22 # or visit www.oracle.com if you need additional information or have any
ohair@2362 23 # questions.
ohair@1008 24 #
ohair@1008 25
ohair@1008 26 #
ohair@1008 27 # Makefile to run various jdk tests
duke@0 28 #
duke@0 29
mduigou@8748 30 .DEFAULT : all
mduigou@8748 31
ohair@1821 32 # Empty these to get rid of some default rules
ohair@1821 33 .SUFFIXES:
ohair@1821 34 .SUFFIXES: .java
ohair@1821 35 CO=
ohair@1821 36 GET=
ohair@1821 37
ohair@1821 38 # Utilities used
ohair@1821 39 AWK = awk
ohair@1821 40 CAT = cat
ohair@1821 41 CD = cd
ohair@2391 42 CHMOD = chmod
ohair@1821 43 CP = cp
ohair@1821 44 CUT = cut
ohair@2391 45 DIRNAME = dirname
ohair@1821 46 ECHO = echo
ohair@1821 47 EGREP = egrep
ohair@1821 48 EXPAND = expand
ohair@2391 49 FIND = find
ohair@1821 50 MKDIR = mkdir
ohair@1821 51 PWD = pwd
ohair@1821 52 SED = sed
ohair@1821 53 SORT = sort
ohair@1821 54 TEE = tee
ohair@1821 55 UNAME = uname
ohair@1821 56 UNIQ = uniq
ohair@1821 57 WC = wc
ohair@1821 58 ZIP = zip
ohair@1821 59
mduigou@8748 60 # Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
mduigou@8748 61 UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
ohair@1008 62
ohair@1008 63 # Commands to run on paths to make mixed paths for java on windows
mduigou@8748 64 ifeq ($(UNAME_S), CYGWIN)
mduigou@8748 65 # Location of developer shared files
mduigou@8748 66 SLASH_JAVA = J:
chegar@8776 67 GETMIXEDPATH = cygpath -m
mduigou@8748 68 else
mduigou@8748 69 # Location of developer shared files
mduigou@8748 70 SLASH_JAVA = /java
ohair@1008 71
mduigou@8748 72 GETMIXEDPATH=$(ECHO)
ohair@2228 73 endif
ohair@2228 74
duke@0 75 # Root of this test area (important to use full paths in some places)
ohair@1821 76 TEST_ROOT := $(shell $(PWD))
duke@0 77
ohair@1008 78 # Root of all test results
ohair@1008 79 ifdef ALT_OUTPUTDIR
mduigou@8748 80 ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
ohair@1008 81 else
mduigou@8748 82 ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
ohair@1008 83 endif
mduigou@8748 84
ohair@2228 85 ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
ohair@2228 86 ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
duke@0 87
ohair@1008 88 # Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
ohair@1008 89 ifndef PRODUCT_HOME
ohair@1008 90 # Try to use j2sdk-image if it exists
mduigou@8748 91 ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/j2sdk-image
ohair@2228 92 PRODUCT_HOME := \
ohair@2228 93 $(shell \
ohair@2228 94 if [ -d $(ABS_JDK_IMAGE) ] ; then \
ohair@2228 95 $(ECHO) "$(ABS_JDK_IMAGE)"; \
ohair@2228 96 else \
ohair@2228 97 $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)"; \
ohair@1008 98 fi)
ohair@1008 99 PRODUCT_HOME := $(PRODUCT_HOME)
duke@0 100 endif
duke@0 101
ohair@1008 102 # Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
ohair@1008 103 # Should be passed into 'java' only.
ohair@1821 104 # Could include: -d64 -server -client OR any java option
ohair@1008 105 ifdef JPRT_PRODUCT_ARGS
ohair@1008 106 JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
ohair@1008 107 endif
duke@0 108
ohair@1008 109 # Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
ohair@1008 110 # Should be passed into anything running the vm (java, javac, javadoc, ...).
ohair@1008 111 ifdef JPRT_PRODUCT_VM_ARGS
ohair@1008 112 JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
ohair@1008 113 endif
duke@0 114
ohair@1008 115 # Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
ohair@1008 116 ifdef JPRT_ARCHIVE_BUNDLE
ohair@1008 117 ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
mduigou@8748 118 else
mduigou@8748 119 ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
ohair@1008 120 endif
duke@0 121
ohair@1008 122 # How to create the test bundle (pass or fail, we want to create this)
ohair@1008 123 # Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
ohair@2391 124 ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)` \
ohair@1008 125 && $(CD) $(ABS_TEST_OUTPUT_DIR) \
ohair@3866 126 && $(CHMOD) -R a+r . \
ohair@1008 127 && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
mduigou@8748 128
mduigou@8748 129 # important results files
mduigou@8748 130 SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
ohair@1821 131 STATS_TXT_NAME = Stats.txt
mduigou@8748 132 STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
mduigou@8748 133 RUNLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
mduigou@8748 134 PASSLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
mduigou@8748 135 FAILLIST = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
mduigou@8748 136 EXITCODE = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
ohair@1947 137
ohair@1947 138 TESTEXIT = \
ohair@1947 139 if [ ! -s $(EXITCODE) ] ; then \
ohair@1947 140 $(ECHO) "ERROR: EXITCODE file not filled in."; \
ohair@1947 141 $(ECHO) "1" > $(EXITCODE); \
ohair@1947 142 fi ; \
ohair@1947 143 testExitCode=`$(CAT) $(EXITCODE)`; \
ohair@1947 144 $(ECHO) "EXIT CODE: $${testExitCode}"; \
ohair@2017 145 exit $${testExitCode}
ohair@1947 146
ohair@1821 147 BUNDLE_UP_AND_EXIT = \
ohair@1821 148 ( \
ohair@1947 149 jtregExitCode=$$? && \
ohair@1821 150 _summary="$(SUMMARY_TXT)"; \
ohair@1947 151 $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
ohair@1947 152 $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
ohair@1821 153 if [ -r "$${_summary}" ] ; then \
ohair@2017 154 $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
ohair@1821 155 $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
ohair@1821 156 $(EGREP) ' Passed\.' $(RUNLIST) \
ohair@1821 157 | $(EGREP) -v ' Error\.' \
ohair@1821 158 | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
ohair@1821 159 ( $(EGREP) ' Failed\.' $(RUNLIST); \
ohair@1821 160 $(EGREP) ' Error\.' $(RUNLIST); \
ohair@1821 161 $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
ohair@1821 162 | $(SORT) | $(UNIQ) > $(FAILLIST); \
ohair@1947 163 if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
ohair@1821 164 $(EXPAND) $(FAILLIST) \
ohair@1821 165 | $(CUT) -d' ' -f1 \
ohair@1821 166 | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
ohair@1947 167 if [ $${jtregExitCode} = 0 ] ; then \
ohair@1947 168 jtregExitCode=1; \
ohair@1947 169 fi; \
ohair@1821 170 fi; \
ohair@1821 171 runc="`$(CAT) $(RUNLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ohair@1821 172 passc="`$(CAT) $(PASSLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
ohair@1821 173 failc="`$(CAT) $(FAILLIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
mduigou@8748 174 exclc="FIXME CODETOOLS-7900176"; \
mduigou@8748 175 $(ECHO) "TEST STATS: name=$(UNIQUE_DIR) run=$${runc} pass=$${passc} fail=$${failc}" \
ohair@1821 176 >> $(STATS_TXT); \
ohair@1821 177 else \
ohair@1821 178 $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
ohair@1821 179 fi; \
ohair@3866 180 if [ -f $(STATS_TXT) ] ; then \
ohair@3866 181 $(CAT) $(STATS_TXT); \
ohair@3866 182 fi; \
ohair@2203 183 $(ZIP_UP_RESULTS) ; \
ohair@1947 184 $(TESTEXIT) \
ohair@1821 185 )
duke@0 186
ohair@1008 187 ################################################################
duke@0 188
ohair@4855 189 # Default make rule (runs default jdk tests)
ohair@4855 190 all: jdk_default
ohair@1008 191 @$(ECHO) "Testing completed successfully"
duke@0 192
ohair@1008 193 # Prep for output
mduigou@8748 194 # Change execute permissions on shared library files.
mduigou@8748 195 # Files in repositories should never have execute permissions, but
mduigou@8748 196 # there are some tests that have pre-built shared libraries, and these
mduigou@8748 197 # windows dll files must have execute permission. Adding execute
mduigou@8748 198 # permission may happen automatically on windows when using certain
mduigou@8748 199 # versions of mercurial but it cannot be guaranteed. And blindly
mduigou@8748 200 # adding execute permission might be seen as a mercurial 'change', so
mduigou@8748 201 # we avoid adding execute permission to repository files. But testing
mduigou@8748 202 # from a plain source tree needs the chmod a+rx. Applying the chmod to
mduigou@8748 203 # all shared libraries not just dll files. And with CYGWIN and sshd
mduigou@8748 204 # service, you may need CYGWIN=ntsec for this to work.
mduigou@6848 205 prep:
ohair@1008 206 @$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
ohair@2500 207 @$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
mduigou@8748 208 @if [ ! -d $(TEST_ROOT)/../.hg ] ; then \
mduigou@8748 209 $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \) \
mduigou@8748 210 -exec $(CHMOD) a+rx {} \; ; \
mduigou@8748 211 fi
duke@0 212
duke@0 213 # Cleanup
duke@0 214 clean:
mduigou@6546 215 @$(RM) -r $(ABS_TEST_OUTPUT_DIR)
mduigou@6546 216 @$(RM) $(ARCHIVE_BUNDLE)
duke@0 217
ohair@1008 218 ################################################################
ohair@1008 219
ohair@1008 220 # jtreg tests
ohair@1008 221
ohair@1008 222 # Expect JT_HOME to be set for jtreg tests. (home for jtreg)
ohair@1934 223 ifndef JT_HOME
weijun@4600 224 JT_HOME = $(SLASH_JAVA)/re/jtreg/4.1/promoted/latest/binaries/jtreg
ohair@1934 225 ifdef JPRT_JTREG_HOME
ohair@1934 226 JT_HOME = $(JPRT_JTREG_HOME)
ohair@1934 227 endif
ohair@1008 228 endif
ohair@1008 229
mduigou@8748 230 # Problematic tests to be excluded
mduigou@8748 231 PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt closed/ProblemList.txt))
ohair@1821 232
ohair@1821 233 # Create exclude list for this platform and arch
ohair@1821 234 ifdef NO_EXCLUDES
mduigou@8748 235 JTREG_EXCLUSIONS =
ohair@1821 236 else
mduigou@8748 237 JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
ohair@1821 238 endif
ohair@1821 239
mduigou@8748 240 # convert list of directories to dos paths
mduigou@8748 241 define MixedDirs
mduigou@8748 242 $(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
ohair@1934 243 endef
mduigou@8748 244
ohair@1821 245 define SummaryInfo
ohair@2017 246 $(ECHO) "########################################################"
ohair@1821 247 $(CAT) $(?:%=$(ABS_TEST_OUTPUT_DIR)/%/$(STATS_TXT_NAME))
ohair@2017 248 $(ECHO) "########################################################"
ohair@1821 249 endef
ohair@1821 250
ohair@1821 251 # ------------------------------------------------------------------
ohair@1821 252
alanb@8849 253 jdk_% core_% svc_%:
mduigou@8748 254 $(ECHO) "Running tests: $@"
mduigou@8748 255 for each in $@; do \
mduigou@8748 256 $(MAKE) -j 1 TEST_SELECTION=":$$each" UNIQUE_DIR=$$each jtreg_tests; \
mduigou@8748 257 done
ohair@1821 258
ohair@1821 259 # ------------------------------------------------------------------
ohair@1821 260
mduigou@7749 261 ifdef CONCURRENCY
mduigou@7749 262 EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
mduigou@7749 263 endif
mduigou@7749 264
ohair@1008 265 # Default JTREG to run (win32 script works for everybody)
ohair@1008 266 JTREG = $(JT_HOME)/win32/bin/jtreg
mduigou@7749 267 # run in agentvm mode
mduigou@7749 268 JTREG_BASIC_OPTIONS += -agentvm
ohair@1821 269 # Only run automatic tests
ohair@1821 270 JTREG_BASIC_OPTIONS += -a
ohair@2020 271 # Always turn on assertions
ohair@2020 272 JTREG_ASSERT_OPTION = -ea -esa
ohair@2020 273 JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
ohair@1821 274 # Report details on all failed or error tests, times too
ohair@1821 275 JTREG_BASIC_OPTIONS += -v:fail,error,time
ohair@1821 276 # Retain all files for failing tests
ohair@1821 277 JTREG_BASIC_OPTIONS += -retain:fail,error
ohair@1821 278 # Ignore tests are not run and completely silent about it
ohair@2020 279 JTREG_IGNORE_OPTION = -ignore:quiet
ohair@2020 280 JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
ohair@2017 281 # Multiple by 4 the timeout numbers
ohair@2020 282 JTREG_TIMEOUT_OPTION = -timeoutFactor:4
ohair@2020 283 JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
mduigou@7210 284 # Set the max memory for jtreg control vm
ohair@2020 285 JTREG_MEMORY_OPTION = -J-Xmx512m
ohair@2020 286 JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
mduigou@7749 287 # Add any extra options
mduigou@7749 288 JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
mduigou@7749 289 # Set other vm and test options
mduigou@7749 290 JTREG_TEST_OPTIONS = $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
mduigou@7749 291 # Set the GC options for test vms
mduigou@7749 292 #JTREG_GC_OPTION = -vmoption:-XX:+UseSerialGC
mduigou@7749 293 #JTREG_TEST_OPTIONS += $(JTREG_GC_OPTION)
mduigou@7210 294 # Set the max memory for jtreg target test vms
mduigou@7210 295 JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
mduigou@7210 296 JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
ohair@1008 297
ohair@1821 298 # Make sure jtreg exists
ohair@1821 299 $(JTREG): $(JT_HOME)
ohair@1821 300
ohair@1821 301 # Run jtreg
mduigou@8748 302 jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
ohair@1821 303 ( \
ohair@1821 304 ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)"); \
ohair@1821 305 export JT_HOME; \
ohair@1821 306 $(shell $(GETMIXEDPATH) "$(JTREG)") \
ohair@1821 307 $(JTREG_BASIC_OPTIONS) \
mduigou@8748 308 -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport") \
mduigou@8748 309 -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork") \
ohair@1821 310 -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)") \
mduigou@8748 311 $(JTREG_EXCLUSIONS) \
ohair@1821 312 $(JTREG_TEST_OPTIONS) \
mduigou@8748 313 $(TEST_SELECTION) \
mduigou@8748 314 ) ; \
mduigou@8748 315 $(BUNDLE_UP_AND_EXIT) \
ohair@1947 316 ) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
ohair@1008 317
mduigou@8748 318 PHONY_LIST += jtreg_tests
ohair@1008 319
ohair@1008 320 ################################################################
ohair@1008 321
duke@0 322 # Phony targets (e.g. these are not filenames)
ohair@1008 323 .PHONY: all clean prep $(PHONY_LIST)
duke@0 324
ohair@1008 325 ################################################################