make/RunTests.gmk
author dlong
Wed, 06 Dec 2017 18:37:57 -0800
changeset 48200 ed5680f2656a
parent 48061 665769d3cee4
child 49147 af37d9997bd6
child 55956 3c681a5d4ba1
permissions -rw-r--r--
8193009: compiler/c2/Test7029152.java crashes with SIGILL in java.lang.StringLatin1.indexOf with -XX:+UseJVMCICompiler Reviewed-by: iveresov, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     1
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     2
# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     4
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    10
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    15
# accompanied this code).
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    16
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    20
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    23
# questions.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    24
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    25
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    26
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, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    48
    KEYWORDS := JOBS TIMEOUT, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    49
    STRING_KEYWORDS := VM_OPTIONS, \
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
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    63
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    64
# Hook to include the corresponding custom file, if present.
47314
743814386712 8188814: Simplify IncludeCustomExtension
ihse
parents: 47259
diff changeset
    65
$(eval $(call IncludeCustomExtension, RunTests.gmk))
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    66
################################################################################
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    67
47253
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47218
diff changeset
    68
TEST_RESULTS_DIR := $(OUTPUTDIR)/test-results
92fd0e04e0e1 8187544: Replace BUILD_OUTPUT and OUTPUT_ROOT with OUTPUTDIR
ihse
parents: 47218
diff changeset
    69
TEST_SUPPORT_DIR := $(OUTPUTDIR)/test-support
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
    70
TEST_SUMMARY := $(TEST_RESULTS_DIR)/test-summary.txt
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
    71
TEST_LAST_IDS := $(TEST_SUPPORT_DIR)/test-last-ids.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    72
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    73
ifeq ($(CUSTOM_ROOT), )
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    74
  JTREG_TOPDIR := $(TOPDIR)
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    75
else
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    76
  JTREG_TOPDIR := $(CUSTOM_ROOT)
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
    77
endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    78
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    79
JTREG_FAILURE_HANDLER_DIR := $(TEST_IMAGE_DIR)/failure_handler
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    80
JTREG_FAILURE_HANDLER := $(JTREG_FAILURE_HANDLER_DIR)/jtregFailureHandler.jar
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    81
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    82
ifneq ($(wildcard $(JTREG_FAILURE_HANDLER)), )
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    83
  JTREG_FAILURE_HANDLER_OPTIONS := \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    84
      -timeoutHandlerDir:$(JTREG_FAILURE_HANDLER) \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    85
      -observerDir:$(JTREG_FAILURE_HANDLER) \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    86
      -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    87
      -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    88
      -timeoutHandlerTimeout:0
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    89
endif
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
    90
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
    91
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
    92
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
    93
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    94
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    95
# Parse control variables
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    96
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
    97
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    98
ifneq ($(TEST_OPTS), )
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
    99
  # Inform the user
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   100
  $(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
   101
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   102
  $(eval $(call SetTestOpt,VM_OPTIONS,JTREG))
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   103
  $(eval $(call SetTestOpt,VM_OPTIONS,GTEST))
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   104
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   105
  $(eval $(call SetTestOpt,JOBS,JTREG))
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   106
  $(eval $(call SetTestOpt,TIMEOUT,JTREG))
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   107
endif
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   108
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   109
$(eval $(call ParseKeywordVariable, JTREG, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   110
    KEYWORDS := JOBS TIMEOUT TEST_MODE ASSERT VERBOSE RETAIN MAX_MEM, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   111
    STRING_KEYWORDS := OPTIONS JAVA_OPTIONS VM_OPTIONS, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   112
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   113
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   114
ifneq ($(JTREG), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   115
  # Inform the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   116
  $(info Running tests using JTREG control variable '$(JTREG)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   117
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   118
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   119
$(eval $(call ParseKeywordVariable, GTEST, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   120
    KEYWORDS := REPEAT, \
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   121
    STRING_KEYWORDS := OPTIONS VM_OPTIONS, \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   122
))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   123
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   124
ifneq ($(GTEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   125
  # Inform the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   126
  $(info Running tests using GTEST control variable '$(GTEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   127
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   128
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   129
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   130
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   131
# Component-specific Jtreg settings
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   132
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   133
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   134
ifeq ($(TEST_JOBS), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   135
  # If TEST_JOBS is not specified, hotspot fallback default is
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   136
  # min(num_cores / 2, 12).
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   137
  hotspot_JTREG_JOBS := $(shell $(EXPR) $(NUM_CORES) / 2)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   138
  ifeq ($(hotspot_JTREG_JOBS), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   139
    hotspot_JTREG_JOBS := 1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   140
  else ifeq ($(shell $(EXPR) $(hotspot_JTREG_JOBS) \> 12), 1)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   141
    hotspot_JTREG_JOBS := 12
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   142
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   143
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   144
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   145
hotspot_JTREG_MAX_MEM := 0
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   146
hotspot_JTREG_ASSERT := false
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   147
hotspot_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/hotspot/jtreg/native
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   148
jdk_JTREG_NATIVEPATH := $(TEST_IMAGE_DIR)/jdk/jtreg/native
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   149
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   150
jdk_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jdk/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   151
jaxp_JTREG_PROBLEM_LIST += $(TOPDIR)/test/jaxp/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   152
langtools_JTREG_PROBLEM_LIST += $(TOPDIR)/test/langtools/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   153
nashorn_JTREG_PROBLEM_LIST += $(TOPDIR)/test/nashorn/ProblemList.txt
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   154
hotspot_JTREG_PROBLEM_LIST += $(TOPDIR)/test/hotspot/jtreg/ProblemList.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   155
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   156
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   157
# Parse test selection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   158
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   159
# 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
   160
# 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
   161
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   162
# The parse functions take as argument a test specification as given by the
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   163
# 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
   164
# nothing if not. A single test specification can result in multiple test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   165
# descriptors being returned. A valid test descriptor must always be accepted
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   166
# and returned identically.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   167
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   168
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   169
# Helper function to determine if a test specification is a Gtest test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   170
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   171
# 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
   172
# 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
   173
# variant. If no variant is specified, all found variants are tested.
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   174
define ParseGtestTestSelection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   175
  $(if $(filter gtest%, $1), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   176
    $(if $(filter gtest, $1), \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   177
      $(addprefix gtest:all/, $(GTEST_VARIANTS)) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   178
    , \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   179
      $(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
   180
        $(patsubst gtest:/%, gtest:all/%, $(patsubst gtest/%, gtest:/%, $1)) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   181
      , \
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   182
        $(if $(filter gtest:%, $1), \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   183
          $(if $(findstring /, $1), \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   184
            $1 \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   185
          , \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   186
            $(addprefix $1/, $(GTEST_VARIANTS)) \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   187
          ) \
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   188
        ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   189
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   190
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   191
  )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   192
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   193
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   194
# 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
   195
CleanupJtregPath = \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   196
  $(strip $(patsubst %/, %, $(subst $(JTREG_TOPDIR)/,, $1)))
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   197
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   198
# 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
   199
# 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
   200
ExpandJtregRoot = \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   201
  $(call CleanupJtregPath, $(wildcard \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   202
    $(if $(filter /%, $1), \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   203
      $(if $(wildcard $(strip $1)/TEST.ROOT), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   204
        $1 \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   205
      ) \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   206
    , \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   207
      $(filter $(addprefix %, $1), $(JTREG_TESTROOTS) $(addsuffix /, $(JTREG_TESTROOTS))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   208
      $(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
   209
    ) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   210
  ))
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   211
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   212
# 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
   213
# 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
   214
ExpandJtregPath = \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   215
  $(if $(call ExpandJtregRoot, $1), \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   216
    $(call ExpandJtregRoot, $1) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   217
  , \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   218
    $(call CleanupJtregPath, $(wildcard \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   219
      $(if $(filter /%, $1), \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   220
        $1 \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   221
      , \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   222
        $(addsuffix /$(strip $1), $(JTREG_TESTROOTS) $(TEST_BASEDIRS)) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   223
        $(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
   224
      ) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   225
    )) \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   226
  )
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   227
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   228
# Helper function to determine if a test specification is a Jtreg test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   229
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   230
# 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
   231
# 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
   232
# 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
   233
# 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
   234
define ParseJtregTestSelection
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   235
  $(eval TEST_NAME := $(strip $(patsubst jtreg:%, %, $1))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   236
  $(if $(or $(findstring :, $(TEST_NAME)), $(findstring /, $(TEST_NAME))), , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   237
    $(eval TEST_NAME := :$(TEST_NAME)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   238
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   239
  $(if $(findstring :, $(TEST_NAME)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   240
    $(if $(filter :%, $(TEST_NAME)), \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   241
      $(eval TEST_GROUP := $(patsubst :%, %, $(TEST_NAME))) \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   242
      $(eval TEST_ROOTS := $(foreach test_root, $(JTREG_TESTROOTS), \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   243
          $(call CleanupJtregPath, $(test_root)))) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   244
    , \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   245
      $(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
   246
      $(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
   247
      $(eval TEST_ROOTS := $(call ExpandJtregRoot, $(TEST_PATH))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   248
    ) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   249
    $(foreach test_root, $(TEST_ROOTS), \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   250
      $(if $(filter /%, $(test_root)), \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   251
        jtreg:$(test_root):$(TEST_GROUP) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   252
      , \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   253
        $(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
   254
          jtreg:$(test_root):$(TEST_GROUP) \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   255
        ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   256
      ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   257
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   258
  , \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   259
    $(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
   260
    $(foreach test_path, $(TEST_PATHS), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   261
      jtreg:$(test_path) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   262
    ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   263
  )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   264
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   265
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   266
# 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
   267
#
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   268
# It is a special test if it is "special:" followed by a test name.
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   269
define ParseSpecialTestSelection
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   270
  $(if $(filter special:%, $1), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   271
    $1 \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   272
  )
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   273
endef
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   274
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   275
ifeq ($(TEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   276
  $(info No test selection given in TEST!)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   277
  $(info Please use e.g. 'run-test TEST=tier1' or 'run-test-tier1')
47928
fb62d4519338 8191715: Update documentation pointing to "common" directory
ihse
parents: 47329
diff changeset
   278
  $(info See doc/testing.[md|html] for help)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   279
  $(error Cannot continue)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   280
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   281
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   282
# Now intelligently convert the test selection given by the user in TEST
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   283
# into a list of fully qualified test descriptors of the tests to run.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   284
TESTS_TO_RUN :=
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   285
$(foreach test, $(TEST), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   286
  $(eval PARSED_TESTS := $(call ParseCustomTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   287
  $(if $(strip $(PARSED_TESTS)), , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   288
    $(eval PARSED_TESTS += $(call ParseGtestTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   289
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   290
  $(if $(strip $(PARSED_TESTS)), , \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   291
    $(eval PARSED_TESTS += $(call ParseJtregTestSelection, $(test))) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   292
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   293
  $(if $(strip $(PARSED_TESTS)), , \
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   294
    $(eval PARSED_TESTS += $(call ParseSpecialTestSelection, $(test))) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   295
  ) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   296
  $(if $(strip $(PARSED_TESTS)), , \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   297
    $(eval UNKNOWN_TEST := $(test)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   298
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   299
  $(eval TESTS_TO_RUN += $(PARSED_TESTS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   300
)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   301
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   302
ifneq ($(UNKNOWN_TEST), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   303
  $(info Unknown test selection: '$(UNKNOWN_TEST)')
47928
fb62d4519338 8191715: Update documentation pointing to "common" directory
ihse
parents: 47329
diff changeset
   304
  $(info See doc/testing.[md|html] for help)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   305
  $(error Cannot continue)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   306
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   307
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   308
TESTS_TO_RUN := $(strip $(TESTS_TO_RUN))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   309
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   310
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   311
# Present the result of our parsing to the user
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   312
$(info Test selection '$(TEST)', will run:)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   313
$(foreach test, $(TESTS_TO_RUN), $(info * $(test)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   314
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   315
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   316
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   317
# Functions for setting up rules for running the selected tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   318
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   319
# The SetupRun*Test functions all have the same interface:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   320
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   321
# 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
   322
# descriptor, and this is also used as variable prefix, and the targets
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   323
# generated are listed in a variable by that name.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   324
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   325
# Remaining parameters are named arguments. Currently this is only:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   326
#   TEST -- The properly formatted fully qualified test descriptor
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   327
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   328
# After the rule named by the test id has been executed, the following
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   329
# variables will be available:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   330
# testid_TOTAL - the total number of tests run
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   331
# testid_PASSED - the number of successful tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   332
# testid_FAILED - the number of failed tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   333
# testid_ERROR - the number of tests was neither successful or failed
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   334
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   335
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   336
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   337
### Rules for Gtest
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   338
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   339
SetupRunGtestTest = $(NamedParamsMacroTemplate)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   340
define SetupRunGtestTestBody
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   341
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   342
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   343
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   344
48058
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   345
  $1_VARIANT :=  $$(lastword $$(subst /, , $$($1_TEST)))
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   346
  ifeq ($$(filter $$($1_VARIANT), $$(GTEST_VARIANTS)), )
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   347
    $$(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
   348
  endif
c5eefa465e37 8192995: run-test gtest should use all jvm variants, not just "server"
ihse
parents: 48042
diff changeset
   349
  $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
   350
      $$(patsubst gtest:%, %, $$($1_TEST))))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   351
  ifneq ($$($1_TEST_NAME), all)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   352
    $1_GTEST_FILTER := --gtest_filter=$$($1_TEST_NAME)*
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   353
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   354
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   355
  ifneq ($$(GTEST_REPEAT), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   356
    $1_GTEST_REPEAT :=--gtest_repeat=$$(GTEST_REPEAT)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   357
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   358
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   359
  run-test-$1:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   360
	$$(call LogWarn)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   361
	$$(call LogWarn, Running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   362
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   363
	$$(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
   364
	    $$(FIXPATH) $$(TEST_IMAGE_DIR)/hotspot/gtest/$$($1_VARIANT)/gtestLauncher \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   365
	         -jdk $(JDK_IMAGE_DIR) $$($1_GTEST_FILTER) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   366
	         --gtest_output=xml:$$($1_TEST_RESULTS_DIR)/gtest.xml \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   367
	         $$($1_GTEST_REPEAT) $$(GTEST_OPTIONS) $$(GTEST_VM_OPTIONS) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   368
	        > >($(TEE) $$($1_TEST_RESULTS_DIR)/gtest.txt) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   369
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   370
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   371
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   372
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   373
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/gtest.txt
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   374
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   375
  parse-test-$1: run-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   376
	$$(call LogWarn, Finished running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   377
	$$(call LogWarn, Test report is stored in $$(strip \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   378
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   379
	$$(if $$(wildcard $$($1_RESULT_FILE)), \
47956
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   380
	  $$(eval $1_TOTAL := $$(shell $$(AWK) '/==========.* tests? from .* \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   381
	      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
   382
	  $$(if $$($1_TOTAL), , $$(eval $1_TOTAL := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   383
	  $$(eval $1_PASSED := $$(shell $$(AWK) '/\[  PASSED  \] .* tests?./ \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   384
	      { print $$$$4 }' $$($1_RESULT_FILE))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   385
	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   386
	  $$(eval $1_FAILED := $$(shell $$(AWK) '/\[  FAILED  \] .* tests?, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   387
	      listed below/ { print $$$$4 }' $$($1_RESULT_FILE))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   388
	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   389
	  $$(eval $1_ERROR := $$(shell \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   390
	      $$(EXPR) $$($1_TOTAL) - $$($1_PASSED) - $$($1_FAILED))) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   391
	, \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   392
	  $$(eval $1_PASSED := 0) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   393
	  $$(eval $1_FAILED := 0) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   394
	  $$(eval $1_ERROR := 1) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   395
	  $$(eval $1_TOTAL := 1) \
72a474c85aee 8177956: Add TEST_VM_OPTS as convenience for run-test arguments
ihse
parents: 47943
diff changeset
   396
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   397
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   398
  $1: run-test-$1 parse-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   399
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   400
  TARGETS += $1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   401
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   402
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   403
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   404
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   405
### Rules for Jtreg
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   406
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   407
# Helper function for SetupRunJtregTest. Set a JTREG_* variable from, in order:
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   408
# 1) Specified by user on command line
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   409
# 2) Component-specific default
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   410
# 3) Generic default
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   411
#
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   412
# Note: No spaces are allowed around the arguments.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   413
# Arg $1 The test ID (i.e. $1 in SetupRunJtregTest)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   414
# Arg $2 Base variable, e.g. JTREG_JOBS
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   415
# Arg $3 The default value (optional)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   416
define SetJtregValue
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   417
  ifneq ($$($2), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   418
    $1_$2 := $$($2)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   419
  else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   420
    ifneq ($$($$($1_COMPONENT)_$2), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   421
      $1_$2 := $$($$($1_COMPONENT)_$2)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   422
    else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   423
      ifneq ($3, )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   424
        $1_$2 := $3
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   425
      endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   426
    endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   427
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   428
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   429
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   430
SetupRunJtregTest = $(NamedParamsMacroTemplate)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   431
define SetupRunJtregTestBody
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   432
  $1_TEST_RESULTS_DIR := $$(TEST_RESULTS_DIR)/$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   433
  $1_TEST_SUPPORT_DIR := $$(TEST_SUPPORT_DIR)/$1
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   434
  $1_EXITCODE := $$($1_TEST_RESULTS_DIR)/exitcode.txt
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
  $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
   437
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   438
  $1_COMPONENT := \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   439
      $$(strip $$(foreach root, $$(JTREG_TESTROOTS), \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   440
        $$(if $$(filter $$(root)%, $$(JTREG_TOPDIR)/$$($1_TEST_NAME)), \
47932
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   441
          $$(lastword $$(subst /, $$(SPACE), $$(root))) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   442
        ) \
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   443
      ))
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   444
  # 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
   445
  ifeq ($$($1_COMPONENT), jtreg)
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   446
    $1_COMPONENT := hotspot
0c22f6b9b5e2 8191820: Fix run-test jtreg test selection and component calculation
ihse
parents: 47928
diff changeset
   447
  endif
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   448
45104
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   449
  ifeq ($$(JT_HOME), )
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   450
    $$(info Error: jtreg framework is not found.)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   451
    $$(info Please run configure using --with-jtreg.)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   452
    $$(error Cannot continue)
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   453
  endif
b8a6cd8674d1 8180281: --with-jtreg is broken for many use cases
ihse
parents: 44511
diff changeset
   454
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   455
  # Unfortunately, we need different defaults for some JTREG values,
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   456
  # depending on what component we're running.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   457
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   458
  # Convert JTREG_foo into $1_JTREG_foo with a suitable value.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   459
  $$(eval $$(call SetJtregValue,$1,JTREG_TEST_MODE,agentvm))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   460
  $$(eval $$(call SetJtregValue,$1,JTREG_ASSERT,true))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   461
  $$(eval $$(call SetJtregValue,$1,JTREG_MAX_MEM,512m))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   462
  $$(eval $$(call SetJtregValue,$1,JTREG_NATIVEPATH))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   463
  $$(eval $$(call SetJtregValue,$1,JTREG_BASIC_OPTIONS))
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   464
  $$(eval $$(call SetJtregValue,$1,JTREG_PROBLEM_LIST))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   465
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   466
  ifneq ($(TEST_JOBS), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   467
    # User has specified TEST_JOBS, use that as fallback default
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   468
    $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(TEST_JOBS)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   469
  else
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   470
    # Use JOBS as default (except for hotspot)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   471
    $$(eval $$(call SetJtregValue,$1,JTREG_JOBS,$$(JOBS)))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   472
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   473
47058
85aaac5701da 8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents: 46230
diff changeset
   474
  # 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
   475
  # 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
   476
  $1_JTREG_MAX_RAM_PERCENTAGE := $$(shell $$(EXPR) 25 / $$($1_JTREG_JOBS))
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   477
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   478
  JTREG_TIMEOUT ?= 4
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   479
  JTREG_VERBOSE ?= fail,error,summary
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   480
  JTREG_RETAIN ?= fail,error
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   481
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   482
  ifneq ($$($1_JTREG_MAX_MEM), 0)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   483
    $1_JTREG_BASIC_OPTIONS += -vmoption:-Xmx$$($1_JTREG_MAX_MEM)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   484
    $1_JTREG_LAUNCHER_OPTIONS += -Xmx$$($1_JTREG_MAX_MEM)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   485
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   486
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   487
  $1_JTREG_BASIC_OPTIONS += -$$($1_JTREG_TEST_MODE) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   488
      -verbose:$$(JTREG_VERBOSE) -retain:$$(JTREG_RETAIN) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   489
      -concurrency:$$($1_JTREG_JOBS) -timeoutFactor:$$(JTREG_TIMEOUT) \
47058
85aaac5701da 8186248: Allow more flexibility in selecting Heap % of available RAM
bobv
parents: 46230
diff changeset
   490
      -vmoption:-XX:MaxRAMPercentage=$$($1_JTREG_MAX_RAM_PERCENTAGE)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   491
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   492
  $1_JTREG_BASIC_OPTIONS += -automatic -keywords:\!ignore -ignore:quiet
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   493
47329
43b33ee91ea0 8189115: Pass JIB_DATA_DIR to jtreg harness
ctornqvi
parents: 47314
diff changeset
   494
  # 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
   495
  # JIB Artifact resolver
43b33ee91ea0 8189115: Pass JIB_DATA_DIR to jtreg harness
ctornqvi
parents: 47314
diff changeset
   496
  $1_JTREG_BASIC_OPTIONS += -e:JIB_DATA_DIR
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   497
  # Some tests needs to find a boot JDK using the JDK8_HOME variable.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   498
  $1_JTREG_BASIC_OPTIONS += -e:JDK8_HOME=$$(BOOT_JDK)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   499
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   500
  $1_JTREG_BASIC_OPTIONS += \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   501
      $$(addprefix -javaoption:, $$(JTREG_JAVA_OPTIONS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   502
      $$(addprefix -vmoption:, $$(JTREG_VM_OPTIONS)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   503
      #
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   504
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   505
  ifeq ($$($1_JTREG_ASSERT), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   506
    $1_JTREG_BASIC_OPTIONS += -ea -esa
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   507
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   508
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   509
  ifneq ($$($1_JTREG_NATIVEPATH), )
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   510
    $1_JTREG_BASIC_OPTIONS += -nativepath:$$($1_JTREG_NATIVEPATH)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   511
  endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   512
47941
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   513
  ifneq ($$($1_JTREG_PROBLEM_LIST), )
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   514
    $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
   515
  endif
d91b0d2d45cb 8179554: make run-test does not respect ProblemList.txt
ihse
parents: 47939
diff changeset
   516
46230
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   517
  ifneq ($$(JIB_JAR), )
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   518
    $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   519
  endif
e0ca0417b74d 8180600: make run-test does not work with jib test dependencies
erikj
parents: 45104
diff changeset
   520
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   521
  ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   522
    $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   523
  endif
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   524
47939
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   525
  clean-workdir-$1:
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   526
	$$(RM) -r $$($1_TEST_SUPPORT_DIR)
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   527
fe7596497fb0 8179555: make run-test should always use a fresh, clean JTwork directory
ihse
parents: 47938
diff changeset
   528
  run-test-$1: clean-workdir-$1
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   529
	$$(call LogWarn)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   530
	$$(call LogWarn, Running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   531
	$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   532
	$$(call ExecuteWithLog, $$($1_TEST_SUPPORT_DIR)/jtreg, \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   533
	    $$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   534
	        -Dprogram=jtreg -jar $$(JT_HOME)/lib/jtreg.jar \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   535
	        $$($1_JTREG_BASIC_OPTIONS) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   536
	        -testjdk:$$(JDK_IMAGE_DIR) \
47937
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   537
	        -dir:$$(JTREG_TOPDIR) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   538
	        -reportDir:$$($1_TEST_RESULTS_DIR) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   539
	        -workDir:$$($1_TEST_SUPPORT_DIR) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   540
	        $$(JTREG_OPTIONS) \
47986
45c5d7817e9e 8191933: Use failure handler in run-test
ihse
parents: 47956
diff changeset
   541
	        $$(JTREG_FAILURE_HANDLER_OPTIONS) \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   542
	        $$($1_TEST_NAME) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   543
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   544
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   545
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   546
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   547
  $1_RESULT_FILE := $$($1_TEST_RESULTS_DIR)/text/stats.txt
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   548
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   549
  parse-test-$1: run-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   550
	$$(call LogWarn, Finished running test '$$($1_TEST)')
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   551
	$$(call LogWarn, Test report is stored in $$(strip \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   552
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   553
	$$(if $$(wildcard $$($1_RESULT_FILE)), \
47259
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   554
	  $$(eval $1_PASSED := $$(shell $$(AWK) '{ gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   555
	      for (i=1; i<=NF; i++) { if ($$$$i == "passed:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   556
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   557
	  $$(if $$($1_PASSED), , $$(eval $1_PASSED := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   558
	  $$(eval $1_FAILED := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   559
	      for (i=1; i<=NF; i++) { if ($$$$i == "failed:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   560
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   561
	  $$(if $$($1_FAILED), , $$(eval $1_FAILED := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   562
	  $$(eval $1_ERROR := $$(shell $$(AWK) '{gsub(/[,;]/, ""); \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   563
	      for (i=1; i<=NF; i++) { if ($$$$i == "error:") \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   564
	      print $$$$(i+1) } }' $$($1_RESULT_FILE))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   565
	  $$(if $$($1_ERROR), , $$(eval $1_ERROR := 0)) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   566
	  $$(eval $1_TOTAL := $$(shell \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   567
	      $$(EXPR) $$($1_PASSED) + $$($1_FAILED) + $$($1_ERROR))) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   568
	, \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   569
	  $$(eval $1_PASSED := 0) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   570
	  $$(eval $1_FAILED := 0) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   571
	  $$(eval $1_ERROR := 1) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   572
	  $$(eval $1_TOTAL := 1) \
0b347d8efb40 8187672: RunTest displays broken output if jtreg fails completely
ihse
parents: 47253
diff changeset
   573
	)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   574
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   575
  $1: run-test-$1 parse-test-$1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   576
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   577
  TARGETS += $1
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   578
endef
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   579
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   580
################################################################################
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   581
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   582
### Rules for special tests
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   583
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   584
SetupRunSpecialTest = $(NamedParamsMacroTemplate)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   585
define SetupRunSpecialTestBody
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   586
  $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
   587
  $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
   588
  $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
   589
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   590
  $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
   591
  ifneq ($$(findstring :, $$($1_FULL_TEST_NAME)), )
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   592
    $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
   593
    $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
   594
  else
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   595
    $1_TEST_NAME := $$($1_FULL_TEST_NAME)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   596
    $1_TEST_ARGS :=
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   597
  endif
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   598
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   599
  ifeq ($$($1_TEST_NAME), hotspot-internal)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   600
    $1_TEST_COMMAND_LINE := \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   601
        $$(JDK_IMAGE_DIR)/bin/java -XX:+ExecuteInternalVMTests \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   602
        -XX:+ShowMessageBoxOnError -version
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   603
  else ifeq ($$($1_TEST_NAME), failure-handler)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   604
    $1_TEST_COMMAND_LINE := \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   605
        ($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   606
        BuildFailureHandler.gmk test)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   607
  else ifeq ($$($1_TEST_NAME), make)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   608
    $1_TEST_COMMAND_LINE := \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   609
        ($(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
   610
        TestMake.gmk $$($1_TEST_ARGS))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   611
  else
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   612
    $$(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
   613
  endif
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   614
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   615
  run-test-$1:
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   616
	$$(call LogWarn)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   617
	$$(call LogWarn, Running test '$$($1_TEST)')
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   618
	$$(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
   619
	$$(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
   620
	    $$($1_TEST_COMMAND_LINE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   621
	        > >($(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
   622
	    && $$(ECHO) $$$$? > $$($1_EXITCODE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   623
	    || $$(ECHO) $$$$? > $$($1_EXITCODE) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   624
	)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   625
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   626
  $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
   627
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   628
  # 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
   629
  parse-test-$1: run-test-$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   630
	$$(call LogWarn, Finished running test '$$($1_TEST)')
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   631
	$$(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
   632
	    $$(subst $$(TOPDIR)/, , $$($1_TEST_RESULTS_DIR))))
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   633
	$$(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
   634
	$$(eval $1_PASSED := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   635
	$$(eval $1_FAILED := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   636
	$$(eval $1_ERROR := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   637
	$$(eval $1_TOTAL := 0)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   638
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   639
  $1: run-test-$1 parse-test-$1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   640
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   641
  TARGETS += $1
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   642
endef
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   643
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   644
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   645
# Setup and execute make rules for all selected tests
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   646
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   647
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   648
# Helper function to determine which handler to use for the given test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   649
UseGtestTestHandler = \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   650
  $(if $(filter gtest:%, $1), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   651
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   652
UseJtregTestHandler = \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   653
  $(if $(filter jtreg:%, $1), true)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   654
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   655
UseSpecialTestHandler = \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   656
  $(if $(filter special:%, $1), true)
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   657
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   658
# Now process each test to run and setup a proper make rule
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   659
$(foreach test, $(TESTS_TO_RUN), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   660
  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   661
      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   662
  $(eval ALL_TEST_IDS += $(TEST_ID)) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   663
  $(if $(call UseCustomTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   664
    $(eval $(call SetupRunCustomTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   665
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   666
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   667
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   668
  $(if $(call UseGtestTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   669
    $(eval $(call SetupRunGtestTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   670
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   671
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   672
  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   673
  $(if $(call UseJtregTestHandler, $(test)), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   674
    $(eval $(call SetupRunJtregTest, $(TEST_ID), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   675
        TEST := $(test), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   676
    )) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   677
  ) \
48061
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   678
  $(if $(call UseSpecialTestHandler, $(test)), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   679
    $(eval $(call SetupRunSpecialTest, $(TEST_ID), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   680
        TEST := $(test), \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   681
    )) \
665769d3cee4 8193014: Add "special" tests to run-test to cover odd cases
ihse
parents: 48058
diff changeset
   682
  ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   683
)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   684
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   685
# 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
   686
ifneq ($(words $(ALL_TEST_IDS)), $(words $(sort $(ALL_TEST_IDS))))
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   687
  $(error Duplicate test specification)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   688
endif
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   689
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   690
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   691
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   692
# The main target for RunTests.gmk
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   693
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   694
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   695
# The SetupRun*Test functions have populated TARGETS.
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   696
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   697
TEST_FAILURE := false
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   698
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   699
run-test: $(TARGETS)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   700
        # 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
   701
	$(RM) $(TEST_SUMMARY).old 2> /dev/null
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   702
	$(MV) $(TEST_SUMMARY) $(TEST_SUMMARY).old 2> /dev/null || true
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   703
	$(RM) $(TEST_LAST_IDS).old 2> /dev/null
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   704
	$(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
   705
	$(ECHO) >> $(TEST_SUMMARY) ==============================
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   706
	$(ECHO) >> $(TEST_SUMMARY) Test summary
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   707
	$(ECHO) >> $(TEST_SUMMARY) ==============================
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   708
	$(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5s %5s %5s %5s %2s\n" "  " \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   709
	    TEST TOTAL PASS FAIL ERROR " "
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   710
	$(foreach test, $(TESTS_TO_RUN), \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   711
	  $(eval TEST_ID := $(shell $(ECHO) $(strip $(test)) | \
48042
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   712
	      $(TR) -cs '[a-z][A-Z][0-9]\n' '[_*1000]')) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   713
	    $(ECHO) >> $(TEST_LAST_IDS) $(TEST_ID) $(NEWLINE) \
be01bcb72309 8192816: Let run-test save exit code
ihse
parents: 47986
diff changeset
   714
	  $(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
   715
	  $(if $(filter __________________________________________________%, $(NAME_PATTERN)), \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   716
	    $(eval TEST_NAME := ) \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   717
	    $(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
   718
	  , \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   719
	    $(eval TEST_NAME := $(test)) \
c1437939b0d8 8177957: run-test summary lines look bad/misleading with long test names
ihse
parents: 47932
diff changeset
   720
	  ) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   721
	  $(if $(filter $($(TEST_ID)_PASSED), $($(TEST_ID)_TOTAL)), \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   722
	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   723
	        "  " "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   724
	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "  " $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   725
	  , \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   726
	    $(PRINTF) >> $(TEST_SUMMARY) "%2s %-49s %5d %5d %5d %5d %2s\n" \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   727
	         ">>" "$(TEST_NAME)" $($(TEST_ID)_TOTAL) $($(TEST_ID)_PASSED) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   728
	        $($(TEST_ID)_FAILED) $($(TEST_ID)_ERROR) "<<" $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   729
	    $(eval TEST_FAILURE := true) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   730
	  ) \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   731
	)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   732
	$(ECHO) >> $(TEST_SUMMARY) ==============================
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   733
	$(if $(filter true, $(TEST_FAILURE)), \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   734
	  $(ECHO) >> $(TEST_SUMMARY) TEST FAILURE $(NEWLINE) \
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   735
	  $(MKDIR) -p $(MAKESUPPORT_OUTPUTDIR) $(NEWLINE) \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   736
	  $(TOUCH) $(MAKESUPPORT_OUTPUTDIR)/exit-with-error \
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   737
	, \
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   738
	  $(ECHO) >> $(TEST_SUMMARY) TEST SUCCESS \
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   739
	)
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   740
	$(ECHO)
47943
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   741
	$(CAT) $(TEST_SUMMARY)
cece8b7adf10 8191923: Save run-test summary to file
ihse
parents: 47941
diff changeset
   742
	$(ECHO)
44027
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   743
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   744
################################################################################
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   745
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   746
all: run-test
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   747
3a3050924db2 8176084: Developer-friendly run-test facility
ihse
parents:
diff changeset
   748
.PHONY: default all run-test $(TARGETS)