make/common/FindTests.gmk
author zgu
Fri, 15 Nov 2019 15:33:34 -0500
changeset 59113 700a2ad8fc19
parent 55465 68ef70c9a921
permissions -rw-r--r--
8204128: NMT might report incorrect numbers for Compiler area Reviewed-by: stuefe, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     1
#
53295
520f8e2041bb 8215729: Enhance makefiles to allow collecting code coverage with JCov
shurailine
parents: 52595
diff changeset
     2
# Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
44027
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
54382
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    29
# This makefile can be called directly to just trigger generation of the cache
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    30
# makefile. If so, SPEC and MakeBase.gmk need to be included.
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    31
ifeq ($(FINDTESTS_STAND_ALONE), true)
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    32
  include $(SPEC)
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    33
  include MakeBase.gmk
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    34
endif
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    35
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    36
# Make sure this variable is not lazy evaled.
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    37
ALL_NAMED_TESTS :=
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    38
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    39
# Hook to include the corresponding custom file, if present.
47314
743814386712 8188814: Simplify IncludeCustomExtension
ihse
parents: 47218
diff changeset
    40
$(eval $(call IncludeCustomExtension, common/FindTests.gmk))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    41
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47314
diff changeset
    42
# TEST_BASEDIRS might have been set by a custom extension
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47314
diff changeset
    43
TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47314
diff changeset
    44
47218
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 44028
diff changeset
    45
# JTREG_TESTROOTS might have been set by a custom extension
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 44028
diff changeset
    46
JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    47
54382
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    48
# Extract the names of the Jtreg group files from the TEST.ROOT files. The
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    49
# TEST.ROOT files being properties files can be interpreted as makefiles so
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    50
# use include to get at the contents instead of expensive shell calls. We are
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    51
# looking for the "groups" property in each file.
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    52
JTREG_ROOT_FILES := $(addsuffix /TEST.ROOT, $(JTREG_TESTROOTS))
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    53
JTREG_GROUP_FILES :=
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    54
$(foreach root, $(JTREG_TESTROOTS), \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    55
  $(eval include $(root)/TEST.ROOT) \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    56
  $(eval $(root)_JTREG_GROUP_FILES := $$(addprefix $(root)/, $$(groups))) \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    57
  $(eval JTREG_GROUP_FILES += $$($(root)_JTREG_GROUP_FILES)) \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    58
)
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    59
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    60
# Cache the expensive to calculate test names in a generated makefile.
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    61
FIND_TESTS_CACHE_FILE := $(MAKESUPPORT_OUTPUTDIR)/find-tests.gmk
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    62
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    63
# If this file is deemed outdated, it will automatically get regenerated
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    64
# by this rule before being included below.
55465
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    65
$(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES) \
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    66
    $(TOPDIR)/test/make/TestMake.gmk
54382
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    67
	$(call MakeTargetDir)
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    68
	( $(foreach root, $(JTREG_TESTROOTS), \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    69
	    $(PRINTF) "\n$(root)_JTREG_TEST_GROUPS := " ; \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    70
	    $(SED) -n -e 's/^\#.*//g' -e 's/\([^ ]*\)\w*=.*/\1/gp' \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    71
	      $($(root)_JTREG_GROUP_FILES) \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    72
	      | $(SORT) -u | $(TR) '\n' ' ' ; \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    73
	  ) \
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    74
	) > $@
55465
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    75
	$(PRINTF) "\nMAKE_TEST_TARGETS := " >> $@
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    76
	$(MAKE) -s --no-print-directory $(MAKE_ARGS) \
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    77
	    SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
68ef70c9a921 8226538: find-files.gmk gets corrupted if tab completion is used before running make first
erikj
parents: 54382
diff changeset
    78
	    TARGETS_FILE=$@
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    79
54382
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    80
-include $(FIND_TESTS_CACHE_FILE)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    81
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    82
# Create a list of all available Jtreg test groups in all components
47218
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 44028
diff changeset
    83
JTREG_TEST_GROUPS += $(sort $(foreach root, $(JTREG_TESTROOTS), \
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 44028
diff changeset
    84
    $($(root)_JTREG_TEST_GROUPS)))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    85
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    86
# 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
    87
# ALL_NAMED_TESTS might have been set by a custom extension
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    88
ALL_NAMED_TESTS += $(JTREG_TEST_GROUPS)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    89
54382
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    90
# Add the make test targets
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    91
ALL_NAMED_TESTS += $(addprefix make-, $(MAKE_TEST_TARGETS))
61616f509ef8 8221762: Improve Main.gmk/FindTests.gmk bootstrap time
erikj
parents: 54334
diff changeset
    92
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    93
# Add Gtest
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    94
ALL_NAMED_TESTS += gtest
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    95
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52396
diff changeset
    96
# Add microbenchmarks
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52396
diff changeset
    97
ALL_NAMED_TESTS += micro
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52396
diff changeset
    98
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 47932
diff changeset
    99
# Add special tests
52396
e292e94b448a 8213058: remove ExecuteInternalVMTests and VerboseInternalVMTests flags
iignatyev
parents: 52342
diff changeset
   100
ALL_NAMED_TESTS += failure-handler make
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 47932
diff changeset
   101
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   102
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   103
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   104
endif # _FIND_TESTS_GMK