annotate test/Makefile @ 0:a61af66fc99e

Initial load
author duke
date Sat, 01 Dec 2007 00:00:00 +0000
parents
children 68e0443dfd9c
rev   line source
duke@0 1 #
duke@0 2 # Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
duke@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0 4 #
duke@0 5 # This code is free software; you can redistribute it and/or modify it
duke@0 6 # under the terms of the GNU General Public License version 2 only, as
duke@0 7 # published by the Free Software Foundation.
duke@0 8 #
duke@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@0 12 # version 2 for more details (a copy is included in the LICENSE file that
duke@0 13 # accompanied this code).
duke@0 14 #
duke@0 15 # You should have received a copy of the GNU General Public License version
duke@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
duke@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0 18 #
duke@0 19 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@0 20 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@0 21 # have any questions.
duke@0 22 #
duke@0 23 #
duke@0 24
duke@0 25 #
duke@0 26 # Makefile to run jtreg
duke@0 27 #
duke@0 28
duke@0 29 OSNAME = $(shell uname -s)
duke@0 30 ifeq ($(OSNAME), SunOS)
duke@0 31 PLATFORM = solaris
duke@0 32 JCT_PLATFORM = solaris
duke@0 33 ARCH = $(shell uname -p)
duke@0 34 ifeq ($(ARCH), i386)
duke@0 35 ARCH=i586
duke@0 36 endif
duke@0 37 endif
duke@0 38 ifeq ($(OSNAME), Linux)
duke@0 39 PLATFORM = linux
duke@0 40 JCT_PLATFORM = linux
duke@0 41 ARCH = $(shell uname -m)
duke@0 42 ifeq ($(ARCH), i386)
duke@0 43 ARCH=i586
duke@0 44 endif
duke@0 45 endif
duke@0 46 ifeq ($(OSNAME), Windows_NT)
duke@0 47 PLATFORM = windows
duke@0 48 JCT_PLATFORM = win32
duke@0 49 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
duke@0 50 ARCH=ia64
duke@0 51 else
duke@0 52 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
duke@0 53 ARCH=x64
duke@0 54 else
duke@0 55 ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
duke@0 56 ARCH=x64
duke@0 57 else
duke@0 58 ARCH=i586
duke@0 59 endif
duke@0 60 endif
duke@0 61 endif
duke@0 62 endif
duke@0 63
duke@0 64 # Default bundle of all test results (passed or not)
duke@0 65 JPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
duke@0 66
duke@0 67 # Default home for JTREG
duke@0 68 ifeq ($(PLATFORM), windows)
duke@0 69 JT_HOME = J:/svc/jct-tools3.2.2_01
duke@0 70 else
duke@0 71 JT_HOME = /java/svc/jct-tools3.2.2_01
duke@0 72 endif
duke@0 73
duke@0 74 # Default JTREG to run
duke@0 75 JTREG = $(JT_HOME)/$(JCT_PLATFORM)/bin/jtreg
duke@0 76
duke@0 77 # Root of this test area
duke@0 78 TEST_ROOT := $(shell pwd)
duke@0 79
duke@0 80 # Default JDK to test
duke@0 81 JAVA_HOME = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
duke@0 82
duke@0 83 # The test directories to run
duke@0 84 DEFAULT_TESTDIRS = serviceability
duke@0 85 TESTDIRS = $(DEFAULT_TESTDIRS)
duke@0 86
duke@0 87 # Files that hold total passed and failed counts (passed==0 is bad)
duke@0 88 JTREG_TOTALS_DIR = $(TEST_ROOT)/JTREG_TOTALS_$(PLATFORM)_$(ARCH)
duke@0 89 JTREG_FAILED = $(JTREG_TOTALS_DIR)/failed_count
duke@0 90 JTREG_PASSED = $(JTREG_TOTALS_DIR)/passed_count
duke@0 91
duke@0 92 # Root of all test results
duke@0 93 JTREG_ALL_OUTPUT_DIRNAME = JTREG_OUTPUT_$(PLATFORM)_$(ARCH)
duke@0 94 JTREG_ALL_OUTPUT_DIR = $(TEST_ROOT)/$(JTREG_ALL_OUTPUT_DIRNAME)
duke@0 95
duke@0 96 # Test results for one test directory
duke@0 97 JTREG_TEST_OUTPUT_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@
duke@0 98 JTREG_TEST_REPORT_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTreport
duke@0 99 JTREG_TEST_WORK_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTwork
duke@0 100 JTREG_TEST_SUMMARY = $(JTREG_TEST_REPORT_DIR)/summary.txt
duke@0 101
duke@0 102 # Temp files used by this Makefile
duke@0 103 JTREG_TEST_TEMP_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@/temp
duke@0 104 JTREG_TEMP_PASSED = $(JTREG_TEST_TEMP_DIR)/passed
duke@0 105 JTREG_TEMP_FAILED = $(JTREG_TEST_TEMP_DIR)/failed
duke@0 106 JTREG_TEMP_OUTPUT = $(JTREG_TEST_TEMP_DIR)/output
duke@0 107 JTREG_TEMP_RESULTS = $(JTREG_TEST_TEMP_DIR)/results
duke@0 108
duke@0 109 # JTREG options (different for 2.1.6 and 3.2.2_01)
duke@0 110 JTREG_COMMON_OPTIONS = -r:$(JTREG_TEST_REPORT_DIR) \
duke@0 111 -w:$(JTREG_TEST_WORK_DIR) \
duke@0 112 -testjdk:$(JAVA_HOME) \
duke@0 113 -automatic \
duke@0 114 -verbose:all
duke@0 115 JTREG_216_OPTIONS = $(JTREG_COMMON_OPTIONS) $@ $(JAVA_ARGS)
duke@0 116 JTREG_322_OPTIONS = $(JTREG_COMMON_OPTIONS) $(JAVA_ARGS:%=-vmoption:%) $@
duke@0 117
duke@0 118 # Default make rule
duke@0 119 all: clean check tests
duke@0 120
duke@0 121 # Chaeck to make sure these directories exist
duke@0 122 check: $(JT_HOME) $(JAVA_HOME) $(JTREG)
duke@0 123
duke@0 124 # Prime the test run
duke@0 125 primecounts: FRC
duke@0 126 @rm -f -r $(JTREG_TOTALS_DIR)
duke@0 127 @mkdir -p $(JTREG_TOTALS_DIR)
duke@0 128 @echo "0" > $(JTREG_FAILED)
duke@0 129 @echo "0" > $(JTREG_PASSED)
duke@0 130
duke@0 131 # Run the tests and determine the 'make' command exit status
duke@0 132 # Ultimately we determine the make exit code based on the passed/failed count
duke@0 133 tests: primecounts $(TESTDIRS)
duke@0 134 @echo "JTREG TOTAL: passed=`cat $(JTREG_PASSED)` failed=`cat $(JTREG_FAILED)`"
duke@0 135 zip -q -r $(JPRT_ARCHIVE_BUNDLE) $(JTREG_ALL_OUTPUT_DIRNAME)
duke@0 136 @if [ `cat $(JTREG_FAILED)` -ne 0 -o \
duke@0 137 `cat $(JTREG_PASSED)` -le 0 ] ; then \
duke@0 138 echo "JTREG FAILED"; \
duke@0 139 exit 1; \
duke@0 140 else \
duke@0 141 echo "JTREG PASSED"; \
duke@0 142 exit 0; \
duke@0 143 fi
duke@0 144
duke@0 145 # Just make sure these directires exist
duke@0 146 $(JT_HOME) $(JAVA_HOME): FRC
duke@0 147 @if [ ! -d $@ ] ; then \
duke@0 148 echo "ERROR: Directory $@ does not exist"; \
duke@0 149 exit 1; \
duke@0 150 fi
duke@0 151
duke@0 152 # Make sure this file exists
duke@0 153 $(JTREG): FRC
duke@0 154 @if [ ! -f $@ ] ; then \
duke@0 155 echo "ERROR: File $@ does not exist"; \
duke@0 156 exit 1; \
duke@0 157 fi
duke@0 158
duke@0 159 # Process each test directory one by one, this rule always completes.
duke@0 160 # Note that the use of 'tee' tosses the jtreg process exit status, this
duke@0 161 # is as expected because even if jtreg fails, we need to save the
duke@0 162 # output. So we update the JTREG_PASSED and JTREG_FAILED count files.
duke@0 163 # Note that missing the 'results:' line in the last few lines of output
duke@0 164 # will indicate a failure (or a bump by one of the JTREG_FAILED file.
duke@0 165 # Note that passed: 0 or no passed: indication means a failure.
duke@0 166 # Note that any indication of the word 'failed' indicates failure.
duke@0 167 # Ultimately if the contents of JTREG_FAILED is not 0, we have failed
duke@0 168 # tests, and if the contents of JTREG_PASSED is 0, we consider that a
duke@0 169 # failure.
duke@0 170 $(TESTDIRS): FRC
duke@0 171 @if [ ! -d $@ ] ; then \
duke@0 172 echo "ERROR: Directory $@ does not exist"; \
duke@0 173 exit 1; \
duke@0 174 fi
duke@0 175 @echo "---------------------------------------------------"
duke@0 176 @rm -f -r $(JTREG_TEST_OUTPUT_DIR)
duke@0 177 @mkdir -p $(JTREG_TEST_OUTPUT_DIR)
duke@0 178 @mkdir -p $(JTREG_TEST_WORK_DIR)
duke@0 179 @mkdir -p $(JTREG_TEST_WORK_DIR)/scratch
duke@0 180 @mkdir -p $(JTREG_TEST_REPORT_DIR)
duke@0 181 @mkdir -p $(JTREG_TEST_TEMP_DIR)
duke@0 182 @echo "Testing $@"
duke@0 183 @echo "Using JAVA_HOME=$(JAVA_HOME)"
duke@0 184 @echo "Using JAVA_ARGS=$(JAVA_ARGS)"
duke@0 185 @if [ "`$(JTREG) -help 2>&1 | fgrep -- -vmoption`" != "" ] ; then \
duke@0 186 echo "Assume we are using jtreg 3.2.2_01 or newer"; \
duke@0 187 echo "$(JTREG) $(JTREG_322_OPTIONS)"; \
duke@0 188 $(JTREG) $(JTREG_322_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \
duke@0 189 else \
duke@0 190 echo "Assume we are using jtreg 2.1.6"; \
duke@0 191 echo "$(JTREG) $(JTREG_216_OPTIONS)"; \
duke@0 192 $(JTREG) $(JTREG_216_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \
duke@0 193 fi
duke@0 194 @echo "---------------------------------------------------"
duke@0 195 @echo "Extracting passed and failed counts from jtreg output"
duke@0 196 @tail -10 $(JTREG_TEMP_OUTPUT) | fgrep -i 'results:' | \
duke@0 197 tail -1 | tee $(JTREG_TEMP_RESULTS)
duke@0 198 @sed -e 's@.*\ passed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_RESULTS) \
duke@0 199 > $(JTREG_TEMP_PASSED)
duke@0 200 @if [ "`cat $(JTREG_TEMP_PASSED)`" = "" ] ; then \
duke@0 201 echo "ERROR: No passed indication in results"; \
duke@0 202 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
duke@0 203 elif [ `cat $(JTREG_TEMP_PASSED)` -le 0 ] ; then \
duke@0 204 echo "ERROR: Passed count appears to be 0"; \
duke@0 205 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
duke@0 206 elif [ "`fgrep -i failed $(JTREG_TEMP_RESULTS)`" = "" ] ; then \
duke@0 207 echo "No indication anything failed"; \
duke@0 208 expr `cat $(JTREG_PASSED)` '+' `cat $(JTREG_TEMP_PASSED)` \
duke@0 209 > $(JTREG_PASSED); \
duke@0 210 else \
duke@0 211 sed -e 's@.*\ failed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_FAILED) \
duke@0 212 > $(JTREG_TEMP_FAILED); \
duke@0 213 if [ "`cat $(JTREG_TEMP_FAILED)`" = "" ] ; then \
duke@0 214 echo "ERROR: Failed pattern but no failed count in results"; \
duke@0 215 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
duke@0 216 elif [ `cat $(JTREG_TEMP_FAILED)` -le 0 ] ; then \
duke@0 217 echo "ERROR: Failed count is 0, did something failed or not?"; \
duke@0 218 expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
duke@0 219 else \
duke@0 220 expr `cat $(JTREG_FAILED)` '+' `cat $(JTREG_TEMP_FAILED)` \
duke@0 221 > $(JTREG_FAILED); \
duke@0 222 fi; \
duke@0 223 fi
duke@0 224 @echo "---------------------------------------------------"
duke@0 225 @echo "Summary: "
duke@0 226 @if [ -f $(JTREG_TEST_SUMMARY) ] ; then \
duke@0 227 cat $(JTREG_TEST_SUMMARY) ; \
duke@0 228 else \
duke@0 229 echo "ERROR: Missing $(JTREG_TEST_SUMMARY)"; \
duke@0 230 fi
duke@0 231 @echo "---------------------------------------------------"
duke@0 232
duke@0 233 # Cleanup
duke@0 234 clean:
duke@0 235 rm -f -r $(JTREG_ALL_OUTPUT_DIR)
duke@0 236 rm -f $(JPRT_ARCHIVE_BUNDLE)
duke@0 237
duke@0 238 FRC:
duke@0 239