Makefile revision 1257:75ad722b5f04
1123795Snjl#
2123795Snjl# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3215201Sjkim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4215201Sjkim#
5215201Sjkim# This code is free software; you can redistribute it and/or modify it
6215201Sjkim# under the terms of the GNU General Public License version 2 only, as
7211690Simp# published by the Free Software Foundation.  Oracle designates this
8204877Sjkim# particular file as subject to the "Classpath" exception as provided
9167814Sjkim# by Oracle in the LICENSE file that accompanied this code.
10167814Sjkim#
11204877Sjkim# This code is distributed in the hope that it will be useful, but WITHOUT
12204877Sjkim# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13165320Stakawata# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14165320Stakawata# version 2 for more details (a copy is included in the LICENSE file that
15193530Sjkim# accompanied this code).
16193530Sjkim#
17193530Sjkim# You should have received a copy of the GNU General Public License version
18193530Sjkim# 2 along with this work; if not, write to the Free Software Foundation,
19193530Sjkim# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20193530Sjkim#
21193530Sjkim# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22193530Sjkim# or visit www.oracle.com if you need additional information or have any
23193530Sjkim# questions.
24193530Sjkim#
25193530Sjkim
26193530Sjkim#
27193530Sjkim# Makefile to run tests from multiple sibling directories
28193530Sjkim#
29215012Sjhb
30215012Sjhb# Root of the forest that was built
31123795SnjlTOPDIR=..
32123795Snjl
33123795Snjl# This makefile depends on the availability of sibling directories.
34123795SnjlLANGTOOLS_DIR=$(TOPDIR)/langtools
35218590SjkimJDK_DIR=$(TOPDIR)/jdk
36218590SjkimJAXP_DIR=$(TOPDIR)/jaxp
37197688SjkimHOTSPOT_DIR=$(TOPDIR)/hotspot
38197688Sjkim
39218590Sjkim# Macro to run a test target in a subdir
40218590Sjkimdefine SUBDIR_TEST # subdirectory target
41218590Sjkimif [ -d $1 ] ; then \
42220663Sjkim  if [ -r $1/test/Makefile ] ; then \
43216471Sjkim    echo "$(MAKE) -k -C $1/test $2" ; \
44204874Sjkim    $(MAKE) -k -C $1/test $2 ; \
45204874Sjkim  else \
46204874Sjkim    echo "ERROR: File does not exist: $1/test/Makefile"; \
47204874Sjkim    exit 1; \
48212761Sjkim  fi; \
49212761Sjkimelse \
50167814Sjkim  echo "WARNING: No testing done, directory does not exist: $1"; \
51199338Sjkimfi
52199338Sjkimendef
53167814Sjkim
54167814Sjkim# Default test target (core)
55167814Sjkimdefault: jdk_core langtools_jtreg jaxp_all
56167814Sjkim
57167814Sjkim# All testing
58218590Sjkimall: jdk_all langtools_all jaxp_all
59218590Sjkim
60218590Sjkim# Test targets
61123795Snjllangtools_% :
62128509Snjl	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
63167814Sjkim
64167814Sjkimjdk_% core_%s svc_%:
65167814Sjkim	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), TEST="$@" $@)
66128509Snjl
67128509Snjljaxp_%:
68167814Sjkim	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JAXP_DIR), TEST="$@" $@)
69167814Sjkim
70128509Snjlhotspot_%:
71123795Snjl	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), TEST="$@" $@)
72167814Sjkim
73167814Sjkim#
74167814Sjkim# jtreg_tests
75167814Sjkim#
76167814Sjkim# Invocation:
77124255Snjl#
78146020Smarks# make jtreg_tests TESTDIRS=<test-dirs>
79146020Smarks#
80146020Smarks# where <test-dirs> is something like '../<component>/test/runtime',
81188516Sn_hibma# <component> in turn being one of the top level directories (for
82146020Smarks# example 'hotspot').
83151350Syar#
84172313Snjl# The below will strip the path prefix and delegate to the
85172313Snjl# corresponding ../<component>/test/Makefile.
86172313Snjl
87194312Sjkimifneq ($(TESTDIRS),)
88194313Sjkim# Extract the component from ../<component>/...
89194312SjkimCOMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
90123795Snjl
91123795Snjl# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
92123795Snjl# to the delegate Makefile
93123795SnjlTESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
94123795Snjlendif
95123795Snjl
96123962Sbdejtreg_tests:
97123795Snjl	@$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
98123795Snjl
99123795Snjl################################################################
100123795Snjl
101151350Syar# Phony targets (e.g. these are not filenames)
102123795Snjl.PHONY: all clean
103123795Snjl
104215200Sjkim################################################################
105197688Sjkim