8201320: Allow PrintFailureReports to be turned off
Reviewed-by: erikj
This commit is contained in:
parent
6b803d7d66
commit
6d2a538736
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -226,6 +226,15 @@ else # HAS_SPEC=true
|
|||||||
# Parse COMPARE_BUILD (for makefile development)
|
# Parse COMPARE_BUILD (for makefile development)
|
||||||
$(eval $(call ParseCompareBuild))
|
$(eval $(call ParseCompareBuild))
|
||||||
|
|
||||||
|
# If no LOG= was given on command line, but we have a non-standard default
|
||||||
|
# value, use that instead and re-parse log level.
|
||||||
|
ifeq ($(LOG), )
|
||||||
|
ifneq ($(DEFAULT_LOG), )
|
||||||
|
override LOG := $(DEFAULT_LOG)
|
||||||
|
$(eval $(call ParseLogLevel))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(LOG_NOFILE), true)
|
ifeq ($(LOG_NOFILE), true)
|
||||||
# Disable build log if LOG=[level,]nofile was given
|
# Disable build log if LOG=[level,]nofile was given
|
||||||
override BUILD_LOG_PIPE :=
|
override BUILD_LOG_PIPE :=
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -131,73 +131,6 @@ ifeq ($(HAS_SPEC),)
|
|||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
# Look for a given option in the LOG variable, and if found, set a variable
|
|
||||||
# and remove the option from the LOG variable
|
|
||||||
# $1: The option to look for
|
|
||||||
# $2: The option to set to "true" if the option is found
|
|
||||||
define ParseLogOption
|
|
||||||
ifneq ($$(findstring $1, $$(LOG)),)
|
|
||||||
$2 := true
|
|
||||||
# COMMA is defined in spec.gmk, but that is not included yet
|
|
||||||
COMMA := ,
|
|
||||||
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
|
|
||||||
LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$(strip $1),, $$(LOG)))
|
|
||||||
# We might have ended up with a leading comma. Remove it. Need override
|
|
||||||
# since LOG is set from the command line.
|
|
||||||
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
define ParseLogLevel
|
|
||||||
# Catch old-style VERBOSE= command lines.
|
|
||||||
ifneq ($$(origin VERBOSE), undefined)
|
|
||||||
$$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
|
|
||||||
$$(error Cannot continue)
|
|
||||||
endif
|
|
||||||
|
|
||||||
# Setup logging according to LOG
|
|
||||||
|
|
||||||
# If the "nofile" argument is given, act on it and strip it away
|
|
||||||
$$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
|
|
||||||
|
|
||||||
# If the "cmdline" argument is given, act on it and strip it away
|
|
||||||
$$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
|
|
||||||
|
|
||||||
# If the "profile-to-log" argument is given, write shell times in build log
|
|
||||||
$$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
|
|
||||||
|
|
||||||
# If the "profile" argument is given, write shell times in separate log file
|
|
||||||
# IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
|
|
||||||
# parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
|
|
||||||
# Error: LOG contains unknown option or log level: debug-to-log.
|
|
||||||
$$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
|
|
||||||
|
|
||||||
# Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
|
|
||||||
LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
|
|
||||||
|
|
||||||
LOG_LEVEL := $$(LOG)
|
|
||||||
|
|
||||||
ifeq ($$(LOG_LEVEL),)
|
|
||||||
# Set LOG to "warn" as default if not set
|
|
||||||
LOG_LEVEL := warn
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($$(LOG_LEVEL), warn)
|
|
||||||
MAKE_LOG_FLAGS := -s
|
|
||||||
else ifeq ($$(LOG_LEVEL), info)
|
|
||||||
MAKE_LOG_FLAGS := -s
|
|
||||||
else ifeq ($$(LOG_LEVEL), debug)
|
|
||||||
MAKE_LOG_FLAGS :=
|
|
||||||
else ifeq ($$(LOG_LEVEL), trace)
|
|
||||||
MAKE_LOG_FLAGS :=
|
|
||||||
else
|
|
||||||
$$(info Error: LOG contains unknown option or log level: $$(LOG).)
|
|
||||||
$$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
|
|
||||||
$$(info and <level> is warn | info | debug | trace)
|
|
||||||
$$(error Cannot continue)
|
|
||||||
endif
|
|
||||||
endef
|
|
||||||
|
|
||||||
define ParseConfAndSpec
|
define ParseConfAndSpec
|
||||||
ifneq ($$(origin SPEC), undefined)
|
ifneq ($$(origin SPEC), undefined)
|
||||||
# We have been given a SPEC, check that it works out properly
|
# We have been given a SPEC, check that it works out properly
|
||||||
@ -477,30 +410,38 @@ else # $(HAS_SPEC)=true
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define PrintFailureReports
|
define PrintFailureReports
|
||||||
$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
|
$(if $(filter none, $(LOG_REPORT)), , \
|
||||||
$(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
|
$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
|
||||||
$(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
|
$(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
|
||||||
$(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
|
$(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
|
||||||
($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
|
$(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(NEWLINE) \
|
||||||
if test `$(WC) -l < $(logfile)` -gt 12; then \
|
$(if $(filter all, $(LOG_REPORT)), \
|
||||||
$(ECHO) " ... (rest of output omitted)" ; \
|
$(GREP) -v -e "^Note: including file:" < $(logfile) || true $(NEWLINE) \
|
||||||
fi $(NEWLINE) \
|
, \
|
||||||
|
($(GREP) -v -e "^Note: including file:" < $(logfile) || true) | $(HEAD) -n 12 $(NEWLINE) \
|
||||||
|
if test `$(WC) -l < $(logfile)` -gt 12; then \
|
||||||
|
$(ECHO) " ... (rest of output omitted)" ; \
|
||||||
|
fi $(NEWLINE) \
|
||||||
|
) \
|
||||||
|
) \
|
||||||
|
$(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
|
||||||
|
$(PRINTF) "=== End of repeated output ===\n" \
|
||||||
) \
|
) \
|
||||||
$(PRINTF) "\n* All command lines available in $(MAKESUPPORT_OUTPUTDIR)/failure-logs.\n" $(NEWLINE) \
|
|
||||||
$(PRINTF) "=== End of repeated output ===\n" \
|
|
||||||
)
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define PrintBuildLogFailures
|
define PrintBuildLogFailures
|
||||||
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
|
$(if $(filter none, $(LOG_REPORT)), , \
|
||||||
$(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
|
if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then \
|
||||||
$(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
|
$(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
|
||||||
$(PRINTF) "=== End of repeated output ===\n" ; \
|
$(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
|
||||||
$(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
|
$(PRINTF) "=== End of repeated output ===\n" ; \
|
||||||
else \
|
$(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
|
||||||
$(PRINTF) "\nNo indication of failed target found.\n" ; \
|
else \
|
||||||
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
|
$(PRINTF) "\nNo indication of failed target found.\n" ; \
|
||||||
fi
|
$(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
|
||||||
|
fi \
|
||||||
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define RotateLogFiles
|
define RotateLogFiles
|
||||||
@ -583,8 +524,107 @@ else # $(HAS_SPEC)=true
|
|||||||
|
|
||||||
endif # HAS_SPEC
|
endif # HAS_SPEC
|
||||||
|
|
||||||
|
# Look for a given option in the LOG variable, and if found, set a variable
|
||||||
|
# and remove the option from the LOG variable
|
||||||
|
# $1: The option to look for
|
||||||
|
# $2: The variable to set to "true" if the option is found
|
||||||
|
define ParseLogOption
|
||||||
|
ifneq ($$(findstring $1, $$(LOG)),)
|
||||||
|
override $2 := true
|
||||||
|
# COMMA is defined in spec.gmk, but that is not included yet
|
||||||
|
COMMA := ,
|
||||||
|
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
|
||||||
|
LOG_STRIPPED := $$(subst $1,, $$(subst $$(COMMA)$$(strip $1),, $$(LOG)))
|
||||||
|
# We might have ended up with a leading comma. Remove it. Need override
|
||||||
|
# since LOG is set from the command line.
|
||||||
|
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Look for a given option with an assignment in the LOG variable, and if found,
|
||||||
|
# set a variable to that value and remove the option from the LOG variable
|
||||||
|
# $1: The option to look for
|
||||||
|
# $2: The variable to set to the value of the option, if found
|
||||||
|
define ParseLogValue
|
||||||
|
ifneq ($$(findstring $1=, $$(LOG)),)
|
||||||
|
# Make words of out comma-separated list and find the one with opt=val
|
||||||
|
value := $$(strip $$(subst $$(strip $1)=,, $$(filter $$(strip $1)=%, $$(subst $$(COMMA), , $$(LOG)))))
|
||||||
|
override $2 := $$(value)
|
||||||
|
# COMMA is defined in spec.gmk, but that is not included yet
|
||||||
|
COMMA := ,
|
||||||
|
# First try to remove ",<option>" if it exists, otherwise just remove "<option>"
|
||||||
|
LOG_STRIPPED := $$(subst $$(strip $1)=$$(value),, \
|
||||||
|
$$(subst $$(COMMA)$$(strip $1)=$$(value),, $$(LOG)))
|
||||||
|
# We might have ended up with a leading comma. Remove it. Need override
|
||||||
|
# since LOG is set from the command line.
|
||||||
|
override LOG := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define ParseLogLevel
|
||||||
|
# Catch old-style VERBOSE= command lines.
|
||||||
|
ifneq ($$(origin VERBOSE), undefined)
|
||||||
|
$$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
|
||||||
|
$$(error Cannot continue)
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Setup logging according to LOG
|
||||||
|
|
||||||
|
# If "nofile" is present, do not log to a file
|
||||||
|
$$(eval $$(call ParseLogOption, nofile, LOG_NOFILE))
|
||||||
|
|
||||||
|
# If "cmdline" is present, print all executes "important" command lines.
|
||||||
|
$$(eval $$(call ParseLogOption, cmdlines, LOG_CMDLINES))
|
||||||
|
|
||||||
|
# If "report" is present, use non-standard reporting options at build failure.
|
||||||
|
$$(eval $$(call ParseLogValue, report, LOG_REPORT))
|
||||||
|
ifneq ($$(LOG_REPORT), )
|
||||||
|
ifeq ($$(filter $$(LOG_REPORT), none all default), )
|
||||||
|
$$(info Error: LOG=report has invalid value: $$(LOG_REPORT).)
|
||||||
|
$$(info Valid values: LOG=report=<none>|<all>|<default>)
|
||||||
|
$$(error Cannot continue)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# If "profile-to-log" is present, write shell times in build log
|
||||||
|
$$(eval $$(call ParseLogOption, profile-to-log, LOG_PROFILE_TIMES_LOG))
|
||||||
|
|
||||||
|
# If "profile" is present, write shell times in separate log file
|
||||||
|
# IMPORTANT: $(ParseLogOption profile-to-log) should go first. Otherwise
|
||||||
|
# parsing of 'LOG=debug,profile-to-log,nofile' ends up in the following error:
|
||||||
|
# Error: LOG contains unknown option or log level: debug-to-log.
|
||||||
|
$$(eval $$(call ParseLogOption, profile, LOG_PROFILE_TIMES_FILE))
|
||||||
|
|
||||||
|
# Treat LOG=profile-to-log as if it were LOG=profile,profile-to-log
|
||||||
|
LOG_PROFILE_TIMES_FILE := $$(firstword $$(LOG_PROFILE_TIMES_FILE) $$(LOG_PROFILE_TIMES_LOG))
|
||||||
|
|
||||||
|
override LOG_LEVEL := $$(LOG)
|
||||||
|
|
||||||
|
ifeq ($$(LOG_LEVEL),)
|
||||||
|
# Set LOG to "warn" as default if not set
|
||||||
|
override LOG_LEVEL := warn
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($$(LOG_LEVEL), warn)
|
||||||
|
override MAKE_LOG_FLAGS := -s
|
||||||
|
else ifeq ($$(LOG_LEVEL), info)
|
||||||
|
override MAKE_LOG_FLAGS := -s
|
||||||
|
else ifeq ($$(LOG_LEVEL), debug)
|
||||||
|
override MAKE_LOG_FLAGS :=
|
||||||
|
else ifeq ($$(LOG_LEVEL), trace)
|
||||||
|
override MAKE_LOG_FLAGS :=
|
||||||
|
else
|
||||||
|
$$(info Error: LOG contains unknown option or log level: $$(LOG).)
|
||||||
|
$$(info LOG can be <level>[,<opt>[...]] where <opt> is nofile | cmdlines | profile | profile-to-log)
|
||||||
|
$$(info and <level> is warn | info | debug | trace)
|
||||||
|
$$(error Cannot continue)
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
MAKE_LOG_VARS = $(foreach v, \
|
MAKE_LOG_VARS = $(foreach v, \
|
||||||
LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_PROFILE_TIMES_LOG LOG_PROFILE_TIMES_FILE, \
|
LOG_LEVEL LOG_NOFILE LOG_CMDLINES LOG_REPORT LOG_PROFILE_TIMES_LOG \
|
||||||
|
LOG_PROFILE_TIMES_FILE, \
|
||||||
$v=$($v) \
|
$v=$($v) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1260,6 +1260,24 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_MAKE_TARGET],
|
|||||||
AC_SUBST(DEFAULT_MAKE_TARGET)
|
AC_SUBST(DEFAULT_MAKE_TARGET)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# Setup the default value for LOG=
|
||||||
|
#
|
||||||
|
AC_DEFUN_ONCE([BASIC_SETUP_DEFAULT_LOG],
|
||||||
|
[
|
||||||
|
AC_ARG_WITH(log, [AS_HELP_STRING([--with-log],
|
||||||
|
[[default vaue for make LOG argument [warn]]])])
|
||||||
|
AC_MSG_CHECKING([for default LOG value])
|
||||||
|
if test "x$with_log" = x; then
|
||||||
|
DEFAULT_LOG=""
|
||||||
|
else
|
||||||
|
# Syntax for valid LOG options is a bit too complex for it to be worth
|
||||||
|
# implementing a test for correctness in configure. Just accept it.
|
||||||
|
DEFAULT_LOG=$with_log
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT([$DEFAULT_LOG])
|
||||||
|
AC_SUBST(DEFAULT_LOG)
|
||||||
|
])
|
||||||
|
|
||||||
# Code to run after AC_OUTPUT
|
# Code to run after AC_OUTPUT
|
||||||
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
|
AC_DEFUN_ONCE([BASIC_POST_CONFIG_OUTPUT],
|
||||||
[
|
[
|
||||||
|
@ -120,6 +120,7 @@ PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION
|
|||||||
|
|
||||||
# Misc basic settings
|
# Misc basic settings
|
||||||
BASIC_SETUP_DEFAULT_MAKE_TARGET
|
BASIC_SETUP_DEFAULT_MAKE_TARGET
|
||||||
|
BASIC_SETUP_DEFAULT_LOG
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
|
@ -332,6 +332,7 @@ TEST_JOBS?=@TEST_JOBS@
|
|||||||
|
|
||||||
# Default make target
|
# Default make target
|
||||||
DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@
|
DEFAULT_MAKE_TARGET:=@DEFAULT_MAKE_TARGET@
|
||||||
|
DEFAULT_LOG:=@DEFAULT_LOG@
|
||||||
|
|
||||||
FREETYPE_TO_USE:=@FREETYPE_TO_USE@
|
FREETYPE_TO_USE:=@FREETYPE_TO_USE@
|
||||||
FREETYPE_LIBS:=@FREETYPE_LIBS@
|
FREETYPE_LIBS:=@FREETYPE_LIBS@
|
||||||
|
Loading…
Reference in New Issue
Block a user