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