< prev index next >

make/common/FindTests.gmk

Print this page


   1 #
   2 # Copyright (c) 2017, 2019, 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 
  26 ifndef _FIND_TESTS_GMK
  27 _FIND_TESTS_GMK := 1
  28 
  29 # This makefile can be called directly to just trigger generation of the cache
  30 # makefile. If so, SPEC and MakeBase.gmk need to be included.
  31 ifeq ($(FINDTESTS_STAND_ALONE), true)
  32   include $(SPEC)
  33   include MakeBase.gmk
  34 endif
  35 
  36 # Make sure this variable is not lazy evaled.
  37 ALL_NAMED_TESTS :=
  38 
  39 # Hook to include the corresponding custom file, if present.
  40 $(eval $(call IncludeCustomExtension, common/FindTests.gmk))
  41 
  42 # TEST_BASEDIRS might have been set by a custom extension
  43 TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
  44 
  45 # JTREG_TESTROOTS might have been set by a custom extension
  46 JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
  47 
  48 # Extract the names of the Jtreg group files from the TEST.ROOT files. The
  49 # TEST.ROOT files being properties files can be interpreted as makefiles so
  50 # use include to get at the contents instead of expensive shell calls. We are
  51 # looking for the "groups" property in each file.
  52 JTREG_ROOT_FILES := $(addsuffix /TEST.ROOT, $(JTREG_TESTROOTS))
  53 JTREG_GROUP_FILES :=
  54 $(foreach root, $(JTREG_TESTROOTS), \
  55   $(eval include $(root)/TEST.ROOT) \
  56   $(eval $(root)_JTREG_GROUP_FILES := $$(addprefix $(root)/, $$(groups))) \
  57   $(eval JTREG_GROUP_FILES += $$($(root)_JTREG_GROUP_FILES)) \
  58 )
  59 
  60 # Cache the expensive to calculate test names in a generated makefile.
  61 FIND_TESTS_CACHE_FILE := $(MAKESUPPORT_OUTPUTDIR)/find-tests.gmk
  62 
  63 # If this file is deemed outdated, it will automatically get regenerated
  64 # by this rule before being included below.
  65 #
  66 # When calling TestMake.gmk, override the log level to avoid any kind of debug
  67 # output being captured into the generated makefile.
  68 $(FIND_TESTS_CACHE_FILE): $(JTREG_ROOT_FILES) $(JTREG_GROUP_FILES)
  69         $(call MakeTargetDir)
  70         ( $(foreach root, $(JTREG_TESTROOTS), \
  71             $(PRINTF) "\n$(root)_JTREG_TEST_GROUPS := " ; \
  72             $(SED) -n -e 's/^\#.*//g' -e 's/\([^ ]*\)\w*=.*/\1/gp' \
  73               $($(root)_JTREG_GROUP_FILES) \
  74               | $(SORT) -u | $(TR) '\n' ' ' ; \
  75           ) \
  76           $(PRINTF) "\nMAKE_TEST_TARGETS := " ; \
  77           $(MAKE) -s --no-print-directory $(MAKE_ARGS) LOG_LEVEL=warn \
  78               SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets \
  79         ) > $@
  80 
  81 -include $(FIND_TESTS_CACHE_FILE)

  82 
  83 # Create a list of all available Jtreg test groups in all components
  84 JTREG_TEST_GROUPS += $(sort $(foreach root, $(JTREG_TESTROOTS), \
  85     $($(root)_JTREG_TEST_GROUPS)))
  86 
  87 # Add Jtreg test groups to list of named tests (test groups, test list, etc)
  88 # ALL_NAMED_TESTS might have been set by a custom extension
  89 ALL_NAMED_TESTS += $(JTREG_TEST_GROUPS)
  90 
  91 # Add the make test targets
  92 ALL_NAMED_TESTS += $(addprefix make-, $(MAKE_TEST_TARGETS))
  93 
  94 # Add Gtest
  95 ALL_NAMED_TESTS += gtest
  96 
  97 # Add microbenchmarks
  98 ALL_NAMED_TESTS += micro






  99 
 100 # Add special tests
 101 ALL_NAMED_TESTS += failure-handler make
 102 
 103 ################################################################################
 104 
 105 endif # _FIND_TESTS_GMK
   1 #
   2 # Copyright (c) 2017, 2018, 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 
  26 ifndef _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 # TEST_BASEDIRS might have been set by a custom extension
  33 TEST_BASEDIRS += $(TOPDIR)/test $(TOPDIR)
  34 
  35 # JTREG_TESTROOTS might have been set by a custom extension
  36 JTREG_TESTROOTS += $(addprefix $(TOPDIR)/test/, hotspot/jtreg jdk langtools nashorn jaxp)
  37 
  38 ################################################################################
  39 # Find the Jtreg test groups for the given component.
  40 #
  41 # Parameter 1 is the jtreg root dir. This name is used as variable prefix.
  42 #
  43 # After this macro has been evaluated, the following variables are defined for
  44 # the component:
  45 #   JTREG_TESTROOT - The path to the root of the test directory
  46 #   JTREG_GROUP_FILES - The file(s) containing the group definitions
  47 #   JTREG_TEST_GROUPS - The name of the test groups that the component defines
  48 #
  49 FindJtregGroups = $(NamedParamsMacroTemplate)
  50 define FindJtregGroupsBody
  51   ifneq ($$(wildcard $1), )
  52     $1_JTREG_GROUP_FILENAMES := $$(shell $$(SED) -n -e 's/\[\(.*\)\]/\1/g' \
  53         -e 's/^groups\w*=//p' $1/TEST.ROOT)
  54     $1_JTREG_GROUP_FILES := $$(addprefix $1/, $$($1_JTREG_GROUP_FILENAMES))
  55     $1_JTREG_TEST_GROUPS := $$(strip $$(shell $$(SED) -n \
  56         -e 's/\([^ ]*\)\w*=.*/\1/gp' $$(wildcard $$($1_JTREG_GROUP_FILES)) \
  57         | $$(SORT) -u))
  58   endif
  59 endef










  60 
  61 # Configure definitions for all available test components
  62 $(foreach root, $(JTREG_TESTROOTS), $(eval $(call FindJtregGroups, $(root))))
  63 
  64 # Create a list of all available Jtreg test groups in all components
  65 JTREG_TEST_GROUPS += $(sort $(foreach root, $(JTREG_TESTROOTS), \
  66     $($(root)_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
  70 ALL_NAMED_TESTS += $(JTREG_TEST_GROUPS)
  71 



  72 # Add Gtest
  73 ALL_NAMED_TESTS += gtest
  74 
  75 # Add microbenchmarks
  76 ALL_NAMED_TESTS += micro
  77 
  78 # Find make test targets
  79 MAKE_TEST_TARGETS := $(shell $(MAKE) -s --no-print-directory $(MAKE_ARGS) \
  80     SPEC=$(SPEC) -f $(TOPDIR)/test/make/TestMake.gmk print-targets)
  81 
  82 ALL_NAMED_TESTS += $(addprefix make-, $(MAKE_TEST_TARGETS))
  83 
  84 # Add special tests
  85 ALL_NAMED_TESTS += failure-handler make
  86 
  87 ################################################################################
  88 
  89 endif # _FIND_TESTS_GMK
< prev index next >