Makefile revision 0
0N/A#
0N/A# Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
0N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A#
0N/A# This code is free software; you can redistribute it and/or modify it
0N/A# under the terms of the GNU General Public License version 2 only, as
0N/A# published by the Free Software Foundation.
0N/A#
0N/A# This code is distributed in the hope that it will be useful, but WITHOUT
0N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A# version 2 for more details (a copy is included in the LICENSE file that
0N/A# accompanied this code).
0N/A#
0N/A# You should have received a copy of the GNU General Public License version
0N/A# 2 along with this work; if not, write to the Free Software Foundation,
0N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A#
0N/A# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
0N/A# CA 95054 USA or visit www.sun.com if you need additional information or
0N/A# have any questions.
0N/A#
0N/A#
0N/A
0N/A#
0N/A# Makefile to run jtreg
0N/A#
0N/A
0N/AOSNAME = $(shell uname -s)
0N/Aifeq ($(OSNAME), SunOS)
0N/A PLATFORM = solaris
0N/A JCT_PLATFORM = solaris
0N/A ARCH = $(shell uname -p)
0N/A ifeq ($(ARCH), i386)
0N/A ARCH=i586
0N/A endif
0N/Aendif
0N/Aifeq ($(OSNAME), Linux)
0N/A PLATFORM = linux
0N/A JCT_PLATFORM = linux
0N/A ARCH = $(shell uname -m)
0N/A ifeq ($(ARCH), i386)
0N/A ARCH=i586
0N/A endif
0N/Aendif
0N/Aifeq ($(OSNAME), Windows_NT)
0N/A PLATFORM = windows
0N/A JCT_PLATFORM = win32
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),ia64)
0N/A ARCH=ia64
0N/A else
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),AMD64)
0N/A ARCH=x64
0N/A else
0N/A ifeq ($(word 1, $(PROCESSOR_IDENTIFIER)),EM64T)
0N/A ARCH=x64
0N/A else
0N/A ARCH=i586
0N/A endif
0N/A endif
0N/A endif
0N/Aendif
0N/A
0N/A# Default bundle of all test results (passed or not)
0N/AJPRT_ARCHIVE_BUNDLE=$(TEST_ROOT)/JPRT_ARCHIVE_BUNDLE.zip
0N/A
0N/A# Default home for JTREG
0N/Aifeq ($(PLATFORM), windows)
0N/A JT_HOME = J:/svc/jct-tools3.2.2_01
0N/Aelse
0N/A JT_HOME = /java/svc/jct-tools3.2.2_01
0N/Aendif
0N/A
0N/A# Default JTREG to run
0N/AJTREG = $(JT_HOME)/$(JCT_PLATFORM)/bin/jtreg
0N/A
0N/A# Root of this test area
0N/ATEST_ROOT := $(shell pwd)
0N/A
0N/A# Default JDK to test
0N/AJAVA_HOME = $(TEST_ROOT)/../build/$(PLATFORM)-$(ARCH)
0N/A
0N/A# The test directories to run
0N/ADEFAULT_TESTDIRS = serviceability
0N/ATESTDIRS = $(DEFAULT_TESTDIRS)
0N/A
0N/A# Files that hold total passed and failed counts (passed==0 is bad)
0N/AJTREG_TOTALS_DIR = $(TEST_ROOT)/JTREG_TOTALS_$(PLATFORM)_$(ARCH)
0N/AJTREG_FAILED = $(JTREG_TOTALS_DIR)/failed_count
0N/AJTREG_PASSED = $(JTREG_TOTALS_DIR)/passed_count
0N/A
0N/A# Root of all test results
0N/AJTREG_ALL_OUTPUT_DIRNAME = JTREG_OUTPUT_$(PLATFORM)_$(ARCH)
0N/AJTREG_ALL_OUTPUT_DIR = $(TEST_ROOT)/$(JTREG_ALL_OUTPUT_DIRNAME)
0N/A
0N/A# Test results for one test directory
0N/AJTREG_TEST_OUTPUT_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@
0N/AJTREG_TEST_REPORT_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTreport
0N/AJTREG_TEST_WORK_DIR = $(JTREG_TEST_OUTPUT_DIR)/JTwork
0N/AJTREG_TEST_SUMMARY = $(JTREG_TEST_REPORT_DIR)/summary.txt
0N/A
0N/A# Temp files used by this Makefile
0N/AJTREG_TEST_TEMP_DIR = $(JTREG_ALL_OUTPUT_DIR)/$@/temp
0N/AJTREG_TEMP_PASSED = $(JTREG_TEST_TEMP_DIR)/passed
0N/AJTREG_TEMP_FAILED = $(JTREG_TEST_TEMP_DIR)/failed
0N/AJTREG_TEMP_OUTPUT = $(JTREG_TEST_TEMP_DIR)/output
0N/AJTREG_TEMP_RESULTS = $(JTREG_TEST_TEMP_DIR)/results
0N/A
0N/A# JTREG options (different for 2.1.6 and 3.2.2_01)
0N/AJTREG_COMMON_OPTIONS = -r:$(JTREG_TEST_REPORT_DIR) \
0N/A -w:$(JTREG_TEST_WORK_DIR) \
0N/A -testjdk:$(JAVA_HOME) \
0N/A -automatic \
0N/A -verbose:all
0N/AJTREG_216_OPTIONS = $(JTREG_COMMON_OPTIONS) $@ $(JAVA_ARGS)
0N/AJTREG_322_OPTIONS = $(JTREG_COMMON_OPTIONS) $(JAVA_ARGS:%=-vmoption:%) $@
0N/A
0N/A# Default make rule
0N/Aall: clean check tests
0N/A
0N/A# Chaeck to make sure these directories exist
0N/Acheck: $(JT_HOME) $(JAVA_HOME) $(JTREG)
0N/A
0N/A# Prime the test run
0N/Aprimecounts: FRC
0N/A @rm -f -r $(JTREG_TOTALS_DIR)
0N/A @mkdir -p $(JTREG_TOTALS_DIR)
0N/A @echo "0" > $(JTREG_FAILED)
0N/A @echo "0" > $(JTREG_PASSED)
0N/A
0N/A# Run the tests and determine the 'make' command exit status
0N/A# Ultimately we determine the make exit code based on the passed/failed count
0N/Atests: primecounts $(TESTDIRS)
0N/A @echo "JTREG TOTAL: passed=`cat $(JTREG_PASSED)` failed=`cat $(JTREG_FAILED)`"
0N/A zip -q -r $(JPRT_ARCHIVE_BUNDLE) $(JTREG_ALL_OUTPUT_DIRNAME)
0N/A @if [ `cat $(JTREG_FAILED)` -ne 0 -o \
0N/A `cat $(JTREG_PASSED)` -le 0 ] ; then \
0N/A echo "JTREG FAILED"; \
0N/A exit 1; \
0N/A else \
0N/A echo "JTREG PASSED"; \
0N/A exit 0; \
0N/A fi
0N/A
0N/A# Just make sure these directires exist
0N/A$(JT_HOME) $(JAVA_HOME): FRC
0N/A @if [ ! -d $@ ] ; then \
0N/A echo "ERROR: Directory $@ does not exist"; \
0N/A exit 1; \
0N/A fi
0N/A
0N/A# Make sure this file exists
0N/A$(JTREG): FRC
0N/A @if [ ! -f $@ ] ; then \
0N/A echo "ERROR: File $@ does not exist"; \
0N/A exit 1; \
0N/A fi
0N/A
0N/A# Process each test directory one by one, this rule always completes.
0N/A# Note that the use of 'tee' tosses the jtreg process exit status, this
0N/A# is as expected because even if jtreg fails, we need to save the
0N/A# output. So we update the JTREG_PASSED and JTREG_FAILED count files.
0N/A# Note that missing the 'results:' line in the last few lines of output
0N/A# will indicate a failure (or a bump by one of the JTREG_FAILED file.
0N/A# Note that passed: 0 or no passed: indication means a failure.
0N/A# Note that any indication of the word 'failed' indicates failure.
0N/A# Ultimately if the contents of JTREG_FAILED is not 0, we have failed
0N/A# tests, and if the contents of JTREG_PASSED is 0, we consider that a
0N/A# failure.
0N/A$(TESTDIRS): FRC
0N/A @if [ ! -d $@ ] ; then \
0N/A echo "ERROR: Directory $@ does not exist"; \
0N/A exit 1; \
0N/A fi
0N/A @echo "---------------------------------------------------"
0N/A @rm -f -r $(JTREG_TEST_OUTPUT_DIR)
0N/A @mkdir -p $(JTREG_TEST_OUTPUT_DIR)
0N/A @mkdir -p $(JTREG_TEST_WORK_DIR)
0N/A @mkdir -p $(JTREG_TEST_WORK_DIR)/scratch
0N/A @mkdir -p $(JTREG_TEST_REPORT_DIR)
0N/A @mkdir -p $(JTREG_TEST_TEMP_DIR)
0N/A @echo "Testing $@"
0N/A @echo "Using JAVA_HOME=$(JAVA_HOME)"
0N/A @echo "Using JAVA_ARGS=$(JAVA_ARGS)"
0N/A @if [ "`$(JTREG) -help 2>&1 | fgrep -- -vmoption`" != "" ] ; then \
0N/A echo "Assume we are using jtreg 3.2.2_01 or newer"; \
0N/A echo "$(JTREG) $(JTREG_322_OPTIONS)"; \
0N/A $(JTREG) $(JTREG_322_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \
0N/A else \
0N/A echo "Assume we are using jtreg 2.1.6"; \
0N/A echo "$(JTREG) $(JTREG_216_OPTIONS)"; \
0N/A $(JTREG) $(JTREG_216_OPTIONS) 2>&1 | tee $(JTREG_TEMP_OUTPUT) ; \
0N/A fi
0N/A @echo "---------------------------------------------------"
0N/A @echo "Extracting passed and failed counts from jtreg output"
0N/A @tail -10 $(JTREG_TEMP_OUTPUT) | fgrep -i 'results:' | \
0N/A tail -1 | tee $(JTREG_TEMP_RESULTS)
0N/A @sed -e 's@.*\ passed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_RESULTS) \
0N/A > $(JTREG_TEMP_PASSED)
0N/A @if [ "`cat $(JTREG_TEMP_PASSED)`" = "" ] ; then \
0N/A echo "ERROR: No passed indication in results"; \
0N/A expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
0N/A elif [ `cat $(JTREG_TEMP_PASSED)` -le 0 ] ; then \
0N/A echo "ERROR: Passed count appears to be 0"; \
0N/A expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
0N/A elif [ "`fgrep -i failed $(JTREG_TEMP_RESULTS)`" = "" ] ; then \
0N/A echo "No indication anything failed"; \
0N/A expr `cat $(JTREG_PASSED)` '+' `cat $(JTREG_TEMP_PASSED)` \
0N/A > $(JTREG_PASSED); \
0N/A else \
0N/A sed -e 's@.*\ failed:\ \([1-9][0-9]*\).*@\1@' $(JTREG_TEMP_FAILED) \
0N/A > $(JTREG_TEMP_FAILED); \
0N/A if [ "`cat $(JTREG_TEMP_FAILED)`" = "" ] ; then \
0N/A echo "ERROR: Failed pattern but no failed count in results"; \
0N/A expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
0N/A elif [ `cat $(JTREG_TEMP_FAILED)` -le 0 ] ; then \
0N/A echo "ERROR: Failed count is 0, did something failed or not?"; \
0N/A expr `cat $(JTREG_FAILED)` '+' 1 > $(JTREG_FAILED); \
0N/A else \
0N/A expr `cat $(JTREG_FAILED)` '+' `cat $(JTREG_TEMP_FAILED)` \
0N/A > $(JTREG_FAILED); \
0N/A fi; \
0N/A fi
0N/A @echo "---------------------------------------------------"
0N/A @echo "Summary: "
0N/A @if [ -f $(JTREG_TEST_SUMMARY) ] ; then \
0N/A cat $(JTREG_TEST_SUMMARY) ; \
0N/A else \
0N/A echo "ERROR: Missing $(JTREG_TEST_SUMMARY)"; \
0N/A fi
0N/A @echo "---------------------------------------------------"
0N/A
0N/A# Cleanup
0N/Aclean:
0N/A rm -f -r $(JTREG_ALL_OUTPUT_DIR)
0N/A rm -f $(JPRT_ARCHIVE_BUNDLE)
0N/A
0N/AFRC:
0N/A