Makefile revision 1927:cf3701bb0291
1362716Scy#
2275970Scy# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
3275970Scy# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4275970Scy#
5275970Scy# This code is free software; you can redistribute it and/or modify it
6362716Scy# under the terms of the GNU General Public License version 2 only, as
7275970Scy# published by the Free Software Foundation.  Oracle designates this
8275970Scy# particular file as subject to the "Classpath" exception as provided
9275970Scy# by Oracle in the LICENSE file that accompanied this code.
10275970Scy#
11275970Scy# This code is distributed in the hope that it will be useful, but WITHOUT
12275970Scy# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13275970Scy# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14275970Scy# version 2 for more details (a copy is included in the LICENSE file that
15275970Scy# accompanied this code).
16275970Scy#
17275970Scy# You should have received a copy of the GNU General Public License version
18275970Scy# 2 along with this work; if not, write to the Free Software Foundation,
19275970Scy# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20275970Scy#
21275970Scy# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22275970Scy# or visit www.oracle.com if you need additional information or have any
23275970Scy# questions.
24275970Scy#
25275970Scy
26275970Scy#
27275970Scy# Makefile to run tests from multiple sibling directories
28275970Scy#
29275970Scy
30275970Scy# Root of the forest that was built
31275970ScyTOPDIR=..
32275970Scy
33275970Scy# This makefile depends on the availability of sibling directories.
34275970ScyLANGTOOLS_DIR=$(TOPDIR)/langtools
35275970ScyJDK_DIR=$(TOPDIR)/jdk
36275970ScyJAXP_DIR=$(TOPDIR)/jaxp
37275970ScyHOTSPOT_DIR=$(TOPDIR)/hotspot
38275970Scy
39275970Scy# Macro to run a test target in a subdir
40275970Scydefine SUBDIR_TEST # subdirectory target
41275970Scyif [ -d $1 ] ; then \
42275970Scy  if [ -r $1/test/Makefile ] ; then \
43275970Scy    $(MAKE) --no-print-directory -k -C $1/test $2 ; \
44275970Scy  else \
45275970Scy    echo "ERROR: File does not exist: $1/test/Makefile"; \
46275970Scy    exit 1; \
47275970Scy  fi; \
48275970Scyelse \
49275970Scy  echo "WARNING: No testing done, directory does not exist: $1"; \
50275970Scyfi
51275970Scyendef
52275970Scy
53275970Scy# Default test target (core)
54275970Scydefault: jdk_core langtools_jtreg jaxp_all
55275970Scy
56275970Scy# All testing
57275970Scyall: jdk_all langtools_all jaxp_all
58275970Scy
59275970Scy# Bring in closed test targets if present
60275970Scy-include $(TOPDIR)/closed/test/Makefile
61275970Scy
62275970Scyifeq ($(TEST_JOBS), 0)
63275970Scy  JDK_TEST_JOBS=$(JOBS)
64275970Scyelse
65275970Scy  JDK_TEST_JOBS=$(TEST_JOBS)
66275970Scyendif
67275970Scy# Test targets
68275970Scylangtools_% :
69275970Scy	@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), CONCURRENCY=$(JDK_TEST_JOBS) JT_JAVA=$(PRODUCT_HOME) JTREG_HOME=$(JT_HOME) TEST="$(subst langtools_,,$@)" $(subst langtools_,,$@))
70275970Scy
71275970Scyjdk_% core_%s svc_%:
72275970Scy	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
73275970Scy
74275970Scyjaxp_%:
75275970Scy	@$(NO_STOPPING)$(call SUBDIR_TEST, $(JAXP_DIR), CONCURRENCY=$(JDK_TEST_JOBS) TEST="$@" $@)
76275970Scy
77275970Scyifeq ($(TEST_JOBS), 0)
78275970Scy  HOTSPOT_TEST_JOBS=1
79275970Scyelse
80275970Scy  HOTSPOT_TEST_JOBS=$(TEST_JOBS)
81275970Scyendif
82275970Scyhotspot_%:
83275970Scy	@$(NO_STOPPING)$(call SUBDIR_TEST, $(HOTSPOT_DIR), CONCURRENCY=$(HOTSPOT_TEST_JOBS) TEST="$@" $@)
84275970Scy
85275970Scy#
86275970Scy# jtreg_tests
87275970Scy#
88275970Scy# Invocation:
89275970Scy#
90275970Scy# make jtreg_tests TESTDIRS=<test-dirs>
91275970Scy#
92# where <test-dirs> is something like '../<component>/test/runtime',
93# <component> in turn being one of the top level directories (for
94# example 'hotspot').
95#
96# The below will strip the path prefix and delegate to the
97# corresponding ../<component>/test/Makefile.
98
99ifneq ($(TESTDIRS),)
100# Extract the component from ../<component>/...
101COMPONENT=$(word 2,$(subst /, ,$(TESTDIRS)))
102
103# Strip off the ../<component>/test prefix and pass the rest as TESTDIRS
104# to the delegate Makefile
105TESTDIRS_TESTS=$(patsubst ../$(COMPONENT)/test/%,%,$(TESTDIRS))
106endif
107
108jtreg_tests:
109	@$(NO_STOPPING)$(call SUBDIR_TEST, $(TOPDIR)/$(COMPONENT), TESTDIRS=$(TESTDIRS_TESTS) $@)
110
111################################################################
112
113# Phony targets (e.g. these are not filenames)
114.PHONY: all clean
115
116################################################################
117