test/TestCommon.gmk
author dholmes
Tue, 26 Sep 2017 10:17:35 +0000
changeset 47529 afa019495182
parent 47218 918745561887
child 47285 7513299d1cd0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     1
#
46192
14c55d15c9d7 8174203: Enable AOT Jtreg tests on Windows x86_64
bobv
parents: 42424
diff changeset
     2
# Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     4
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    10
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    15
# accompanied this code).
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    16
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    20
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    23
# questions.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    24
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    25
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    26
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    27
# Common logic to run various tests for a component, to be included by the
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    28
# component specific test makefiles.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    29
#
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    30
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    31
# Default values for some properties that can be overridden by components.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    32
USE_JTREG_VERSION ?= 4.2
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    33
JTREG_VM_TYPE ?= -agentvm
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    34
USE_JTREG_ASSERT ?= true
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    35
LIMIT_JTREG_VM_MEMORY ?= true
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    36
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    37
.DEFAULT : all
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    38
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    39
# Empty these to get rid of some default rules
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    40
.SUFFIXES:
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    41
.SUFFIXES: .java
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    42
CO=
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    43
GET=
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    44
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    45
# Utilities used
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    46
AWK       = awk
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    47
CAT       = cat
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    48
CD        = cd
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    49
CHMOD     = chmod
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    50
CP        = cp
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    51
CUT       = cut
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    52
DIRNAME   = dirname
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    53
ECHO      = echo
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    54
EGREP     = egrep
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    55
EXPAND    = expand
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    56
FIND      = find
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    57
MKDIR     = mkdir
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    58
PWD       = pwd
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    59
RM        = rm -f
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    60
SED       = sed
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    61
SORT      = sort
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    62
TEE       = tee
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    63
UNAME     = uname
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    64
UNIQ      = uniq
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    65
WC        = wc
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    66
ZIPEXE    = zip
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    67
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    68
# Get OS name from uname (Cygwin inexplicably adds _NT-5.1)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    69
UNAME_S := $(shell $(UNAME) -s | $(CUT) -f1 -d_)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    70
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    71
# Commands to run on paths to make mixed paths for java on windows
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    72
ifeq ($(findstring CYGWIN,$(UNAME_S)), CYGWIN)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    73
  # Location of developer shared files
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    74
  SLASH_JAVA = J:
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    75
  GETMIXEDPATH = cygpath -m
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    76
  PLATFORM = windows
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    77
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    78
  # Location of developer shared files
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    79
  SLASH_JAVA = /java
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    80
  GETMIXEDPATH = $(ECHO)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    81
  PLATFORM = unix # we only care about windows or bsd.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    82
  ifeq ($(UNAME_S), Darwin)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    83
    PLATFORM = bsd
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    84
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    85
  ifeq ($(findstring BSD,$(UNAME_S)), BSD)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    86
    PLATFORM = bsd
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    87
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    88
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    89
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    90
ifdef ALT_SLASH_JAVA
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    91
  SLASH_JAVA = $(ALT_SLASH_JAVA)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    92
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    93
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    94
# Root of this test area (important to use full paths in some places)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    95
TEST_ROOT := $(shell $(PWD))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    96
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    97
# Root of all test results
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    98
ifdef TEST_OUTPUT_DIR
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
    99
  $(shell $(MKDIR) -p $(TEST_OUTPUT_DIR)/jtreg)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   100
  ABS_TEST_OUTPUT_DIR := \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   101
    $(shell $(CD) $(TEST_OUTPUT_DIR)/jtreg && $(PWD))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   102
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   103
  ifdef ALT_OUTPUTDIR
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   104
    ABS_OUTPUTDIR = $(shell $(CD) $(ALT_OUTPUTDIR) && $(PWD))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   105
  else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   106
    ABS_OUTPUTDIR = $(shell $(CD) $(TEST_ROOT)/.. && $(PWD))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   107
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   108
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   109
  ABS_PLATFORM_BUILD_ROOT = $(ABS_OUTPUTDIR)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   110
  ABS_TEST_OUTPUT_DIR := $(ABS_PLATFORM_BUILD_ROOT)/testoutput/$(UNIQUE_DIR)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   111
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   112
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   113
# Expect JPRT to set PRODUCT_HOME (the product or jdk in this case to test)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   114
ifndef PRODUCT_HOME
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   115
  # Try to use images/jdk if it exists
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   116
  ABS_JDK_IMAGE = $(ABS_PLATFORM_BUILD_ROOT)/images/jdk
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   117
  PRODUCT_HOME :=                               \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   118
    $(shell                                     \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   119
      if [ -d $(ABS_JDK_IMAGE) ] ; then         \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   120
         $(ECHO) "$(ABS_JDK_IMAGE)";            \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   121
       else                                     \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   122
         $(ECHO) "$(ABS_PLATFORM_BUILD_ROOT)";  \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   123
       fi)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   124
  PRODUCT_HOME := $(PRODUCT_HOME)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   125
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   126
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   127
# Expect JPRT to set JPRT_PRODUCT_ARGS (e.g. -server etc.)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   128
#   Should be passed into 'java' only.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   129
#   Could include: -d64 -server -client OR any java option
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   130
ifdef JPRT_PRODUCT_ARGS
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   131
  JAVA_ARGS = $(JPRT_PRODUCT_ARGS)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   132
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   133
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   134
# Expect JPRT to set JPRT_PRODUCT_VM_ARGS (e.g. -Xcomp etc.)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   135
#   Should be passed into anything running the vm (java, javac, javadoc, ...).
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   136
ifdef JPRT_PRODUCT_VM_ARGS
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   137
  JAVA_VM_ARGS = $(JPRT_PRODUCT_VM_ARGS)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   138
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   139
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   140
ifneq ($(NATIVE_TEST_PATH), )
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   141
  # jtreg -nativepath <dir>
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   142
  #
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   143
  # Local make tests will be TEST_IMAGE_DIR and JPRT with jprt.use.reg.test.bundle=true
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   144
  # should be JPRT_TESTNATIVE_PATH
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   145
  ifdef TEST_IMAGE_DIR
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   146
    TESTNATIVE_DIR = $(TEST_IMAGE_DIR)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   147
  else ifdef JPRT_TESTNATIVE_PATH
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   148
    TESTNATIVE_DIR = $(JPRT_TESTNATIVE_PATH)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   149
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   150
  ifdef TESTNATIVE_DIR
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   151
    JTREG_NATIVE_PATH = -nativepath:$(shell $(GETMIXEDPATH) "$(TESTNATIVE_DIR)/$(NATIVE_TEST_PATH)")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   152
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   153
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   154
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   155
ifeq ($(USE_FAILURE_HANDLER), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   156
  # jtreg failure handler config
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   157
  ifeq ($(FAILURE_HANDLER_DIR), )
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   158
    ifneq ($(TESTNATIVE_DIR), )
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   159
      FAILURE_HANDLER_DIR := $(TESTNATIVE_DIR)/failure_handler
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   160
    endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   161
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   162
  ifneq ($(FAILURE_HANDLER_DIR), )
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   163
    FAILURE_HANDLER_DIR_MIXED := $(shell $(GETMIXEDPATH) "$(FAILURE_HANDLER_DIR)")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   164
    JTREG_FAILURE_HANDLER_OPTIONS := \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   165
        -timeoutHandlerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   166
        -observerDir:$(FAILURE_HANDLER_DIR_MIXED)/jtregFailureHandler.jar \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   167
        -timeoutHandler:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   168
        -observer:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   169
        -timeoutHandlerTimeout:0
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   170
  ifeq ($(PLATFORM), windows)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   171
      JTREG_FAILURE_HANDLER_OPTIONS += -J-Djava.library.path="$(FAILURE_HANDLER_DIR_MIXED)"
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   172
    endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   173
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   174
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   175
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   176
# Expect JPRT to set JPRT_ARCHIVE_BUNDLE (path to zip bundle for results)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   177
ifdef JPRT_ARCHIVE_BUNDLE
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   178
  ARCHIVE_BUNDLE = $(JPRT_ARCHIVE_BUNDLE)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   179
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   180
  ARCHIVE_BUNDLE = $(ABS_TEST_OUTPUT_DIR)/ARCHIVE_BUNDLE.zip
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   181
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   182
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   183
# How to create the test bundle (pass or fail, we want to create this)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   184
#   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   185
ZIP_UP_RESULTS = ( $(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`     \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   186
	           && $(CD) $(ABS_TEST_OUTPUT_DIR)             \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   187
	           && $(CHMOD) -R a+r . \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   188
	           && $(ZIPEXE) -q -r $(ARCHIVE_BUNDLE) . )
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   189
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   190
# important results files
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   191
SUMMARY_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport/text/summary.txt")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   192
STATS_TXT_NAME = Stats.txt
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   193
STATS_TXT = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/$(STATS_TXT_NAME)")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   194
RUNLIST   = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/runlist.txt")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   195
PASSLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/passlist.txt")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   196
FAILLIST  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/faillist.txt")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   197
EXITCODE  = $(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/exitcode.txt")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   198
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   199
TESTEXIT = \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   200
  if [ ! -s $(EXITCODE) ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   201
    $(ECHO) "ERROR: EXITCODE file not filled in."; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   202
    $(ECHO) "1" > $(EXITCODE); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   203
  fi ; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   204
  testExitCode=`$(CAT) $(EXITCODE)`; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   205
  $(ECHO) "EXIT CODE: $${testExitCode}"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   206
  exit $${testExitCode}
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   207
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   208
ifeq ($(TREAT_EXIT_CODE_1_AS_0), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   209
  ADJUST_EXIT_CODE := \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   210
  if [ $${jtregExitCode} = 1 ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   211
    jtregExitCode=0; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   212
  fi
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   213
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   214
  # colon is the shell no-op
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   215
  ADJUST_EXIT_CODE := :
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   216
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   217
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   218
BUNDLE_UP_AND_EXIT = \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   219
( \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   220
  jtregExitCode=$$? && \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   221
  _summary="$(SUMMARY_TXT)"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   222
  $(ADJUST_EXIT_CODE) ; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   223
  $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   224
  $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   225
  if [ -r "$${_summary}" ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   226
    $(ECHO) "Summary: $(UNIQUE_DIR)" > $(STATS_TXT); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   227
    $(EXPAND) $${_summary} | $(EGREP) -v ' Not run\.' > $(RUNLIST); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   228
    $(EGREP) ' Passed\.' $(RUNLIST) \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   229
      | $(EGREP) -v ' Error\.' \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   230
      | $(EGREP) -v ' Failed\.' > $(PASSLIST); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   231
    ( $(EGREP) ' Failed\.' $(RUNLIST); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   232
      $(EGREP) ' Error\.' $(RUNLIST); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   233
      $(EGREP) -v ' Passed\.' $(RUNLIST) ) \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   234
      | $(SORT) | $(UNIQ) > $(FAILLIST); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   235
    if [ $${jtregExitCode} != 0 -o -s $(FAILLIST) ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   236
      $(EXPAND) $(FAILLIST) \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   237
        | $(CUT) -d' ' -f1 \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   238
        | $(SED) -e 's@^@FAILED: @' >> $(STATS_TXT); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   239
      if [ $${jtregExitCode} = 0 ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   240
        jtregExitCode=1; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   241
      fi; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   242
    fi; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   243
    runc="`$(CAT) $(RUNLIST)      | $(WC) -l | $(AWK) '{print $$1;}'`"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   244
    passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   245
    failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   246
    exclc="FIXME CODETOOLS-7900176"; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   247
    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}" \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   248
      >> $(STATS_TXT); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   249
  else \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   250
    $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   251
  fi; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   252
  if [ -f $(STATS_TXT) ] ; then \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   253
    $(CAT) $(STATS_TXT); \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   254
  fi; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   255
  $(ZIP_UP_RESULTS) ; \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   256
  $(TESTEXIT) \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   257
)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   258
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   259
################################################################
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   260
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   261
# Prep for output
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   262
# Change execute permissions on shared library files.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   263
# Files in repositories should never have execute permissions, but
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   264
# there are some tests that have pre-built shared libraries, and these
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   265
# windows dll files must have execute permission. Adding execute
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   266
# permission may happen automatically on windows when using certain
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   267
# versions of mercurial but it cannot be guaranteed. And blindly
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   268
# adding execute permission might be seen as a mercurial 'change', so
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   269
# we avoid adding execute permission to repository files. But testing
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   270
# from a plain source tree needs the chmod a+rx. Applying the chmod to
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   271
# all shared libraries not just dll files. And with CYGWIN and sshd
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   272
# service, you may need CYGWIN=ntsec for this to work.
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   273
prep:
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   274
	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   275
	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   276
	@if [ ! -d $(TEST_ROOT)/../.hg ] ; then                                   \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   277
	  $(FIND) $(TEST_ROOT) \( -name \*.dll -o -name \*.DLL -o -name \*.so \)  \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   278
	        -exec $(CHMOD) a+rx {} \; ;                                       \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   279
	fi
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   280
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   281
ifeq ($(CLEAN_BEFORE_PREP), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   282
prep: clean
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   283
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   284
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   285
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   286
# Cleanup
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   287
clean:
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   288
	@$(RM) -r $(ABS_TEST_OUTPUT_DIR)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   289
	@$(RM) $(ARCHIVE_BUNDLE)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   290
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   291
################################################################
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   292
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   293
# jtreg tests
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   294
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   295
# Expect JT_HOME to be set for jtreg tests. (home for jtreg)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   296
ifndef JT_HOME
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   297
  JT_HOME = $(SLASH_JAVA)/re/jtreg/$(USE_JTREG_VERSION)/promoted/latest/binaries/jtreg
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   298
  ifdef JPRT_JTREG_HOME
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   299
    JT_HOME = $(JPRT_JTREG_HOME)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   300
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   301
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   302
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   303
# Problematic tests to be excluded
47218
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 46248
diff changeset
   304
PROBLEM_LISTS=$(call MixedDirs,$(wildcard ProblemList.txt))
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   305
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   306
# Create exclude list for this platform and arch
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   307
ifdef NO_EXCLUDES
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   308
  JTREG_EXCLUSIONS =
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   309
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   310
  JTREG_EXCLUSIONS = $(PROBLEM_LISTS:%=-exclude:%)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   311
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   312
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   313
# convert list of directories to dos paths
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   314
define MixedDirs
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   315
$(foreach i,$1,$(shell $(GETMIXEDPATH) "${i}"))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   316
endef
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   317
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   318
# ------------------------------------------------------------------
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   319
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   320
# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   321
ifdef TESTDIRS
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   322
  TEST_SELECTION = $(TESTDIRS)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   323
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   324
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   325
ifdef CONCURRENCY
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   326
  JTREG_BASIC_OPTIONS += -concurrency:$(CONCURRENCY)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   327
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   328
ifdef EXTRA_JTREG_OPTIONS
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   329
  JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   330
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   331
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   332
# Default JTREG to run
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   333
JTREG = $(JT_HOME)/bin/jtreg
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   334
# run in agentvm/othervm mode
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   335
JTREG_BASIC_OPTIONS += $(JTREG_VM_TYPE)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   336
# Only run automatic tests
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   337
JTREG_BASIC_OPTIONS += -a
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   338
# Always turn on assertions
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   339
ifeq ($(USE_JTREG_ASSERT), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   340
  JTREG_ASSERT_OPTION = -ea -esa
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   341
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   342
JTREG_BASIC_OPTIONS += $(JTREG_ASSERT_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   343
# jtreg verbosity setting
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   344
# Default is to report details on all failed or error tests, times too
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   345
JTREG_VERBOSE ?= fail,error,time
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   346
JTREG_BASIC_OPTIONS += $(if $(JTREG_VERBOSE),-v:$(JTREG_VERBOSE))
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   347
# Retain all files for failing tests
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   348
JTREG_BASIC_OPTIONS += -retain:fail,error
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   349
# Ignore tests are not run and completely silent about it
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   350
JTREG_IGNORE_OPTION = -ignore:quiet
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   351
JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   352
# Multiply by 4 the timeout factor
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   353
JTREG_TIMEOUT_OPTION =  -timeoutFactor:4
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   354
JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   355
ifeq ($(LIMIT_JTREG_VM_MEMORY), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   356
  # Set the max memory for jtreg control vm
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   357
  JTREG_MEMORY_OPTION = -J-Xmx512m
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   358
  JTREG_BASIC_OPTIONS += $(JTREG_MEMORY_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   359
  # Set the max memory for jtreg target test vms
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   360
  JTREG_TESTVM_MEMORY_OPTION = -vmoption:-Xmx512m
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   361
  JTREG_TEST_OPTIONS += $(JTREG_TESTVM_MEMORY_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   362
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   363
# Give tests access to JT_JAVA, see JDK-8141609
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   364
JTREG_BASIC_OPTIONS += -e:JDK8_HOME=${JT_JAVA}
46192
14c55d15c9d7 8174203: Enable AOT Jtreg tests on Windows x86_64
bobv
parents: 42424
diff changeset
   365
# Give aot tests access to Visual Studio installation
14c55d15c9d7 8174203: Enable AOT Jtreg tests on Windows x86_64
bobv
parents: 42424
diff changeset
   366
ifneq ($(VS120COMNTOOLS), )
14c55d15c9d7 8174203: Enable AOT Jtreg tests on Windows x86_64
bobv
parents: 42424
diff changeset
   367
  JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS=$(shell $(GETMIXEDPATH) "$(VS120COMNTOOLS)")
14c55d15c9d7 8174203: Enable AOT Jtreg tests on Windows x86_64
bobv
parents: 42424
diff changeset
   368
endif
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   369
# Set other vm and test options
46248
5a6c03b61979 8184772: Make it possible to pass arguments only to the Java running the tests when running jtreg through make
ctornqvi
parents: 46196
diff changeset
   370
JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
46196
822ca950ddaa 8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents: 46193
diff changeset
   371
ifneq ($(JIB_JAR), )
822ca950ddaa 8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents: 46193
diff changeset
   372
  JTREG_BASIC_OPTIONS += -cpa:$(shell $(GETMIXEDPATH) "$(JIB_JAR)")
822ca950ddaa 8175300: Enable artifact resolution for jtreg tests
ctornqvi
parents: 46193
diff changeset
   373
endif
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   374
ifeq ($(IGNORE_MARKED_TESTS), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   375
  # Option to tell jtreg to not run tests marked with "ignore"
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   376
  ifeq ($(PLATFORM), windows)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   377
    JTREG_KEY_OPTION = -k:!ignore
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   378
  else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   379
    JTREG_KEY_OPTION = -k:\!ignore
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   380
  endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   381
  JTREG_BASIC_OPTIONS += $(JTREG_KEY_OPTION)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   382
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   383
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   384
# Make sure jtreg exists
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   385
ifeq ($(USE_WINDOWS_EXISTENCE_CHECK), true)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   386
  jtreg_exists:
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   387
	test -d $(shell $(GETMIXEDPATH) "$(JT_HOME)")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   388
	test -f $(shell $(GETMIXEDPATH) "$(JTREG)")
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   389
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   390
else
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   391
  jtreg_exists: $(JT_HOME)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   392
endif
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   393
PHONY_LIST += jtreg_exists
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   394
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   395
# Run jtreg
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   396
jtreg_tests: prep jtreg_exists $(PRODUCT_HOME)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   397
	(                                                                    \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   398
	  ( JT_HOME=$(shell $(GETMIXEDPATH) "$(JT_HOME)");                   \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   399
	    export JT_HOME;                                                  \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   400
	    $(shell $(GETMIXEDPATH) "$(JTREG)")                              \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   401
	      $(JTREG_BASIC_OPTIONS)                                         \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   402
	      -r:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTreport")  \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   403
	      -w:$(shell $(GETMIXEDPATH) "$(ABS_TEST_OUTPUT_DIR)/JTwork")    \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   404
	      -jdk:$(shell $(GETMIXEDPATH) "$(PRODUCT_HOME)")                \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   405
	      $(JTREG_NATIVE_PATH)                                           \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   406
	      $(JTREG_FAILURE_HANDLER_OPTIONS)                               \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   407
	      $(JTREG_EXCLUSIONS)                                            \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   408
	      $(JTREG_TEST_OPTIONS)                                          \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   409
	      $(TEST_SELECTION)                                              \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   410
	  ) ;                                                                \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   411
	  $(BUNDLE_UP_AND_EXIT)                                              \
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   412
	) 2>&1 | $(TEE) $(ABS_TEST_OUTPUT_DIR)/output.txt ; $(TESTEXIT)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   413
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   414
PHONY_LIST += jtreg_tests
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   415
47218
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 46248
diff changeset
   416
# Make it possible to call this with <component>_jtreg_tests
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 46248
diff changeset
   417
%_jtreg_tests: jtreg_tests
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 46248
diff changeset
   418
	# Must have a fake recipe here to prevent make from matching any other rule
918745561887 8187445: Forest Consolidation: Make tests work
erikj
parents: 46248
diff changeset
   419
42424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   420
################################################################
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   421
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   422
# Phony targets (e.g. these are not filenames)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   423
.PHONY: all clean prep $(PHONY_LIST)
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   424
2ac2a6ef14a6 8170629: Remove code duplication in test makefiles
ihse
parents:
diff changeset
   425
################################################################