annotate test/Makefile @ 1103:de68e6f9139a

8050825: Support running regression tests using jtreg_tests+TESTDIRS from top level Reviewed-by: dholmes, mduigou
author mikael
date Tue, 15 Jul 2014 21:45:50 -0700
parents 2be489f272fc
children 75ad722b5f04
rev   line source
ohair@157 1 #
ohair@328 2 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
ohair@157 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ohair@157 4 #
ohair@157 5 # This code is free software; you can redistribute it and/or modify it
ohair@157 6 # under the terms of the GNU General Public License version 2 only, as
ohair@180 7 # published by the Free Software Foundation. Oracle designates this
ohair@157 8 # particular file as subject to the "Classpath" exception as provided
ohair@180 9 # by Oracle in the LICENSE file that accompanied this code.
ohair@157 10 #
ohair@157 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ohair@157 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ohair@157 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ohair@157 14 # version 2 for more details (a copy is included in the LICENSE file that
ohair@157 15 # accompanied this code).
ohair@157 16 #
ohair@157 17 # You should have received a copy of the GNU General Public License version
ohair@157 18 # 2 along with this work; if not, write to the Free Software Foundation,
ohair@157 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ohair@157 20 #
ohair@180 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@180 22 # or visit www.oracle.com if you need additional information or have any
ohair@180 23 # questions.
ohair@157 24 #
ohair@157 25
ohair@157 26 #
ohair@157 27 # Makefile to run tests from multiple sibling directories
ohair@157 28 #
ohair@157 29
ohair@157 30 # Root of the forest that was built
ohair@157 31 TOPDIR=..
ohair@157 32
ohair@157 33 # This makefile depends on the availability of sibling directories.
ohair@157 34 LANGTOOLS_DIR=$(TOPDIR)/langtools
ohair@157 35 JDK_DIR=$(TOPDIR)/jdk
mikael@1057 36 HOTSPOT_DIR=$(TOPDIR)/hotspot
ohair@157 37
ohair@157 38 # Macro to run a test target in a subdir
ohair@157 39 define SUBDIR_TEST # subdirectory target
ohair@157 40 if [ -d $1 ] ; then \
ohair@157 41 if [ -r $1/test/Makefile ] ; then \
mduigou@615 42 echo "$(MAKE) -k -C $1/test $2" ; \
mduigou@615 43 $(MAKE) -k -C $1/test $2 ; \
ohair@157 44 else \
ohair@157 45 echo "ERROR: File does not exist: $1/test/Makefile"; \
ohair@166 46 exit 1; \
ohair@157 47 fi; \
ohair@157 48 else \
ohair@157 49 echo "WARNING: No testing done, directory does not exist: $1"; \
ohair@157 50 fi
ohair@157 51 endef
ohair@157 52
mduigou@615 53 # Default test target (core)
mduigou@776 54 default: jdk_core langtools_jtreg
ohair@387 55
ohair@387 56 # All testing
mduigou@776 57 all: jdk_all langtools_all
ohair@157 58
ohair@157 59 # Test targets
mduigou@776 60 langtools_% :
mduigou@778 61 @$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
mduigou@615 62
alanb@911 63 jdk_% core_%s svc_%:
mduigou@776 64 @$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
ohair@157 65
mikael@1057 66 hotspot_%:
mikael@1057 67 @$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
mikael@1057 68
mikael@1103 69 #
mikael@1103 70 # jtreg_tests
mikael@1103 71 #
mikael@1103 72 # Invocation:
mikael@1103 73 #
mikael@1103 74 # make jtreg_tests TESTDIRS=<test-dirs>
mikael@1103 75 #
mikael@1103 76 # where <test-dirs> is something like '../<component>/test/runtime',
mikael@1103 77 # <component> in turn being one of the top level directories (for
mikael@1103 78 # example 'hotspot').
mikael@1103 79 #
mikael@1103 80 # The below will strip the path prefix and delegate to the
mikael@1103 81 # corresponding ../<component>/test/Makefile.
mikael@1103 82
mikael@1103 83 ifneq ($(TESTDIRS),)
mikael@1103 84 # Extract the component from ../<component>/...
mikael@1103 85 COMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
mikael@1103 86
mikael@1103 87 # Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
mikael@1103 88 # to the delegate Makefile
mikael@1103 89 TESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
mikael@1103 90 endif
mikael@1103 91
mikael@1103 92 jtreg_tests:
mikael@1103 93 @$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
mikael@1103 94
ohair@157 95 ################################################################
ohair@157 96
ohair@157 97 # Phony targets (e.g. these are not filenames)
mduigou@776 98 .PHONY: all clean
ohair@157 99
ohair@157 100 ################################################################