FindTests.gmk revision 2519:4d29ee32d926
1# 2# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22# or visit www.oracle.com if you need additional information or have any 23# questions. 24# 25 26ifndef _FIND_TESTS_GMK 27_FIND_TESTS_GMK := 1 28 29# Hook to include the corresponding custom file, if present. 30$(eval $(call IncludeCustomExtension, , common/FindTests.gmk)) 31 32# JTREG_COMPONENTS might have been set by a custom extension 33JTREG_COMPONENTS += hotspot jdk langtools nashorn jaxp 34 35################################################################################ 36# Find the Jtreg test groups for the given component. 37# 38# Parameter 1 is the name of the component. This name is used as variable prefix. 39# 40# After this macro has been evaluated, the following variables are defined for 41# the component: 42# JTREG_TESTROOT - The path to the root of the test directory 43# JTREG_GROUP_FILES - The file(s) containing the group definitions 44# JTREG_TEST_GROUPS - The name of the test groups that the component defines 45# 46FindJtregGroups = $(NamedParamsMacroTemplate) 47define FindJtregGroupsBody 48 $1_JTREG_TESTROOT := $$(TOPDIR)/$1/test 49 ifneq ($$(wildcard $$($1_JTREG_TESTROOT)), ) 50 $1_JTREG_GROUP_FILENAMES := $$(shell $$(SED) -n -e 's/\[\(.*\)\]/\1/g' \ 51 -e 's/^groups\w*=//p' $$($1_JTREG_TESTROOT)/TEST.ROOT) 52 $1_JTREG_GROUP_FILES := $$(addprefix $$($1_JTREG_TESTROOT)/, \ 53 $$($1_JTREG_GROUP_FILENAMES)) 54 $1_JTREG_TEST_GROUPS := $$(strip $$(shell $$(SED) -n \ 55 -e 's/\([^ ]*\)\w*=.*/\1/gp' $$(wildcard $$($1_JTREG_GROUP_FILES)) \ 56 | $$(SORT) -u)) 57 endif 58endef 59 60# Configure definitions for all available test components 61$(foreach component, $(JTREG_COMPONENTS), \ 62 $(eval $(call FindJtregGroups, $(component)))) 63 64# Create a list of all available Jtreg test groups in all components 65JTREG_TEST_GROUPS += $(sort $(foreach component, $(JTREG_COMPONENTS), \ 66 $($(component)_JTREG_TEST_GROUPS))) 67 68# Add Jtreg test groups to list of named tests (test groups, test list, etc) 69# ALL_NAMED_TESTS might have been set by a custom extension 70ALL_NAMED_TESTS += $(JTREG_TEST_GROUPS) 71 72# Add Gtest 73ALL_NAMED_TESTS += gtest 74 75################################################################################ 76 77endif # _FIND_TESTS_GMK 78