24363814 test-and-compare shouldn't redirect output to a file if the command is doing so
--- a/make-rules/ant.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/ant.mk Thu Aug 11 15:38:58 2016 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
#
ANT=/usr/bin/ant
@@ -56,7 +56,8 @@
COMPONENT_SYSTEM_TEST_ENV += JAVA_HOME="$(JAVA_HOME)"
COMPONENT_SYSTEM_TEST_CMD = $(ANT)
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -65,7 +66,7 @@
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -86,7 +87,9 @@
# Test the installed packages. The targets above depend on .built which
# means $(CLONEY) has already run. System-test needs cloning but not
# building; thus ideally, we would want to depend on .cloned here and below,
-# but since we don't have that, we depend on .prep and run $(CLONEY) here.
+# but since we don't have that, we depend on .prep and run $(CLONEY) here. If
+# the output file shows up in the environment or arguments, don't redirect
+# stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -96,7 +99,7 @@
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) \
$(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
--- a/make-rules/configure.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/configure.mk Thu Aug 11 15:38:58 2016 -0700
@@ -197,7 +197,8 @@
$(COMPONENT_POST_INSTALL_ACTION)
$(TOUCH) $@
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -206,7 +207,7 @@
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -224,7 +225,8 @@
$(COMPONENT_TEST_CLEANUP)
$(TOUCH) $@
-# test the installed packages
+# Test the installed packages. If the output file shows up in the environment
+# or arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -233,7 +235,7 @@
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) \
$(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
--- a/make-rules/gem.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/gem.mk Thu Aug 11 15:38:58 2016 -0700
@@ -73,7 +73,8 @@
COMPONENT_TEST_TARGETS =
COMPONENT_SYSTEM_TEST_TARGETS =
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -82,7 +83,7 @@
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -105,7 +106,9 @@
# Test the installed packages. The targets above depend on .built which
# means $(CLONEY) has already run. System-test needs cloning but not
# building; thus ideally, we would want to depend on .cloned here and below,
-# but since we don't have that, we depend on .prep and run $(CLONEY) here.
+# but since we don't have that, we depend on .prep and run $(CLONEY) here. If
+# the output file shows up in the environment or arguments, don't redirect
+# stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -115,7 +118,7 @@
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) \
$(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
--- a/make-rules/justmake.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/justmake.mk Thu Aug 11 15:38:58 2016 -0700
@@ -20,7 +20,7 @@
#
#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
#
#
# Rules and Macros for building opens source software that just uses their
@@ -77,7 +77,8 @@
$(COMPONENT_POST_INSTALL_ACTION)
$(TOUCH) $@
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -86,7 +87,7 @@
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -107,7 +108,9 @@
# Test the installed packages. The targets above depend on .built which
# means $(CLONEY) has already run. System-test needs cloning but not
# building; thus ideally, we would want to depend on .cloned here and below,
-# but since we don't have that, we depend on .prep and run $(CLONEY) here.
+# but since we don't have that, we depend on .prep and run $(CLONEY) here. If
+# the output file shows up in the environment or arguments, don't redirect
+# stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -117,7 +120,7 @@
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) \
$(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
--- a/make-rules/makemaker.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/makemaker.mk Thu Aug 11 15:38:58 2016 -0700
@@ -128,7 +128,8 @@
SYSTEM_TEST_64 = $(BUILD_DIR)/$(MACH64)-5.22/.system-tested-and-compared
endif
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(BUILD_DIR)/%/.built
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -137,7 +138,7 @@
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) \
$(COMPONENT_TEST_ARGS) $(COMPONENT_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -158,7 +159,9 @@
# Test the installed packages. The targets above depend on .built which
# means $(CLONEY) has already run. System-test needs cloning but not
# building; thus ideally, we would want to depend on .cloned here and below,
-# but since we don't have that, we depend on .prep and run $(CLONEY) here.
+# but since we don't have that, we depend on .prep and run $(CLONEY) here. If
+# the output file shows up in the environment or arguments, don't redirect
+# stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(SOURCE_DIR)/.prep
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -168,7 +171,7 @@
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) \
$(COMPONENT_SYSTEM_TEST_ARGS) $(COMPONENT_SYSTEM_TEST_TARGETS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
--- a/make-rules/setup.py.mk Thu Aug 11 09:26:07 2016 -0700
+++ b/make-rules/setup.py.mk Thu Aug 11 15:38:58 2016 -0700
@@ -198,7 +198,8 @@
SYSTEM_TEST_32_and_64 = $(SYSTEM_TEST_64)
endif
-# test the built source
+# Test the built source. If the output file shows up in the environment or
+# arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.tested-and-compared: $(COMPONENT_TEST_DEP)
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -206,7 +207,7 @@
-(cd $(COMPONENT_TEST_DIR) ; \
$(COMPONENT_TEST_ENV_CMD) $(COMPONENT_TEST_ENV) \
$(COMPONENT_TEST_CMD) $(COMPONENT_TEST_ARGS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_TEST_ENV)$(COMPONENT_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)
@@ -223,7 +224,8 @@
$(COMPONENT_TEST_CLEANUP)
$(TOUCH) $@
-# test the installed system
+# Test the installed packages. If the output file shows up in the environment
+# or arguments, don't redirect stdout/stderr to it.
$(BUILD_DIR)/%/.system-tested-and-compared: $(COMPONENT_SYSTEM_TEST_DEP)
$(RM) -rf $(COMPONENT_TEST_BUILD_DIR)
$(MKDIR) $(COMPONENT_TEST_BUILD_DIR)
@@ -233,7 +235,7 @@
-(cd $(COMPONENT_SYSTEM_TEST_DIR) ; \
$(COMPONENT_SYSTEM_TEST_ENV_CMD) $(COMPONENT_SYSTEM_TEST_ENV) \
$(COMPONENT_SYSTEM_TEST_CMD) $(COMPONENT_SYSTEM_TEST_ARGS)) \
- &> $(COMPONENT_TEST_OUTPUT)
+ $(if $(findstring $(COMPONENT_TEST_OUTPUT),$(COMPONENT_SYSTEM_TEST_ENV)$(COMPONENT_SYSTEM_TEST_ARGS)),,&> $(COMPONENT_TEST_OUTPUT))
$(COMPONENT_POST_SYSTEM_TEST_ACTION)
$(COMPONENT_TEST_CREATE_TRANSFORMS)
$(COMPONENT_TEST_PERFORM_TRANSFORM)