make/test/BuildFailureHandler.gmk
author vromero
Wed, 21 Feb 2018 00:29:04 -0500
changeset 48926 02404e27d356
parent 47217 72e3ae9a25eb
child 49070 d7859531621b
permissions -rw-r--r--
8198479: JDK build is broken by 8194892 Reviewed-by: sundar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37031
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     1
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     2
# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     4
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    10
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    15
# accompanied this code).
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    16
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    20
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    23
# questions.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    24
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    25
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    26
default: build
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    27
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    28
include $(SPEC)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    29
include MakeBase.gmk
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    30
include JavaCompilation.gmk
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    31
include SetupJavaCompilers.gmk
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    32
include NativeCompilation.gmk
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    33
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    34
TARGETS :=
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    35
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    36
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    37
47217
72e3ae9a25eb 8187444: Forest Consolidation: Make build work
erikj
parents: 37031
diff changeset
    38
FH_BASEDIR := $(TOPDIR)/test/failure_handler
37031
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    39
FH_SUPPORT := $(SUPPORT_OUTPUTDIR)/test/failure_handler
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    40
FH_JAR := $(FH_SUPPORT)/jtregFailureHandler.jar
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    41
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    42
JTREG_JAR := $(JT_HOME)/lib/jtreg.jar
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    43
ifeq ($(wildcard $(JTREG_JAR)), )
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    44
  $(error Cannot build failure handler without jtreg)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    45
endif
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    46
# tools.jar is only needed if it exists in the boot jdk
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    47
TOOLS_JAR := $(wildcard $(BOOT_JDK)/lib/tools.jar)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    48
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    49
FH_CLASSPATH := $(call PathList, $(JTREG_JAR) $(TOOLS_JAR))
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    50
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    51
$(eval $(call SetupJavaCompilation, BUILD_FAILURE_HANDLER, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    52
    SETUP := GENERATE_OLDBYTECODE, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    53
    SRC := $(FH_BASEDIR)/src/share/classes $(FH_BASEDIR)/src/share/conf, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    54
    BIN := $(FH_SUPPORT)/classes, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    55
    COPY := .properties, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    56
    CLASSPATH := $(JTREG_JAR) $(TOOLS_JAR), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    57
    JAR := $(FH_JAR), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    58
))
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    59
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    60
TARGETS += $(BUILD_FAILURE_HANDLER)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    61
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    62
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    63
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    64
ifeq ($(OPENJDK_TARGET_OS), windows)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    65
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    66
  $(eval $(call SetupNativeCompilation, BUILD_LIBTIMEOUT_HANDLER, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    67
        LIBRARY := timeoutHandler, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    68
        SRC := $(FH_BASEDIR)/src/windows/native/libtimeoutHandler, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    69
        OBJECT_DIR := $(FH_SUPPORT)/libtimeoutHandler, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    70
        OUTPUT_DIR := $(FH_SUPPORT), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    71
        CFLAGS := $(CFLAGS_JDKLIB), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    72
        LDFLAGS := $(LDFLAGS_JDKLIB), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    73
        OPTIMIZATION := LOW, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    74
  ))
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    75
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    76
  TARGETS += $(BUILD_LIBTIMEOUT_HANDLER)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    77
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    78
endif
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    79
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    80
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    81
# Targets for building test-image.
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    82
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    83
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    84
# Copy to hotspot jtreg test image
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    85
$(eval $(call SetupCopyFiles, COPY_FH, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    86
    SRC := $(FH_SUPPORT), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    87
    DEST := $(TEST_IMAGE_DIR)/failure_handler, \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    88
    FILES := $(FH_JAR) $(BUILD_LIBTIMEOUT_HANDLER), \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    89
))
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    90
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    91
IMAGES_TARGETS += $(COPY_FH)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    92
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    93
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    94
# Test the failure handler itself
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    95
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    96
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    97
# Use JTREG_TEST_OPTS for test VM options
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    98
# Use JTREG_TESTS for jtreg tests parameter
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
    99
#
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   100
RUN_DIR := $(FH_SUPPORT)/test
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   101
# Add the dir of the dll to the path on windows
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   102
ifeq ($(OPENJDK_TARGET_OS), windows)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   103
  export PATH := $(PATH);$(FH_SUPPORT)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   104
endif
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   105
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   106
test:
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   107
	$(RM) -r $(RUN_DIR)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   108
	$(MKDIR) -p $(RUN_DIR)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   109
	$(CD) $(FH_BASEDIR)/test && JT_JAVA=$(BOOT_JDK) $(JTREGEXE) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   110
	    -jdk:$(BOOT_JDK) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   111
	    $(JTREG_TEST_OPTS) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   112
	    -timeout:0.1 -va -retain:all \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   113
	    -noreport \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   114
	    -agentvm \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   115
	    -thd:$(FH_JAR) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   116
	    -th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   117
	    -od:$(FH_JAR) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   118
	    -o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   119
	    -w:$(RUN_DIR)/JTwork -r:$(RUN_DIR)/JTreport \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   120
	    $(if $(JTREG_TESTS), $(JTREG_TESTS), .) \
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   121
	    || true
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   122
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   123
################################################################################
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   124
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   125
build: $(TARGETS)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   126
images: $(IMAGES_TARGETS)
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   127
e90042bf422d 8149777: Enable enhanced failure handler for "make test"
erikj
parents:
diff changeset
   128
.PHONY: all images test