make/RunTests.gmk
author dholmes
Tue, 01 Jan 2019 20:09:02 -0500
changeset 53109 b99b41325d89
parent 52790 290b04fd1846
child 53295 520f8e2041bb
permissions -rw-r--r--
8215977: hsdis installation documentation update Reviewed-by: dholmes Contributed-by: Sergei Ustimenko <merkel05@gmail.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     1
#
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
     2
# Copyright (c) 2016, 2018, 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
default: all
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    27
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    28
include $(SPEC)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    29
include MakeBase.gmk
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    30
include 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
# We will always run multiple tests serially
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    33
.NOTPARALLEL:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    34
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    35
################################################################################
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    36
# Parse global control variables
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    37
################################################################################
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    38
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    39
ifneq ($(TEST_VM_OPTS), )
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    40
  ifneq ($(TEST_OPTS), )
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    41
    TEST_OPTS := $(TEST_OPTS);VM_OPTIONS=$(TEST_VM_OPTS)
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    42
  else
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    43
    TEST_OPTS := VM_OPTIONS=$(TEST_VM_OPTS)
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    44
  endif
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    45
endif
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    46
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    47
$(eval $(call ParseKeywordVariable, TEST_OPTS, \
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
    48
    SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR AOT_MODULES, \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
    49
    STRING_KEYWORDS := VM_OPTIONS JAVA_OPTIONS, \
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    50
))
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    51
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    52
# Helper function to propagate TEST_OPTS values.
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    53
#
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    54
# Note: No spaces are allowed around the arguments.
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    55
# Arg $1 The variable in TEST_OPTS to propagate
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    56
# Arg $2 The control variable to propagate it to
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    57
define SetTestOpt
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    58
  ifneq ($$(TEST_OPTS_$1), )
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    59
    $2_$1 := $$(TEST_OPTS_$1)
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    60
  endif
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    61
endef
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    62
49147
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    63
# Setup _NT_SYMBOL_PATH on Windows
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    64
ifeq ($(OPENJDK_TARGET_OS), windows)
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    65
  ifndef _NT_SYMBOL_PATH
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    66
    # Can't use PathList here as it adds quotes around the value.
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    67
    _NT_SYMBOL_PATH := \
52295
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    68
        $(subst $(SPACE),;,$(strip \
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    69
            $(foreach p, $(sort $(dir $(wildcard \
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    70
                $(addprefix $(SYMBOLS_IMAGE_DIR)/bin/, *.pdb */*.pdb)))), \
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    71
              $(call FixPath, $p) \
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    72
            ) \
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    73
        ))
49147
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    74
    export _NT_SYMBOL_PATH
52295
57d299cdd068 8213005: Missing symbols in hs_err files on Windows after JDK-8212028
erikj
parents: 52125
diff changeset
    75
    $(info _NT_SYMBOL_PATH=$(_NT_SYMBOL_PATH))
49147
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    76
  endif
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    77
endif
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
    78
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    79
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    80
# Hook to include the corresponding custom file, if present.
47314
743814386712 8188814: Simplify IncludeCustomExtension
ihse
parents: 47259
diff changeset
    81
$(eval $(call IncludeCustomExtension, RunTests.gmk))
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    82
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    83
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47218
diff changeset
    84
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47218
diff changeset
    85
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
    86
TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
    87
TEST_LAST_IDS := $(TEST_SUPPORT_DIR)/test-last-ids.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    88
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    89
ifeq ($(CUSTOM_ROOT), )
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    90
  JTREG_TOPDIR := $(TOPDIR)
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    91
else
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    92
  JTREG_TOPDIR := $(CUSTOM_ROOT)
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    93
endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    94
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    95
JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    96
JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    97
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    98
ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    99
  JTREG_FAILURE_HANDLER_OPTIONS := \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   100
      -timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   101
      -observerDir:$(JTREG_FAILURE_HANDLER) \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   102
      -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   103
      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   104
      -timeoutHandlerTimeout:0
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   105
endif
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   106
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   107
GTEST_LAUNCHER_DIRS := $(patsubst %/gtestLauncher, %, $(wildcard $(TEST_IMAGE_DIR)/hotspot/gtest/*/gtestLauncher))
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   108
GTEST_VARIANTS := $(strip $(patsubst $(TEST_IMAGE_DIR)/hotspot/gtest/%, %, $(GTEST_LAUNCHER_DIRS)))
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   109
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   110
################################################################################
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   111
# Optionally create AOT libraries for specified modules before running tests.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   112
# Note, this could not be done during JDK build time.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   113
################################################################################
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   114
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   115
# Note, this could not be done during JDK build time.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   116
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   117
# Parameter 1 is the name of the rule.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   118
#
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   119
# Remaining parameters are named arguments.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   120
#   MODULE      The module to generate a library for
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   121
#   BIN         Output directory in which to put the library
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   122
#   VM_OPTIONS  List of JVM arguments to use when creating library
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   123
#   OPTIONS_VAR Name of variable to put AOT java options in
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   124
#   PREREQS_VAR Name of variable to put all AOT prerequisite rule targets in
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   125
#               for test rules to depend on
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   126
#
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   127
SetupAotModule = $(NamedParamsMacroTemplate)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   128
define SetupAotModuleBody
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   129
  $1_AOT_LIB := $$($1_BIN)/$$(call SHARED_LIBRARY,$$($1_MODULE))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   130
  $1_AOT_CCLIST := $$(wildcard $$(TOPDIR)/test/hotspot/jtreg/compiler/aot/scripts/$$($1_MODULE)-list.txt)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   131
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   132
  ifeq ($(OPENJDK_TARGET_OS), windows)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   133
    $1_LD := $$(addsuffix $$(EXE_SUFFIX), $$(filter-out $$(FIXPATH), $$(LD)))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   134
  else
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   135
    $1_LD := $$(LD)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   136
  endif
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   137
52790
290b04fd1846 8214557: Filter out VM flags which don't affect AOT code generation
epavlova
parents: 52595
diff changeset
   138
  # Create jaotc flags.
290b04fd1846 8214557: Filter out VM flags which don't affect AOT code generation
epavlova
parents: 52595
diff changeset
   139
  # VM flags which don't affect AOT code generation are filtered out: -Xcomp, -XX:+-TieredCompilation
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   140
  $1_JAOTC_OPTS := \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   141
      -J-Xmx4g --info \
52790
290b04fd1846 8214557: Filter out VM flags which don't affect AOT code generation
epavlova
parents: 52595
diff changeset
   142
      $$(addprefix -J, $$(filter-out -Xcomp %TieredCompilation, $$($1_VM_OPTIONS))) \
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   143
      $$(addprefix --compile-commands$(SPACE), $$($1_AOT_CCLIST)) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   144
      --linker-path $$($1_LD) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   145
      #
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   146
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   147
  ifneq ($$(filter -ea, $$($1_VM_OPTIONS)), )
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   148
    $1_JAOTC_OPTS += --compile-with-assertions
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   149
  endif
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   150
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   151
  $$($1_AOT_LIB): $$(JDK_IMAGE_DIR)/release \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   152
      $$(call DependOnVariable, $1_JAOTC_OPTS) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   153
      $$(call DependOnVariable, JDK_IMAGE_DIR)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   154
	$$(call LogWarn, Generating $$(patsubst $$(OUTPUTDIR)/%, %, $$@))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   155
	$$(call MakeTargetDir)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   156
	$$(call ExecuteWithLog, $$@, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   157
	    $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/jaotc \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   158
	    $$($1_JAOTC_OPTS) --output $$@ --module $$($1_MODULE) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   159
	)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   160
	$$(call ExecuteWithLog, $$@.check, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   161
	  $$(FIXPATH) $$(JDK_IMAGE_DIR)/bin/java \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   162
	  $$($1_VM_OPTIONS) -XX:+PrintAOT -XX:+UseAOTStrictLoading -XX:AOTLibrary=$$@ -version \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   163
	  > $$@.verify-aot \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   164
	)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   165
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   166
  $1_AOT_OPTIONS += -XX:AOTLibrary=$$($1_AOT_LIB)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   167
  $1_AOT_TARGETS += $$($1_AOT_LIB)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   168
endef
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   169
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   170
# Parameter 1 is the name of the rule.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   171
#
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   172
# Remaining parameters are named arguments.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   173
#   MODULES     The modules to generate a library for
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   174
#   VM_OPTIONS  List of JVM arguments to use when creating libraries
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   175
#
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   176
# After calling this, the following variables are defined
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   177
#   $1_AOT_OPTIONS List of all java options needed to use the AOT libraries
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   178
#   $1_AOT_TARGETS List of all targets that the test rule will need to depend on
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   179
#
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   180
SetupAot = $(NamedParamsMacroTemplate)
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   181
define SetupAotBody
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   182
  $$(info Running with AOTd libraries for $$($1_MODULES))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   183
  # Put aot libraries in a separate directory so they are not deleted between
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   184
  # test runs and may be reused between make invocations.
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   185
  $$(foreach m, $$($1_MODULES), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   186
    $$(eval $$(call SetupAotModule, $1_$$m, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   187
        MODULE := $$m, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   188
        BIN := $$(TEST_SUPPORT_DIR)/aot/$1, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   189
        VM_OPTIONS := $$($1_VM_OPTIONS), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   190
    )) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   191
    $$(eval $1_AOT_OPTIONS += $$($1_$$m_AOT_OPTIONS)) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   192
    $$(eval $1_AOT_TARGETS += $$($1_$$m_AOT_TARGETS)) \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   193
  )
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   194
endef
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   195
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   196
################################################################################
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   197
# Setup global test running parameters
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   198
################################################################################
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   199
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   200
# Each factor variable comes in 3 variants. The first one is reserved for users
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   201
# to use on command line. The other two are for predifined configurations in JDL
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   202
# and for machine specific configurations respectively.
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   203
TEST_JOBS_FACTOR ?= 1
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   204
TEST_JOBS_FACTOR_JDL ?= 1
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   205
TEST_JOBS_FACTOR_MACHINE ?= 1
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   206
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   207
ifeq ($(TEST_JOBS), 0)
52556
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   208
  CORES_DIVIDER := 2
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   209
  ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   210
    # For smaller SPARC machines we see reasonable scaling of throughput up to
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   211
    # cpus/4 without affecting test reliability. On the bigger machines, cpus/4
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   212
    # causes intermittent timeouts.
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   213
    ifeq ($(shell $(EXPR) $(NUM_CORES) \> 16), 1)
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   214
      CORES_DIVIDER := 5
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   215
    else
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   216
      CORES_DIVIDER := 4
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   217
    endif
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   218
  endif
52593
8c887dcd5d90 8214003: Limit default test jobs based on memory size
erikj
parents: 52556
diff changeset
   219
  MEMORY_DIVIDER := 2048
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   220
  TEST_JOBS := $(shell $(AWK) \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   221
    'BEGIN { \
52556
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   222
      c = $(NUM_CORES) / $(CORES_DIVIDER); \
52593
8c887dcd5d90 8214003: Limit default test jobs based on memory size
erikj
parents: 52556
diff changeset
   223
      m = $(MEMORY_SIZE) / $(MEMORY_DIVIDER); \
8c887dcd5d90 8214003: Limit default test jobs based on memory size
erikj
parents: 52556
diff changeset
   224
      if (c > m) c = m; \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   225
      c = c * $(TEST_JOBS_FACTOR); \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   226
      c = c * $(TEST_JOBS_FACTOR_JDL); \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   227
      c = c * $(TEST_JOBS_FACTOR_MACHINE); \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   228
      if (c < 1) c = 1; \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   229
      printf "%.0f", c; \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   230
    }')
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   231
endif
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   232
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   233
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   234
# Parse control variables
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   235
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   236
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   237
ifneq ($(TEST_OPTS), )
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   238
  # Inform the user
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   239
  $(info Running tests using TEST_OPTS control variable '$(TEST_OPTS)')
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   240
endif
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   241
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   242
### Jtreg
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   243
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   244
$(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   245
$(eval $(call SetTestOpt,JAVA_OPTIONS,JTREG))
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   246
$(eval $(call SetTestOpt,AOT_MODULES,JTREG))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   247
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   248
$(eval $(call SetTestOpt,JOBS,JTREG))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   249
$(eval $(call SetTestOpt,TIMEOUT_FACTOR,JTREG))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   250
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   251
$(eval $(call ParseKeywordVariable, JTREG, \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   252
    SINGLE_KEYWORDS := JOBS TIMEOUT_FACTOR TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM \
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   253
        EXTRA_PROBLEM_LISTS KEYWORDS AOT_MODULES, \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   254
    STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   255
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   256
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   257
ifneq ($(JTREG), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   258
  # Inform the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   259
  $(info Running tests using JTREG control variable '$(JTREG)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   260
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   261
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   262
### Gtest
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   263
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   264
$(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   265
$(eval $(call SetTestOpt,JAVA_OPTIONS,GTEST))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   266
$(eval $(call SetTestOpt,AOT_MODULES,GTEST))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   267
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   268
$(eval $(call ParseKeywordVariable, GTEST, \
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   269
    SINGLE_KEYWORDS := REPEAT AOT_MODULES, \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   270
    STRING_KEYWORDS := OPTIONS VM_OPTIONS JAVA_OPTIONS, \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   271
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   272
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   273
ifneq ($(GTEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   274
  # Inform the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   275
  $(info Running tests using GTEST control variable '$(GTEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   276
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   277
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   278
### Microbenchmarks
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   279
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   280
$(eval $(call SetTestOpt,VM_OPTIONS,MICRO))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   281
$(eval $(call SetTestOpt,JAVA_OPTIONS,MICRO))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   282
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   283
$(eval $(call ParseKeywordVariable, MICRO, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   284
    SINGLE_KEYWORDS := ITER FORK TIME WARMUP_ITER WARMUP_TIME, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   285
    STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS RESULTS_FORMAT TEST_JDK BENCHMARKS_JAR, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   286
))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   287
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   288
ifneq ($(MICRO), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   289
  # Inform the user
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   290
  $(info Running tests using MICRO control variable '$(MICRO)')
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   291
endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   292
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   293
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   294
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   295
# Component-specific Jtreg settings
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   296
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   297
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   298
hotspot_JTREG_MAX_MEM := 0
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   299
hotspot_JTREG_ASSERT := false
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   300
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   301
jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   302
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   303
jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   304
jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   305
langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   306
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   307
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   308
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   309
langtools_JTREG_MAX_MEM := 768m
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   310
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   311
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   312
# Parse test selection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   313
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   314
# The user has given a test selection in the TEST variable. We must parse it
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   315
# and determine what that means in terms of actual calls to the test framework.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   316
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   317
# The parse functions take as argument a test specification as given by the
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   318
# user, and returns a fully qualified test descriptor if it was a match, or
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   319
# nothing if not. A single test specification can result in multiple test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   320
# descriptors being returned. A valid test descriptor must always be accepted
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   321
# and returned identically.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   322
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   323
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   324
# Helper function to determine if a test specification is a Gtest test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   325
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   326
# It is a Gtest test if it is either "gtest", or "gtest:" followed by an optional
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   327
# test filter string, and an optional "/<variant>" to select a specific JVM
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   328
# variant. If no variant is specified, all found variants are tested.
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   329
define ParseGtestTestSelection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   330
  $(if $(filter gtest%, $1), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   331
    $(if $(filter gtest, $1), \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   332
      $(addprefix gtest:all/, $(GTEST_VARIANTS)) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   333
    , \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   334
      $(if $(strip $(or $(filter gtest/%, $1) $(filter gtest:/%, $1))), \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   335
        $(patsubst gtest:/%, gtest:all/%, $(patsubst gtest/%, gtest:/%, $1)) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   336
      , \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   337
        $(if $(filter gtest:%, $1), \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   338
          $(if $(findstring /, $1), \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   339
            $1 \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   340
          , \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   341
            $(addprefix $1/, $(GTEST_VARIANTS)) \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   342
          ) \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   343
        ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   344
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   345
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   346
  )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   347
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   348
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   349
# Helper function to determine if a test specification is a microbenchmark test
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   350
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   351
# It is a microbenchmark test if it is either "micro", or "micro:" followed by an optional
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   352
# test filter string.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   353
define ParseMicroTestSelection
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   354
  $(if $(filter micro%, $1), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   355
    $(if $(filter micro, $1), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   356
      micro:all \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   357
    , \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   358
      $(if $(filter micro:, $1), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   359
        micro:all \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   360
      , \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   361
        $1 \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   362
      ) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   363
    ) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   364
  )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   365
endef
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   366
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   367
# Helper function that removes the TOPDIR part
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   368
CleanupJtregPath = \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   369
  $(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1)))
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   370
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   371
# Take a partial Jtreg root path and return a full, absolute path to that Jtreg
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   372
# root. Also support having "hotspot" as an alias for "hotspot/jtreg".
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   373
ExpandJtregRoot = \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   374
  $(call CleanupJtregPath, $(wildcard \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   375
    $(if $(filter /%, $1), \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   376
      $(if $(wildcard $(strip $1)/TEST.ROOT), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   377
        $1 \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   378
      ) \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   379
    , \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   380
      $(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   381
      $(filter $(addprefix %, $(strip $1)/jtreg), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   382
    ) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   383
  ))
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   384
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   385
# Take a partial Jtreg test path and return a full, absolute path to that Jtreg
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   386
# test. Also support having "hotspot" as an alias for "hotspot/jtreg".
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   387
ExpandJtregPath = \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   388
  $(if $(call ExpandJtregRoot, $1), \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   389
    $(call ExpandJtregRoot, $1) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   390
  , \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   391
    $(call CleanupJtregPath, $(wildcard \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   392
      $(if $(filter /%, $1), \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   393
        $1 \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   394
      , \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   395
        $(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   396
        $(addsuffix $(strip $(patsubst hotspot/%, /hotspot/jtreg/%, $1)), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   397
      ) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   398
    )) \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   399
  )
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   400
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   401
# Helper function to determine if a test specification is a Jtreg test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   402
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   403
# It is a Jtreg test if it optionally begins with jtreg:, and then is either
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   404
# an unspecified group name (possibly prefixed by :), or a group in a
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   405
# specified test root, or a path to a test or test directory,
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   406
# either absolute or relative to any of the TEST_BASEDIRS or test roots.
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   407
define ParseJtregTestSelection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   408
  $(eval TEST_NAME := $(strip $(patsubst jtreg:%, %, $1))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   409
  $(if $(or $(findstring :, $(TEST_NAME)), $(findstring /, $(TEST_NAME))), , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   410
    $(eval TEST_NAME := :$(TEST_NAME)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   411
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   412
  $(if $(findstring :, $(TEST_NAME)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   413
    $(if $(filter :%, $(TEST_NAME)), \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   414
      $(eval TEST_GROUP := $(patsubst :%, %, $(TEST_NAME))) \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   415
      $(eval TEST_ROOTS := $(foreach test_root, $(JTREG_TESTROOTS), \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   416
          $(call CleanupJtregPath, $(test_root)))) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   417
    , \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   418
      $(eval TEST_PATH := $(word 1, $(subst :, $(SPACE), $(TEST_NAME)))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   419
      $(eval TEST_GROUP := $(word 2, $(subst :, $(SPACE), $(TEST_NAME)))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   420
      $(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   421
    ) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   422
    $(foreach test_root, $(TEST_ROOTS), \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   423
      $(if $(filter /%, $(test_root)), \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   424
        jtreg:$(test_root):$(TEST_GROUP) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   425
      , \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   426
        $(if $(filter $(TEST_GROUP), $($(JTREG_TOPDIR)/$(test_root)_JTREG_TEST_GROUPS)), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   427
          jtreg:$(test_root):$(TEST_GROUP) \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   428
        ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   429
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   430
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   431
  , \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   432
    $(eval TEST_PATHS := $(call ExpandJtregPath, $(TEST_NAME))) \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   433
    $(foreach test_path, $(TEST_PATHS), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   434
      jtreg:$(test_path) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   435
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   436
  )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   437
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   438
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   439
# Helper function to determine if a test specification is a special test
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   440
#
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   441
# It is a special test if it is "special:" followed by a test name,
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   442
# if it is "make:" or "make-" followed by a make test, or any of the special test names
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   443
# as a single word.
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   444
define ParseSpecialTestSelection
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   445
  $(if $(filter special:%, $1), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   446
    $1 \
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   447
  ) \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   448
  $(if $(filter make%, $1), \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   449
    $(if $(filter make:%, $1), \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   450
      special:$(strip $1) \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   451
    ) \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   452
    $(if $(filter make-%, $1), \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   453
      special:$(patsubst make-%,make:%, $1) \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   454
    ) \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   455
    $(if $(filter make, $1), \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   456
      special:make:all \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   457
    )
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   458
  ) \
52396
e292e94b448a 8213058: remove ExecuteInternalVMTests and VerboseInternalVMTests flags
iignatyev
parents: 52393
diff changeset
   459
  $(if $(filter failure-handler, $1), \
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   460
    special:$(strip $1) \
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   461
  )
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   462
endef
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   463
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   464
ifeq ($(TEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   465
  $(info No test selection given in TEST!)
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   466
  $(info Please use e.g. 'make test TEST=tier1' or 'make test-tier1')
47928
fb62d4519338 8191715: Update documentation pointing to "common" directory
ihse
parents: 47329
diff changeset
   467
  $(info See doc/testing.[md|html] for help)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   468
  $(error Cannot continue)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   469
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   470
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   471
# Now intelligently convert the test selection given by the user in TEST
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   472
# into a list of fully qualified test descriptors of the tests to run.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   473
TESTS_TO_RUN :=
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   474
$(foreach test, $(TEST), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   475
  $(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   476
  $(if $(strip $(PARSED_TESTS)), , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   477
    $(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   478
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   479
  $(if $(strip $(PARSED_TESTS)), , \
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   480
    $(eval PARSED_TESTS += $(call ParseMicroTestSelection, $(test))) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   481
  ) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   482
  $(if $(strip $(PARSED_TESTS)), , \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   483
    $(eval PARSED_TESTS += $(call ParseJtregTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   484
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   485
  $(if $(strip $(PARSED_TESTS)), , \
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   486
    $(eval PARSED_TESTS += $(call ParseSpecialTestSelection, $(test))) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   487
  ) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   488
  $(if $(strip $(PARSED_TESTS)), , \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   489
    $(eval UNKNOWN_TEST := $(test)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   490
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   491
  $(eval TESTS_TO_RUN += $(PARSED_TESTS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   492
)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   493
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   494
ifneq ($(UNKNOWN_TEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   495
  $(info Unknown test selection: '$(UNKNOWN_TEST)')
47928
fb62d4519338 8191715: Update documentation pointing to "common" directory
ihse
parents: 47329
diff changeset
   496
  $(info See doc/testing.[md|html] for help)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   497
  $(error Cannot continue)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   498
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   499
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   500
TESTS_TO_RUN := $(strip $(TESTS_TO_RUN))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   501
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   502
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   503
# Present the result of our parsing to the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   504
$(info Test selection '$(TEST)', will run:)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   505
$(foreach test, $(TESTS_TO_RUN), $(info * $(test)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   506
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   507
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   508
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   509
# Functions for setting up rules for running the selected tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   510
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   511
# The SetupRun*Test functions all have the same interface:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   512
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   513
# Parameter 1 is the name of the rule. This is the test id, based on the test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   514
# descriptor, and this is also used as variable prefix, and the targets
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   515
# generated are listed in a variable by that name.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   516
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   517
# Remaining parameters are named arguments. Currently this is only:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   518
#   TEST -- The properly formatted fully qualified test descriptor
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   519
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   520
# After the rule named by the test id has been executed, the following
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   521
# variables will be available:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   522
# testid_TOTAL - the total number of tests run
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   523
# testid_PASSED - the number of successful tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   524
# testid_FAILED - the number of failed tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   525
# testid_ERROR - the number of tests was neither successful or failed
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   526
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   527
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   528
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   529
### Rules for Gtest
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   530
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   531
SetupRunGtestTest = $(NamedParamsMacroTemplate)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   532
define SetupRunGtestTestBody
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   533
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   534
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   535
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   536
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   537
  $1_VARIANT :=  $$(lastword $$(subst /, , $$($1_TEST)))
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   538
  ifeq ($$(filter $$($1_VARIANT), $$(GTEST_VARIANTS)), )
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   539
    $$(error Invalid gtest variant '$$($1_VARIANT)'. Valid variants: $$(GTEST_VARIANTS))
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   540
  endif
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   541
  $1_TEST_NAME := $$(strip $$(patsubst %/$$($1_VARIANT), %, \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   542
      $$(patsubst gtest:%, %, $$($1_TEST))))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   543
  ifneq ($$($1_TEST_NAME), all)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   544
    $1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)*
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   545
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   546
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   547
  ifneq ($$(GTEST_REPEAT), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   548
    $1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   549
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   550
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   551
  ifneq ($$(GTEST_AOT_MODULES), )
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   552
    $$(eval $$(call SetupAot, $1, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   553
        MODULES := $$(GTEST_AOT_MODULES), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   554
        VM_OPTIONS := $$(GTEST_VM_OPTIONS) $$(GTEST_JAVA_OPTIONS), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   555
    ))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   556
  endif
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   557
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   558
  run-test-$1: $$($1_AOT_TARGETS)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   559
	$$(call LogWarn)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   560
	$$(call LogWarn, Running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   561
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   562
	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/gtest, \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   563
	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   564
	        -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   565
	        --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   566
	        $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   567
	        $$(GTEST_JAVA_OPTIONS) $$($1_AOT_OPTIONS) \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   568
	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   569
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   570
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   571
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   572
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   573
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   574
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   575
  parse-test-$1: run-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   576
	$$(call LogWarn, Finished running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   577
	$$(call LogWarn, Test report is stored in $$(strip \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   578
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   579
	$$(if $$(wildcard $$($1_RESULT_FILE)), \
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   580
	  $$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   581
	      test cases? ran/ { print $$$$2 }' $$($1_RESULT_FILE))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   582
	  $$(if $$($1_TOTAL), , $$(eval $1_TOTAL := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   583
	  $$(eval $1_PASSED := $$(shell $$(AWK) '/\[  PASSED  \] .* tests?./ \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   584
	      { print $$$$4 }' $$($1_RESULT_FILE))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   585
	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   586
	  $$(eval $1_FAILED := $$(shell $$(AWK) '/\[  FAILED  \] .* tests?, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   587
	      listed below/ { print $$$$4 }' $$($1_RESULT_FILE))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   588
	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   589
	  $$(eval $1_ERROR := $$(shell \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   590
	      $$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   591
	, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   592
	  $$(eval $1_PASSED := 0) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   593
	  $$(eval $1_FAILED := 0) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   594
	  $$(eval $1_ERROR := 1) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   595
	  $$(eval $1_TOTAL := 1) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   596
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   597
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   598
  $1: run-test-$1 parse-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   599
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   600
  TARGETS += $1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   601
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   602
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   603
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   604
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   605
### Rules for Microbenchmarks
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   606
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   607
# Helper function for SetupRunMicroTest. Set a MICRO_* variable from, in order:
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   608
# 1) Specified by user on command line
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   609
# 2) Generic default
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   610
#
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   611
# Note: No spaces are allowed around the arguments.
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   612
# Arg $1 The test ID (i.e. $1 in SetupRunMicroTest)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   613
# Arg $2 Base variable, e.g. MICRO_TEST_JDK
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   614
# Arg $3 The default value (optional)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   615
define SetMicroValue
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   616
  ifneq ($$($2), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   617
    $1_$2 := $$($2)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   618
  else
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   619
    ifneq ($3, )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   620
      $1_$2 := $3
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   621
    endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   622
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   623
endef
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   624
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   625
SetupRunMicroTest = $(NamedParamsMacroTemplate)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   626
define SetupRunMicroTestBody
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   627
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   628
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   629
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   630
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   631
  $1_TEST_NAME := $$(strip $$(patsubst micro:%, %, $$($1_TEST)))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   632
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   633
  $$(eval $$(call SetMicroValue,$1,MICRO_BENCHMARKS_JAR,$$(TEST_IMAGE_DIR)/micro/benchmarks.jar))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   634
  $$(eval $$(call SetMicroValue,$1,MICRO_TEST_JDK,$$(JDK_IMAGE_DIR)))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   635
  $$(eval $$(call SetMicroValue,$1,MICRO_JAVA_OPTIONS))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   636
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   637
  # Current tests needs to open java.io
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   638
  $1_MICRO_JAVA_OPTIONS += --add-opens=java.base/java.io=ALL-UNNAMED
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   639
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   640
  # Save output as JSON or CSV file
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   641
  ifneq ($$(MICRO_RESULTS_FORMAT), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   642
    $1_MICRO_BASIC_OPTIONS += -rf $$(MICRO_RESULTS_FORMAT) -rff $$($1_TEST_RESULTS_DIR)/jmh-result.$(MICRO_RESULTS_FORMAT)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   643
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   644
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   645
  ifneq ($$(MICRO_VM_OPTIONS)$$(MICRO_JAVA_OPTIONS), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   646
    $1_MICRO_VM_OPTIONS := -jvmArgs $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   647
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   648
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   649
  ifneq ($$(MICRO_ITER), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   650
    $1_MICRO_ITER := -i $$(MICRO_ITER)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   651
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   652
  ifneq ($$(MICRO_FORK), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   653
    $1_MICRO_FORK := -f $$(MICRO_FORK)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   654
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   655
  ifneq ($$(MICRO_TIME), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   656
    $1_MICRO_TIME := -r $$(MICRO_TIME)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   657
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   658
  ifneq ($$(MICRO_WARMUP_ITER), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   659
    $1_MICRO_WARMUP_ITER := -wi $$(MICRO_WARMUP_ITER)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   660
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   661
  ifneq ($$(MICRO_WARMUP_TIME), )
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   662
    $1_MICRO_WARMUP_TIME := -w $$(MICRO_WARMUP_TIME)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   663
  endif
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   664
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   665
  run-test-$1:
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   666
	$$(call LogWarn)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   667
	$$(call LogWarn, Running test '$$($1_TEST)')
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   668
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   669
	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/micro, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   670
	    $$($1_MICRO_TEST_JDK)/bin/java $$($1_MICRO_JAVA_OPTIONS) -jar $$($1_MICRO_BENCHMARKS_JAR) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   671
	        $$($1_MICRO_ITER) $$($1_MICRO_FORK) $$($1_MICRO_TIME) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   672
	        $$($1_MICRO_WARMUP_ITER) $$($1_MICRO_WARMUP_TIME) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   673
	        $$($1_MICRO_VM_OPTIONS) $$($1_MICRO_BASIC_OPTIONS) $$(MICRO_OPTIONS)  \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   674
	        $$($1_TEST_NAME) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   675
	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/micro.txt) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   676
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   677
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   678
	)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   679
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   680
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/micro.txt
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   681
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   682
  parse-test-$1: run-test-$1
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   683
	$$(call LogWarn, Finished running test '$$($1_TEST)')
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   684
	$$(call LogWarn, Test report is stored in $$(strip \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   685
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   686
	$$(if $$(wildcard $$($1_EXITCODE)), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   687
	  $$(eval $1_EXIT_CODE := $$(shell $$(CAT) $$($1_EXITCODE))) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   688
	  $$(if $$(filter 0, $$($1_EXIT_CODE)), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   689
	    $$(eval $1_PASSED := 1) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   690
	    $$(eval $1_ERROR := 0) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   691
	  , \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   692
	    $$(eval $1_PASSED := 0) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   693
	    $$(eval $1_ERROR := 1) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   694
	  ) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   695
	  $$(eval $1_FAILED := 0) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   696
	  $$(eval $1_TOTAL := $$(shell \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   697
	      $$(EXPR) $$($1_PASSED) + $$($1_ERROR))) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   698
	, \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   699
	  $$(eval $1_PASSED := 0) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   700
	  $$(eval $1_FAILED := 0) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   701
	  $$(eval $1_ERROR := 1) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   702
	  $$(eval $1_TOTAL := 1) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   703
	)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   704
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   705
  $1: run-test-$1 parse-test-$1
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   706
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   707
  TARGETS += $1
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   708
endef
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   709
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   710
################################################################################
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
   711
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   712
### Rules for Jtreg
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   713
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   714
# Helper function for SetupRunJtregTest. Set a JTREG_* variable from, in order:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   715
# 1) Specified by user on command line
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   716
# 2) Component-specific default
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   717
# 3) Generic default
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   718
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   719
# Note: No spaces are allowed around the arguments.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   720
# Arg $1 The test ID (i.e. $1 in SetupRunJtregTest)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   721
# Arg $2 Base variable, e.g. JTREG_JOBS
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   722
# Arg $3 The default value (optional)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   723
define SetJtregValue
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   724
  ifneq ($$($2), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   725
    $1_$2 := $$($2)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   726
  else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   727
    ifneq ($$($$($1_COMPONENT)_$2), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   728
      $1_$2 := $$($$($1_COMPONENT)_$2)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   729
    else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   730
      ifneq ($3, )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   731
        $1_$2 := $3
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   732
      endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   733
    endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   734
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   735
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   736
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   737
SetupRunJtregTest = $(NamedParamsMacroTemplate)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   738
define SetupRunJtregTestBody
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   739
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   740
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   741
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   742
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   743
  $1_TEST_NAME := $$(strip $$(patsubst jtreg:%, %, $$($1_TEST)))
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   744
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   745
  $1_TEST_ROOT := \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   746
      $$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   747
        $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), $$(root)) \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   748
      ))
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   749
  $1_COMPONENT := $$(lastword $$(subst /, $$(SPACE), $$($1_TEST_ROOT)))
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   750
  # This will work only as long as just hotspot has the additional "jtreg" directory
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   751
  ifeq ($$($1_COMPONENT), jtreg)
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   752
    $1_COMPONENT := hotspot
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   753
  endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   754
45104
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   755
  ifeq ($$(JT_HOME), )
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   756
    $$(info Error: jtreg framework is not found.)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   757
    $$(info Please run configure using --with-jtreg.)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   758
    $$(error Cannot continue)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   759
  endif
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   760
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   761
  # Unfortunately, we need different defaults for some JTREG values,
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   762
  # depending on what component we're running.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   763
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   764
  # Convert JTREG_foo into $1_JTREG_foo with a suitable value.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   765
  $$(eval $$(call SetJtregValue,$1,JTREG_TEST_MODE,agentvm))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   766
  $$(eval $$(call SetJtregValue,$1,JTREG_ASSERT,true))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   767
  $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   768
  $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   769
  $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   770
  $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   771
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   772
  # Only the problem list for the current test root should be used.
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   773
  $1_JTREG_PROBLEM_LIST := $$(filter $$($1_TEST_ROOT)%, $$($1_JTREG_PROBLEM_LIST))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   774
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   775
  ifneq ($(TEST_JOBS), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   776
    $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   777
  else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   778
    $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   779
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   780
47058
85aaac5701da 8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents: 46230
diff changeset
   781
  # Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   782
  # we may end up with a lot of JVM's
47058
85aaac5701da 8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents: 46230
diff changeset
   783
  $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   784
52556
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   785
  # SPARC is in general slower per core so need to scale up timeouts a bit.
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   786
  ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   787
    JTREG_TIMEOUT_FACTOR ?= 8
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   788
  else
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   789
    JTREG_TIMEOUT_FACTOR ?= 4
6b05634db714 8211727: Adjust default concurrency settings for running tests on Sparc
erikj
parents: 52396
diff changeset
   790
  endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   791
  JTREG_VERBOSE ?= fail,error,summary
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   792
  JTREG_RETAIN ?= fail,error
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   793
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   794
  ifneq ($$($1_JTREG_MAX_MEM), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   795
    $1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   796
    $1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   797
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   798
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   799
  $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   800
      -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   801
      -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT_FACTOR) \
47058
85aaac5701da 8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents: 46230
diff changeset
   802
      -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   803
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   804
  $1_JTREG_BASIC_OPTIONS += -automatic -ignore:quiet
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   805
47329
43b33ee91ea0 8189115: Pass JIB_DATA_DIR to jtreg harness
ctornqvi
parents: 47314
diff changeset
   806
  # Make it possible to specify the JIB_DATA_DIR for tests using the
43b33ee91ea0 8189115: Pass JIB_DATA_DIR to jtreg harness
ctornqvi
parents: 47314
diff changeset
   807
  # JIB Artifact resolver
43b33ee91ea0 8189115: Pass JIB_DATA_DIR to jtreg harness
ctornqvi
parents: 47314
diff changeset
   808
  $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   809
  # Some tests needs to find a boot JDK using the JDK8_HOME variable.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   810
  $1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK)
49147
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
   811
  # If running on Windows, propagate the _NT_SYMBOL_PATH to enable
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
   812
  # symbol lookup in hserr files
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
   813
  ifeq ($$(OPENJDK_TARGET_OS), windows)
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
   814
    $1_JTREG_BASIC_OPTIONS += -e:_NT_SYMBOL_PATH
af37d9997bd6 8199197: Set _NT_SYMBOL_PATH when running tests on windows
erikj
parents: 48061
diff changeset
   815
  endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   816
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   817
  $1_JTREG_BASIC_OPTIONS += \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   818
      $$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   819
      $$(addprefix -vmoption:, $$(JTREG_VM_OPTIONS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   820
      #
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   821
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   822
  ifeq ($$($1_JTREG_ASSERT), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   823
    $1_JTREG_BASIC_OPTIONS += -ea -esa
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   824
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   825
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   826
  ifneq ($$($1_JTREG_NATIVEPATH), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   827
    $1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   828
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   829
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   830
  ifneq ($$($1_JTREG_PROBLEM_LIST), )
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   831
    $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$($1_JTREG_PROBLEM_LIST))
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   832
  endif
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   833
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   834
  ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), )
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   835
    # Accept both absolute paths as well as relative to the current test root.
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   836
    $1_JTREG_BASIC_OPTIONS += $$(addprefix -exclude:, $$(wildcard \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   837
        $$(JTREG_EXTRA_PROBLEM_LISTS) \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   838
        $$(addprefix $$($1_TEST_ROOT)/, $$(JTREG_EXTRA_PROBLEM_LISTS)) \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   839
    ))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   840
  endif
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   841
51856
11b9d3a6f31c 8211037: Load jib jars dynamically from JibArtifactManager
erikj
parents: 50908
diff changeset
   842
  ifneq ($$(JIB_HOME), )
11b9d3a6f31c 8211037: Load jib jars dynamically from JibArtifactManager
erikj
parents: 50908
diff changeset
   843
    $1_JTREG_BASIC_OPTIONS += -e:JIB_HOME=$$(JIB_HOME)
46230
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   844
  endif
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   845
50908
7c51db95ccb6 8205207: Port Graal unit tests under jtreg
epavlova
parents: 49147
diff changeset
   846
  $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
7c51db95ccb6 8205207: Port Graal unit tests under jtreg
epavlova
parents: 49147
diff changeset
   847
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   848
  ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   849
    $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   850
  endif
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   851
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   852
  ifneq ($$(JTREG_KEYWORDS), )
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   853
    # The keywords string may contain problematic characters and may be quoted
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   854
    # already when it arrives here. Remove any existing quotes and replace them
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   855
    # with one set of single quotes.
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   856
    $1_JTREG_KEYWORDS := \
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   857
        $$(strip $$(subst $$(SQUOTE),,$$(subst $$(DQUOTE),,$$(JTREG_KEYWORDS))))
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   858
    ifneq ($$($1_JTREG_KEYWORDS), )
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   859
      $1_JTREG_BASIC_OPTIONS += -k:'$$($1_JTREG_KEYWORDS)'
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   860
    endif
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   861
  endif
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   862
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   863
  ifneq ($$(JTREG_AOT_MODULES), )
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   864
    $$(eval $$(call SetupAot, $1, \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   865
        MODULES := $$(JTREG_AOT_MODULES), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   866
        VM_OPTIONS := $$(JTREG_VM_OPTIONS) $$(JTREG_JAVA_OPTIONS), \
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   867
    ))
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   868
  endif
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   869
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   870
  ifneq ($$($1_AOT_OPTIONS), )
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   871
    $1_JTREG_BASIC_OPTIONS += -vmoptions:"$$($1_AOT_OPTIONS)"
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   872
  endif
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   873
47939
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   874
  clean-workdir-$1:
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   875
	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   876
52393
ff10f8f3a583 8152988: [AOT] Update test batch definitions to include aot-ed java.base module mode into hs-comp testing
epavlova
parents: 52342
diff changeset
   877
  run-test-$1: clean-workdir-$1 $$($1_AOT_TARGETS)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   878
	$$(call LogWarn)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   879
	$$(call LogWarn, Running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   880
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   881
	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   882
	    $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   883
	        -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   884
	        $$($1_JTREG_BASIC_OPTIONS) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   885
	        -testjdk:$$(JDK_IMAGE_DIR) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   886
	        -dir:$$(JTREG_TOPDIR) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   887
	        -reportDir:$$($1_TEST_RESULTS_DIR) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   888
	        -workDir:$$($1_TEST_SUPPORT_DIR) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   889
	        $$(JTREG_OPTIONS) \
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   890
	        $$(JTREG_FAILURE_HANDLER_OPTIONS) \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   891
	        $$($1_TEST_NAME) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   892
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   893
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   894
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   895
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   896
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   897
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   898
  parse-test-$1: run-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   899
	$$(call LogWarn, Finished running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   900
	$$(call LogWarn, Test report is stored in $$(strip \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   901
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   902
	$$(if $$(wildcard $$($1_RESULT_FILE)), \
47259
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   903
	  $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   904
	      for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   905
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   906
	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   907
	  $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   908
	      for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   909
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   910
	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   911
	  $$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   912
	      for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   913
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   914
	  $$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   915
	  $$(eval $1_TOTAL := $$(shell \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   916
	      $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   917
	, \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   918
	  $$(eval $1_PASSED := 0) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   919
	  $$(eval $1_FAILED := 0) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   920
	  $$(eval $1_ERROR := 1) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   921
	  $$(eval $1_TOTAL := 1) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   922
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   923
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   924
  $1: run-test-$1 parse-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   925
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   926
  TARGETS += $1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   927
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   928
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   929
################################################################################
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   930
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   931
### Rules for special tests
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   932
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   933
SetupRunSpecialTest = $(NamedParamsMacroTemplate)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   934
define SetupRunSpecialTestBody
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   935
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   936
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   937
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   938
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   939
  $1_FULL_TEST_NAME := $$(strip $$(patsubst special:%, %, $$($1_TEST)))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   940
  ifneq ($$(findstring :, $$($1_FULL_TEST_NAME)), )
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   941
    $1_TEST_NAME := $$(firstword $$(subst :, ,$$($1_FULL_TEST_NAME)))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   942
    $1_TEST_ARGS := $$(strip $$(patsubst special:$$($1_TEST_NAME):%, %, $$($1_TEST)))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   943
  else
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   944
    $1_TEST_NAME := $$($1_FULL_TEST_NAME)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   945
    $1_TEST_ARGS :=
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   946
  endif
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   947
52396
e292e94b448a 8213058: remove ExecuteInternalVMTests and VerboseInternalVMTests flags
iignatyev
parents: 52393
diff changeset
   948
  ifeq ($$($1_TEST_NAME), failure-handler)
52342
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   949
    ifeq ($(BUILD_FAILURE_HANDLER), true)
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   950
      $1_TEST_COMMAND_LINE := \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   951
          ($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f \
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   952
          BuildFailureHandler.gmk test)
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   953
    else
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   954
      $$(error Cannot test failure handler if it is not built)
9341b077bd55 8210958: Rename "make run-test" to "make test"
ihse
parents: 52295
diff changeset
   955
    endif
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   956
  else ifeq ($$($1_TEST_NAME), make)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   957
    $1_TEST_COMMAND_LINE := \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   958
        ($(CD) $(TOPDIR)/test/make && $(MAKE) $(MAKE_ARGS) -f \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   959
        TestMake.gmk $$($1_TEST_ARGS))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   960
  else
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   961
    $$(error Invalid special test specification: $$($1_TEST_NAME))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   962
  endif
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   963
52125
28375a1de254 8212028: Use run-test makefile framework for testing in Oracle's Mach5
erikj
parents: 51856
diff changeset
   964
  run-test-$1: $(TEST_PREREQS)
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   965
	$$(call LogWarn)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   966
	$$(call LogWarn, Running test '$$($1_TEST)')
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   967
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   968
	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/test-execution, \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   969
	    $$($1_TEST_COMMAND_LINE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   970
	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/test-output.txt) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   971
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   972
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   973
	)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   974
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   975
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   976
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   977
  # We can not parse the various "special" tests.
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   978
  parse-test-$1: run-test-$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   979
	$$(call LogWarn, Finished running test '$$($1_TEST)')
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   980
	$$(call LogWarn, Test report is stored in $$(strip \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   981
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   982
	$$(call LogWarn, Warning: Special test results are not properly parsed!)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   983
	$$(eval $1_PASSED := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   984
	$$(eval $1_FAILED := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   985
	$$(eval $1_ERROR := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   986
	$$(eval $1_TOTAL := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   987
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   988
  $1: run-test-$1 parse-test-$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   989
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   990
  TARGETS += $1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   991
endef
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   992
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   993
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   994
# Setup and execute make rules for all selected tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   995
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   996
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   997
# Helper function to determine which handler to use for the given test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   998
UseGtestTestHandler = \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   999
  $(if $(filter gtest:%, $1), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1000
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1001
UseMicroTestHandler = \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1002
  $(if $(filter micro:%, $1), true)
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1003
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1004
UseJtregTestHandler = \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1005
  $(if $(filter jtreg:%, $1), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1006
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1007
UseSpecialTestHandler = \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1008
  $(if $(filter special:%, $1), true)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1009
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1010
# Now process each test to run and setup a proper make rule
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1011
$(foreach test, $(TESTS_TO_RUN), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1012
  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1013
      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1014
  $(eval ALL_TEST_IDS += $(TEST_ID)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1015
  $(if $(call UseCustomTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1016
    $(eval $(call SetupRunCustomTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1017
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1018
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1019
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1020
  $(if $(call UseGtestTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1021
    $(eval $(call SetupRunGtestTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1022
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1023
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1024
  ) \
52595
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1025
  $(if $(call UseMicroTestHandler, $(test)), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1026
    $(eval $(call SetupRunMicroTest, $(TEST_ID), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1027
        TEST := $(test), \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1028
    )) \
16609197022c 8061281: Microbenchmark suite build support, directory layout and sample benchmarks
redestad
parents: 52593
diff changeset
  1029
  ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1030
  $(if $(call UseJtregTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1031
    $(eval $(call SetupRunJtregTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1032
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1033
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1034
  ) \
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1035
  $(if $(call UseSpecialTestHandler, $(test)), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1036
    $(eval $(call SetupRunSpecialTest, $(TEST_ID), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1037
        TEST := $(test), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1038
    )) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
  1039
  ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1040
)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1041
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1042
# Sort also removes duplicates, so if there is any we'll get fewer words.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1043
ifneq ($(words $(ALL_TEST_IDS)), $(words $(sort $(ALL_TEST_IDS))))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1044
  $(error Duplicate test specification)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1045
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1046
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1047
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1048
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1049
# The main target for RunTests.gmk
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1050
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1051
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1052
# The SetupRun*Test functions have populated TARGETS.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1053
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1054
TEST_FAILURE := false
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1055
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1056
run-test: $(TARGETS)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1057
        # Create and print a table of the result of all tests run
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1058
	$(RM) $(TEST_SUMMARY).old 2> /dev/null
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1059
	$(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1060
	$(RM) $(TEST_LAST_IDS).old 2> /dev/null
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1061
	$(MV) $(TEST_LAST_IDS) $(TEST_LAST_IDS).old 2> /dev/null || true
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1062
	$(ECHO) >> $(TEST_SUMMARY) ==============================
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1063
	$(ECHO) >> $(TEST_SUMMARY) Test summary
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1064
	$(ECHO) >> $(TEST_SUMMARY) ==============================
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1065
	$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" "  " \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1066
	    TEST TOTAL PASS FAIL ERROR " "
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1067
	$(foreach test, $(TESTS_TO_RUN), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1068
	  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1069
	      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1070
	    $(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
  1071
	  $(eval NAME_PATTERN := $(shell $(ECHO) $(test) | $(TR) -c '\n' '[_*1000]')) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
  1072
	  $(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
  1073
	    $(eval TEST_NAME := ) \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1074
	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s\n" "  " "$(test)"  $(NEWLINE) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
  1075
	  , \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
  1076
	    $(eval TEST_NAME := $(test)) \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
  1077
	  ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1078
	  $(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1079
	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1080
	        "  " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1081
	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "  " $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1082
	  , \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1083
	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1084
	         ">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1085
	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1086
	    $(eval TEST_FAILURE := true) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1087
	  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1088
	)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1089
	$(ECHO) >> $(TEST_SUMMARY) ==============================
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1090
	$(if $(filter true, $(TEST_FAILURE)), \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1091
	  $(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1092
	  $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1093
	  $(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1094
	, \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1095
	  $(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1096
	)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1097
	$(ECHO)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1098
	$(CAT) $(TEST_SUMMARY)
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
  1099
	$(ECHO)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1100
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1101
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1102
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1103
all: run-test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1104
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
  1105
.PHONY: default all run-test $(TARGETS)