Makefile revision 1103:de68e6f9139a
1112918Sjeff#
2112918Sjeff# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3112918Sjeff# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4112918Sjeff#
5112918Sjeff# This code is free software; you can redistribute it and/or modify it
6112918Sjeff# under the terms of the GNU General Public License version 2 only, as
7112918Sjeff# published by the Free Software Foundation.  Oracle designates this
8112918Sjeff# particular file as subject to the "Classpath" exception as provided
9112918Sjeff# by Oracle in the LICENSE file that accompanied this code.
10112918Sjeff#
11112918Sjeff# This code is distributed in the hope that it will be useful, but WITHOUT
12112918Sjeff# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13165967Simp# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14112918Sjeff# version 2 for more details (a copy is included in the LICENSE file that
15112918Sjeff# accompanied this code).
16112918Sjeff#
17112918Sjeff# You should have received a copy of the GNU General Public License version
18112918Sjeff# 2 along with this work; if not, write to the Free Software Foundation,
19112918Sjeff# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20112918Sjeff#
21112918Sjeff# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22112918Sjeff# or visit www.oracle.com if you need additional information or have any
23112918Sjeff# questions.
24112918Sjeff#
25112918Sjeff
26112918Sjeff#
27112918Sjeff# Makefile to run tests from multiple sibling directories
28112918Sjeff#
29112918Sjeff
30112918Sjeff# Root of the forest that was built
31144518SdavidxuTOPDIR=..
32177605Sru
33112918Sjeff# This makefile depends on the availability of sibling directories.
34212630SdavidxuLANGTOOLS_DIR=$(TOPDIR)/langtools
35212630SdavidxuJDK_DIR=$(TOPDIR)/jdk
36212630SdavidxuHOTSPOT_DIR=$(TOPDIR)/hotspot
37112918Sjeff
38112918Sjeff# Macro to run a test target in a subdir
39112918Sjeffdefine SUBDIR_TEST # subdirectory target
40212076Sdavidxuif [ -d $1 ] ; then \
41212076Sdavidxu  if [ -r $1/test/Makefile ] ; then \
42177605Sru    echo "$(MAKE) -k -C $1/test $2" ; \
43144518Sdavidxu    $(MAKE) -k -C $1/test $2 ; \
44182225Sjasone  else \
45112918Sjeff    echo "ERROR: File does not exist: $1/test/Makefile"; \
46112918Sjeff    exit 1; \
47144518Sdavidxu  fi; \
48144518Sdavidxuelse \
49212630Sdavidxu  echo "WARNING: No testing done, directory does not exist: $1"; \
50212630Sdavidxufi
51112918Sjeffendef
52112918Sjeff
53212630Sdavidxu# Default test target (core)
54213159Sdavidxudefault: jdk_core langtools_jtreg
55212630Sdavidxu
56212630Sdavidxu# All testing
57212630Sdavidxuall: jdk_all langtools_all
58212630Sdavidxu
59212630Sdavidxu# Test targets
60212630Sdavidxulangtools_% :
61213297Sdavidxu	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
62212630Sdavidxu
63212630Sdavidxujdk_% core_%s svc_%:
64212630Sdavidxu	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
65212630Sdavidxu
66212630Sdavidxuhotspot_%:
67213297Sdavidxu	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
68212630Sdavidxu
69212630Sdavidxu#
70212630Sdavidxu# jtreg_tests
71212630Sdavidxu#
72212630Sdavidxu# Invocation:
73212837Sdavidxu#
74212630Sdavidxu# make jtreg_tests TESTDIRS=<test-dirs>
75212838Sdavidxu#
76212630Sdavidxu# where <test-dirs> is something like '../<component>/test/runtime',
77212630Sdavidxu# <component> in turn being one of the top level directories (for
78212837Sdavidxu# example 'hotspot').
79212630Sdavidxu#
80212837Sdavidxu# The below will strip the path prefix and delegate to the
81212837Sdavidxu# corresponding ../<component>/test/Makefile.
82212838Sdavidxu
83212838Sdavidxuifneq ($(TESTDIRS),)
84212838Sdavidxu# Extract the component from ../<component>/...
85212838SdavidxuCOMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
86212837Sdavidxu
87212837Sdavidxu# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
88212837Sdavidxu# to the delegate Makefile
89212838SdavidxuTESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
90212837Sdavidxuendif
91212838Sdavidxu
92212838Sdavidxujtreg_tests:
93212837Sdavidxu	@$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
94212837Sdavidxu
95212837Sdavidxu################################################################
96212837Sdavidxu
97212837Sdavidxu# Phony targets (e.g. these are not filenames)
98212630Sdavidxu.PHONY: all clean
99212837Sdavidxu
100212630Sdavidxu################################################################
101212630Sdavidxu