aboutsummaryrefslogtreecommitdiff
path: root/Makefile.programs
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-22 18:39:51 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-22 18:39:51 +0000
commita017b994b6e964241c3e3be7182e798ba85fa6e0 (patch)
tree851c33107b8aeeeea5798140c93d2f1adbe0bfec /Makefile.programs
parente83ca628a2a56f0fe38a3c1e4729507a8fae7a92 (diff)
Tweak USE_REFERENCE_OUTPUT=1 implementation to not fall over when reference outputs are missing.
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@106558 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Makefile.programs')
-rw-r--r--Makefile.programs41
1 files changed, 23 insertions, 18 deletions
diff --git a/Makefile.programs b/Makefile.programs
index fb8d13c2..efb49f4c 100644
--- a/Makefile.programs
+++ b/Makefile.programs
@@ -96,19 +96,6 @@ REFERENCE_OUTPUT_KEY :=
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 @@ $(PROGRAMS_TO_TEST:%=Output/%.LOC.txt): \
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