Makefile 8.2 KB
Newer Older
D
duke 已提交
1
#
2
# Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
D
duke 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
# 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
# published by the Free Software Foundation.
#
# 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.
#
19 20 21
# 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.
22
#
D
duke 已提交
23 24 25
#

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

M
mgerdin 已提交
29 30
GETMIXEDPATH=echo

31
# Get OS/ARCH specifics
D
duke 已提交
32 33 34
OSNAME = $(shell uname -s)
ifeq ($(OSNAME), SunOS)
  PLATFORM = solaris
35
  SLASH_JAVA = /java
D
duke 已提交
36 37 38 39 40 41 42
  ARCH = $(shell uname -p)
  ifeq ($(ARCH), i386)
    ARCH=i586
  endif
endif
ifeq ($(OSNAME), Linux)
  PLATFORM = linux
43
  SLASH_JAVA = /java
D
duke 已提交
44 45
  ARCH = $(shell uname -m)
  ifeq ($(ARCH), i386)
46
    ARCH = i586
D
duke 已提交
47 48
  endif
endif
N
never 已提交
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
ifeq ($(OSNAME), Darwin)
  PLATFORM = bsd
  SLASH_JAVA = /java
  ARCH = $(shell uname -m)
  ifeq ($(ARCH), i386)
    ARCH = i586
  endif
endif
ifeq ($(findstring BSD,$(OSNAME)), BSD)
  PLATFORM = bsd
  SLASH_JAVA = /java
  ARCH = $(shell uname -m)
  ifeq ($(ARCH), i386)
    ARCH = i586
  endif
endif
M
mgerdin 已提交
65 66 67 68 69 70 71 72
ifeq ($(PLATFORM),)
  # detect wether we're running in MKS or cygwin
  ifeq ($(OSNAME), Windows_NT) # MKS
    GETMIXEDPATH=dosname -s
  endif
  ifeq ($(findstring CYGWIN,$(OSNAME)), CYGWIN)
    GETMIXEDPATH=cygpath -m -s
  endif
D
duke 已提交
73
  PLATFORM = windows
74
  SLASH_JAVA = J:
D
duke 已提交
75
  ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
76
    ARCH = ia64
D
duke 已提交
77 78
  else
    ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
79
      ARCH = x64
D
duke 已提交
80 81
    else
      ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
82
        ARCH = x64
D
duke 已提交
83
      else
84
        ARCH = i586
D
duke 已提交
85 86 87
      endif
    endif
  endif
88
  EXESUFFIX = .exe
D
duke 已提交
89 90
endif

91 92 93 94
ifdef ALT_SLASH_JAVA
  SLASH_JAVA = $(ALT_SLASH_JAVA)
endif

95 96 97 98 99 100
# Utilities used
CD    = cd
CP    = cp
ECHO  = echo
MKDIR = mkdir
ZIP   = zip
D
duke 已提交
101

102 103 104 105
# Root of this test area (important to use full paths in some places)
TEST_ROOT := $(shell pwd)

# Root of all test results
106 107 108 109 110
ifdef ALT_OUTPUTDIR
  ABS_BUILD_ROOT = $(ALT_OUTPUTDIR)/$(PLATFORM)-$(ARCH)
else
  ABS_BUILD_ROOT = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
endif
111 112 113 114 115 116 117 118 119 120 121 122 123
ABS_TEST_OUTPUT_DIR = $(ABS_BUILD_ROOT)/testoutput

# 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
  ABS_JDK_IMAGE = $(ABS_BUILD_ROOT)/j2sdk-image
  PRODUCT_HOME :=                       \
    $(shell                             \
      if [ -d $(ABS_JDK_IMAGE) ] ; then \
         $(ECHO) "$(ABS_JDK_IMAGE)";    \
       else                             \
         $(ECHO) "$(ABS_BUILD_ROOT)" ;  \
       fi)
D
duke 已提交
124 125
endif

126 127 128 129 130
# Expect JPRT to set JAVA_ARGS (e.g. -server etc.)
JAVA_OPTIONS = 
ifdef JAVA_ARGS
  JAVA_OPTIONS = $(JAVA_ARGS)
endif
D
duke 已提交
131

132 133 134 135 136
# 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
D
duke 已提交
137

138 139 140 141 142
# How to create the test bundle (pass or fail, we want to create this)
BUNDLE_UP = ( $(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`     \
	      && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
	      && $(ZIP) -q -r $(ARCHIVE_BUNDLE) . )
BUNDLE_UP_FAILED = ( exitCode=$$? && $(BUNDLE_UP) && exit $${exitCode} )
D
duke 已提交
143

144
################################################################
D
duke 已提交
145

146 147 148
# Default make rule (runs jtreg_tests)
all: jtreg_tests
	@$(ECHO) "Testing completed successfully"
D
duke 已提交
149

150 151 152 153
# Prep for output
prep: clean
	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
	@$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
D
duke 已提交
154 155 156

# Cleanup
clean:
157 158 159 160 161 162 163 164
	$(RM) -r $(ABS_TEST_OUTPUT_DIR)
	$(RM) $(ARCHIVE_BUNDLE)

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

# jtreg tests

# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
165 166 167
ifndef JT_HOME
  JT_HOME = $(SLASH_JAVA)/re/jtreg/4.0/promoted/latest/binaries/jtreg
endif
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
ifdef JPRT_JTREG_HOME
  JT_HOME = $(JPRT_JTREG_HOME)
endif

# Expect JPRT to set TESTDIRS to the jtreg test dirs
JTREG_TESTDIRS = demo/jvmti/gctest demo/jvmti/hprof
ifdef TESTDIRS
  JTREG_TESTDIRS = $(TESTDIRS)
endif

# Default JTREG to run (win32 script works for everybody)
JTREG = $(JT_HOME)/win32/bin/jtreg

# Option to tell jtreg to not run tests marked with "ignore"
ifeq ($(PLATFORM), windows)
  JTREG_KEY_OPTION = -k:!ignore
else
  JTREG_KEY_OPTION = -k:\!ignore
endif

#EXTRA_JTREG_OPTIONS =

jtreg_tests: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
	$(JTREG) -a -v:fail,error               \
          $(JTREG_KEY_OPTION)                   \
          $(EXTRA_JTREG_OPTIONS)                \
194 195 196
          -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport    \
          -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork      \
          -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                  \
197 198 199 200 201 202 203 204 205
          $(JAVA_OPTIONS:%=-vmoption:%)         \
          $(JTREG_TESTDIRS)                     \
	  || $(BUNDLE_UP_FAILED)
	$(BUNDLE_UP)

PHONY_LIST += jtreg_tests

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

206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230
# clienttest (make sure various basic java client options work)

clienttest: prep $(PRODUCT_HOME)
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
	$(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa
	$(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump

PHONY_LIST += clienttest

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

# servertest (make sure various basic java server options work)

servertest: prep $(PRODUCT_HOME)
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X

PHONY_LIST += servertest

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

231 232 233 234 235 236 237 238 239
# internalvmtests (run internal unit tests inside the VM)

internalvmtests: prep $(PRODUCT_HOME)
	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -XX:+ExecuteInternalVMTests -version

PHONY_LIST += internalvmtests

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

240 241 242 243 244 245
# wbapitest (make sure the whitebox testing api classes work

wbapitest: prep $(JT_HOME) $(PRODUCT_HOME) $(JTREG)
	$(JTREG) -a -v:fail,error               \
          $(JTREG_KEY_OPTION)                   \
          $(EXTRA_JTREG_OPTIONS)                \
M
mgerdin 已提交
246 247 248
          -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTreport    \
          -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)")/JTwork      \
          -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                  \
249
          $(JAVA_OPTIONS:%=-vmoption:%)         \
M
mgerdin 已提交
250
          $(shell $(GETMIXEDPATH) "$(TEST_ROOT)")/sanity                   \
251 252 253 254 255 256 257
	  || $(BUNDLE_UP_FAILED)
	$(BUNDLE_UP)

PHONY_LIST += wbapitest

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

258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
# 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

#EXTRA_PACKTEST_OPTIONS =

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_OPTIONS:%=-J %)        \
	 ) || $(BUNDLE_UP_FAILED)
	$(BUNDLE_UP)

packtest_stress: PACKTEST_STRESS_OPTION=-s
packtest_stress: packtest

PHONY_LIST += packtest packtest_stress

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

# Phony targets (e.g. these are not filenames)
.PHONY: all clean prep $(PHONY_LIST)
D
duke 已提交
288

289
################################################################
D
duke 已提交
290