8173120: Preserve command line at build failure
authorihse
Fri, 20 Jan 2017 14:44:17 +0100
changeset 43173 5212680a318b
parent 43172 8c1bd20e4f45
child 43174 e373bf7f548d
8173120: Preserve command line at build failure Reviewed-by: erikj
make/InitSupport.gmk
make/common/MakeBase.gmk
--- a/make/InitSupport.gmk	Wed Jan 18 20:36:15 2017 +0300
+++ b/make/InitSupport.gmk	Fri Jan 20 14:44:17 2017 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -460,27 +460,28 @@
   endef
 
   define PrintFailureReports
-	$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*), \
-	  $(PRINTF) "=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
-	  $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*)), \
+	$(if $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log), \
+	  $(PRINTF) "\n=== Output from failing command(s) repeated here ===\n" $(NEWLINE) \
+	  $(foreach logfile, $(sort $(wildcard $(MAKESUPPORT_OUTPUTDIR)/failure-logs/*.log)), \
 	      $(PRINTF) "* For target $(notdir $(basename $(logfile))):\n" $(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" \
 	)
   endef
 
   define PrintBuildLogFailures
 	if $(GREP) -q "recipe for target .* failed" $(BUILD_LOG) 2> /dev/null; then  \
-	  $(PRINTF) "=== Make failure sequence repeated here ===\n" ; \
+	  $(PRINTF) "\n=== Make failed targets repeated here ===\n" ; \
 	  $(GREP) "recipe for target .* failed" $(BUILD_LOG) ; \
 	  $(PRINTF) "=== End of repeated output ===\n" ; \
-	  $(PRINTF) "Hint: Try searching the build log for the name of the first failed target.\n" ; \
+	  $(PRINTF) "\nHint: Try searching the build log for the name of the first failed target.\n" ; \
 	else \
-	  $(PRINTF) "No indication of failed target found.\n" ; \
+	  $(PRINTF) "\nNo indication of failed target found.\n" ; \
 	  $(PRINTF) "Hint: Try searching the build log for '] Error'.\n" ; \
 	fi
   endef
--- a/make/common/MakeBase.gmk	Wed Jan 18 20:36:15 2017 +0300
+++ b/make/common/MakeBase.gmk	Fri Jan 20 14:44:17 2017 +0100
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -862,6 +862,7 @@
   ( $(strip $2) > >($(TEE) $(strip $1).log) 2> >($(TEE) $(strip $1).log >&2) || \
       ( exitcode=$(DOLLAR)? && \
       $(CP) $(strip $1).log $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).log && \
+      $(CP) $(strip $1).cmdline $(MAKESUPPORT_OUTPUTDIR)/failure-logs/$(subst /,_,$(patsubst $(BUILD_OUTPUT)/%,%,$(strip $1))).cmdline && \
       exit $(DOLLAR)exitcode ) )
 
 ################################################################################