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