[llvm-commits] [test-suite] r106558 - in /test-suite/trunk: External/SPEC/Makefile.spec Makefile.programs

Daniel Dunbar daniel at zuster.org
Tue Jun 22 11:39:51 PDT 2010


Author: ddunbar
Date: Tue Jun 22 13:39:51 2010
New Revision: 106558

URL: http://llvm.org/viewvc/llvm-project?rev=106558&view=rev
Log:
Tweak USE_REFERENCE_OUTPUT=1 implementation to not fall over when reference outputs are missing.

Modified:
    test-suite/trunk/External/SPEC/Makefile.spec
    test-suite/trunk/Makefile.programs

Modified: test-suite/trunk/External/SPEC/Makefile.spec
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/External/SPEC/Makefile.spec?rev=106558&r1=106557&r2=106558&view=diff
==============================================================================
--- test-suite/trunk/External/SPEC/Makefile.spec (original)
+++ test-suite/trunk/External/SPEC/Makefile.spec Tue Jun 22 13:39:51 2010
@@ -56,14 +56,20 @@
 
 else
 
-# In this case, we opt out of generating the native output and just copy it from
-# a reference output. We accept either a generic reference output, or one
-# specific to the current test configuration (i.e., SMALL_PROBLEM_SIZE).
-Output/%.out-nat: $(KEYED_REFERENCE_OUTPUT_FILE) Output/.dir
-	cp $< $@
+# Otherwise, pick the best reference output based on
+# 'progamname.reference_output'.
+#
+# Note that this rule needs to be in both Makefile.programs and Makefile.spec.
+Output/%.out-nat: Output/.dir
+	-if [ -f "$(PROJ_SRC_DIR)/$*.reference_output.$(REFERENCE_OUTPUT_KEY)" ]; then \
+	  cp $(PROJ_SRC_DIR)/$*.reference_output.$(REFERENCE_OUTPUT_KEY) $@; \
+	elif [ -f "$(PROJ_SRC_DIR)/$*.reference_output" ]; then \
+	  cp $(PROJ_SRC_DIR)/$*.reference_output $@; \
+	else \
+	  printf "ERROR: %s: %s\n" "NO REFERENCE OUTPUT" "$(PROJ_SRC_DIR)/$*.reference_output" > $@; \
+	  cat $@; \
+	fi
 
-Output/%.out-nat: $(REFERENCE_OUTPUT_FILE) Output/.dir
-	cp $< $@
 endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-simple): \

Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=106558&r1=106557&r2=106558&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Tue Jun 22 13:39:51 2010
@@ -96,19 +96,6 @@
 endif
 endif
 
-# If the app wants to USE_REFERENCE_OUTPUT, but hasn't specified a file
-# containing the reference output, default to programname.reference_output.
-ifndef REFERENCE_OUTPUT_FILE
-REFERENCE_OUTPUT_FILE = $(PROJ_SRC_DIR)/%.reference_output
-ifeq ($(REFERENCE_OUTPUT_KEY),)
-KEYED_REFERENCE_OUTPUT_FILE = $(PROJ_SRC_DIR)/%.reference_output
-else
-KEYED_REFERENCE_OUTPUT_FILE = $(PROJ_SRC_DIR)/%.reference_output.$(REFERENCE_OUTPUT_KEY)
-endif
-else
-KEYED_REFERENCE_OUTPUT_FILE = $(REFERENCE_OUTPUT_FILE)
-endif
-
 # RUNSAFELY - This program simply runs another program.  If the program works
 # correctly, this script has no effect, otherwise it will do things like print a
 # stack trace of a core dump.  It always returns "successful" so that tests will
@@ -860,16 +847,34 @@
 Output/%.LOC.txt: $(SRCDIR)/%.LOC.txt Output/.dir
 	cp $< $@
 else 
+
+# Rules to support USE_REFERENCE_OUTPUT.
 ifdef USE_REFERENCE_OUTPUT
 
-# In this case, we opt out of generating the native output and just copy it from
-# a reference output. We accept either a generic reference output, or one
-# specific to the current test configuration (i.e., SMALL_PROBLEM_SIZE).
-Output/%.out-nat: $(KEYED_REFERENCE_OUTPUT_FILE) Output/.dir
-	cp $< $@
+# If a reference output file is specified, use that.
+ifdef REFERENCE_OUTPUT_FILE
 
 Output/%.out-nat: $(REFERENCE_OUTPUT_FILE) Output/.dir
 	cp $< $@
+
+else
+
+# Otherwise, pick the best reference output based on
+# 'progamname.reference_output'.
+#
+# Note that this rule needs to be in both Makefile.programs and Makefile.spec.
+Output/%.out-nat: Output/.dir
+	-if [ -f "$(PROJ_SRC_DIR)/$*.reference_output.$(REFERENCE_OUTPUT_KEY)" ]; then \
+	  cp $(PROJ_SRC_DIR)/$*.reference_output.$(REFERENCE_OUTPUT_KEY) $@; \
+	elif [ -f "$(PROJ_SRC_DIR)/$*.reference_output" ]; then \
+	  cp $(PROJ_SRC_DIR)/$*.reference_output $@; \
+	else \
+	  printf "ERROR: %s: %s\n" "NO REFERENCE OUTPUT" "$(PROJ_SRC_DIR)/$*.reference_output" > $@; \
+	  cat $@; \
+	fi
+
+endif
+
 endif
 endif
 





More information about the llvm-commits mailing list