[llvm-commits] [test-suite] r105125 - in /test-suite/trunk: HashProgramOutput.sh Makefile.programs

Daniel Dunbar daniel at zuster.org
Sat May 29 17:48:18 PDT 2010


Author: ddunbar
Date: Sat May 29 19:48:18 2010
New Revision: 105125

URL: http://llvm.org/viewvc/llvm-project?rev=105125&view=rev
Log:
Add HASH_PROGRAM_OUTPUT makefile variable, which uses md5sum/md5 to hash the program output before comparing. This is useful for tests which have ridiculously large expected output files (as in, tens of MBs).
 - Currently only enabled with ENABLE_HASHED_PROGRAM_OUTPUT=1.

Added:
    test-suite/trunk/HashProgramOutput.sh   (with props)
Modified:
    test-suite/trunk/Makefile.programs

Added: test-suite/trunk/HashProgramOutput.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/HashProgramOutput.sh?rev=105125&view=auto
==============================================================================
--- test-suite/trunk/HashProgramOutput.sh (added)
+++ test-suite/trunk/HashProgramOutput.sh Sat May 29 19:48:18 2010
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+if [ $# != 1 ]; then
+  echo "$0 <output path>"
+  exit 1
+fi
+
+md5cmd=$(which md5sum)
+if [ ! -x "$md5cmd" ]; then
+    md5cmd=$(which md5)
+    if [ ! -x "$md5cmd" ]; then
+        echo "error: unable to find either 'md5sum' or 'md5'"
+        exit 1
+    fi
+fi
+
+mv $1 $1.bak
+md5 < $1.bak > $1
+rm -f $1.bak

Propchange: test-suite/trunk/HashProgramOutput.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=105125&r1=105124&r2=105125&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Sat May 29 19:48:18 2010
@@ -497,6 +497,13 @@
 JIT_OPTS += -enable-correct-eh-support
 endif
 
+# If the program wants its output hashed, add an output filter.
+ifdef ENABLE_HASHED_PROGRAM_OUTPUT
+ifdef HASH_PROGRAM_OUTPUT
+PROGRAM_OUTPUT_FILTER := $(PROGDIR)/HashProgramOutput.sh
+endif
+endif
+
 native:: $(PROGRAMS_TO_TEST:%=Output/%.native)
 stripped-bytecode:: $(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc)
 
@@ -508,40 +515,67 @@
 $(PROGRAMS_TO_TEST:%=Output/%.out-nat): \
 Output/%.out-nat: Output/%.native
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 endif
 endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-simple): \
 Output/%.out-simple: Output/%.simple
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-lli): \
 Output/%.out-lli: Output/%.llvm.bc $(LLI)
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $(LLI) -info-output-file=$(CURDIR)/$@.info $(STATS) $(LLI_OPTS) $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-jit): \
 Output/%.out-jit: Output/%.llvm.bc $(LLI)
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $(LLI) -info-output-file=$(CURDIR)/$@.info $(STATS) $(JIT_OPTS) $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-jit-beta): \
 Output/%.out-jit-beta: Output/%.llvm.bc $(LLI)
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $(LLI) -info-output-file=$(CURDIR)/$@.info $(STATS) $(LLCBETAOPTION) $(JIT_OPTS) $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-llc): \
 Output/%.out-llc: Output/%.llc
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-llc-beta): \
 Output/%.out-llc-beta: Output/%.llc-beta
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-opt-beta): \
 Output/%.out-opt-beta: Output/%.opt-beta
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 $(PROGRAMS_TO_TEST:%=Output/%.out-cbe): \
 Output/%.out-cbe: Output/%.cbe
 	$(RUNSAFELY) $(STDIN_FILENAME) $@ $< $(RUN_OPTIONS)
+ifdef PROGRAM_OUTPUT_FILTER
+	$(PROGRAM_OUTPUT_FILTER) $@
+endif
 
 # The RunSafely.sh script puts an "exit <retval>" line at the end of
 # the program's output. We have to make bugpoint do the same thing





More information about the llvm-commits mailing list