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