[llvm-commits] [test-suite] r91011 - in /test-suite/trunk: Makefile.programs Makefile.tests RunToolSafely.sh
Daniel Dunbar
daniel at zuster.org
Wed Dec 9 16:30:03 PST 2009
Author: ddunbar
Date: Wed Dec 9 18:30:03 2009
New Revision: 91011
URL: http://llvm.org/viewvc/llvm-project?rev=91011&view=rev
Log:
Add RunToolSafely.sh, and use it when running LLVM-tools-under-test. This helps preserve test suite results when the tools fail or crash, and protects us against infinite looping processes.
Added:
test-suite/trunk/RunToolSafely.sh (with props)
Modified:
test-suite/trunk/Makefile.programs
test-suite/trunk/Makefile.tests
Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=91011&r1=91010&r2=91011&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Wed Dec 9 18:30:03 2009
@@ -107,6 +107,8 @@
endif
endif
+RUNTOOLSAFELY := $(PROGDIR)/RunToolSafely.sh $(RUNTIMELIMIT)
+
ifndef STDIN_FILENAME
STDIN_FILENAME := /dev/null
endif
@@ -264,16 +266,16 @@
$(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \
Output/%.linked.bc: Output/%.linked.rbc $(LOPT)
$(VERB) $(RM) -f $(CURDIR)/$@.info
- -$(LOPT) -std-compile-opts -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@
+ $(RUNTOOLSAFELY) $(LOPT) -std-compile-opts -info-output-file=$(CURDIR)/$@.info $(STATS) $(EXTRA_LOPT_OPTIONS) $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.llvm.stripped.bc): \
Output/%.llvm.stripped.bc: Output/%.llvm.bc $(LOPT)
- -$(LOPT) -mstrip $< -o $@
+ $(RUNTOOLSAFELY) $(LOPT) -mstrip $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.linked.optbeta.bc): \
Output/%.linked.optbeta.bc: Output/%.linked.rbc $(LOPT)
$(VERB) $(RM) -f $(CURDIR)/$@.info
- -$(LOPT) $(OPTBETAOPTIONS) -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@
+ $(RUNTOOLSAFELY) $(LOPT) $(OPTBETAOPTIONS) -info-output-file=$(CURDIR)/$@.info $(STATS) $< -o $@
ifndef DISABLE_FOR_LLVM_PROGRAMS
@@ -283,51 +285,51 @@
$(PROGRAMS_TO_TEST:%=Output/%.llvm.bc): \
Output/%.llvm.bc: Output/%.linked.bc $(LLVM_LDDPROG)
- -$(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(EXTRA_LINKTIME_OPT_FLAGS) $(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.llvm
ifneq ($(OPTPASSES),)
- -$(LOPT) -q $(OPTPASSES) $@ -o $@.tmp
+ $(RUNTOOLSAFELY) $(LOPT) -q $(OPTPASSES) $@ -o $@.tmp
$(MV) -f $@.tmp $@
endif
$(PROGRAMS_TO_TEST:%=Output/%.llvm): \
Output/%.llvm: Output/%.linked.bc $(LLVMLDPROG)
- -$(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(EXTRA_LINKTIME_OPT_FLAGS) $(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.llvm
ifneq ($(OPTPASSES),)
- -$(LOPT) -q $(OPTPASSES) $@ -o $@.tmp
+ $(RUNTOOLSAFELY) $(LOPT) -q $(OPTPASSES) $@ -o $@.tmp
$(MV) -f $@.tmp $@
endif
$(PROGRAMS_TO_TEST:%=Output/%.llvm.optbeta.bc): \
Output/%.llvm.optbeta.bc: Output/%.linked.optbeta.bc $(LLVMLDPROG)
- -$(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(EXTRA_LINKTIME_OPT_FLAGS) $(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.llvm.optbeta
$(PROGRAMS_TO_TEST:%=Output/%.llvm.optbeta): \
Output/%.llvm.optbeta: Output/%.linked.optbeta.bc $(LLVMLDPROG)
- -$(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(EXTRA_LINKTIME_OPT_FLAGS) $(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.llvm.optbeta
$(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm.bc): \
Output/%.noopt-llvm.bc: Output/%.linked.rbc $(LLVMLDPROG)
- -$(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.noopt-llvm
$(PROGRAMS_TO_TEST:%=Output/%.noopt-llvm): \
Output/%.noopt-llvm: Output/%.linked.rbc $(LLVMLDPROG)
- -$(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.noopt-llvm
$(PROGRAMS_TO_TEST:%=Output/%.nollvm-ldopt-llvm.bc): \
Output/%.nollvm-ldopt-llvm.bc: Output/%.linked.bc $(LLVMLDPROG)
- -$(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.nollvm-ldopt-llvm
$(PROGRAMS_TO_TEST:%=Output/%.nollvm-ldopt-llvm): \
Output/%.nollvm-ldopt-llvm: Output/%.linked.rbc $(LLVMLDPROG)
- -$(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
+ $(RUNTOOLSAFELY) $(LLVMLD) -disable-opt -info-output-file=$(CURDIR)/$@.info $(STATS) $< \
$(LLVMLD_FLAGS) -lc $(LIBS) -o Output/$*.nollvm-ldopt-llvm
endif # ifndef DISABLE_FOR_LLVM_PROGRAMS
@@ -379,7 +381,7 @@
#
$(PROGRAMS_TO_TEST:%=Output/%.cbe.c): \
Output/%.cbe.c: Output/%.llvm.bc $(LLC)
- -$(LLC) $(LLCFLAGS) -march=c $< -o $@
+ $(RUNTOOLSAFELY) $(LLC) $(LLCFLAGS) -march=c $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.cbe): \
Output/%.cbe: Output/%.cbe.c
@@ -390,15 +392,15 @@
#
$(PROGRAMS_TO_TEST:%=Output/%.llc.s): \
Output/%.llc.s: Output/%.llvm.bc $(LLC)
- -$(LLC) $(LLCFLAGS) $< -o $@
+ $(RUNTOOLSAFELY) $(LLC) $(LLCFLAGS) $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.llc-beta.s): \
Output/%.llc-beta.s: Output/%.llvm.bc $(LLC)
- -$(LLC) $(LLCFLAGS) $(LLCBETAOPTION) $< -o $@
+ $(RUNTOOLSAFELY) $(LLC) $(LLCFLAGS) $(LLCBETAOPTION) $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.opt-beta.s): \
Output/%.opt-beta.s: Output/%.llvm.optbeta.bc $(LLC)
- -$(LLC) $(LLCFLAGS) $< -o $@
+ $(RUNTOOLSAFELY) $(LLC) $(LLCFLAGS) $< -o $@
# On darwin, pass -force_cpusubtype_ALL to allow all ppc instructions.
ifeq ($(ARCH),PowerPC)
@@ -612,11 +614,11 @@
#
$(PROGRAMS_TO_TEST:%=Output/%.llvm-prof.bc): \
Output/%.llvm-prof.bc: Output/%.llvm.bc
- $(LOPT) -insert-edge-profiling $< -o $@
+ $(RUNTOOLSAFELY) $(LOPT) -insert-edge-profiling $< -o $@
$(PROGRAMS_TO_TEST:%=Output/%.printprof): \
Output/%.printprof: Output/%.llvm.bc Output/%.prof $(LPROF)
- $(LPROF) $< Output/$*.prof
+ $(RUNTOOLSAFELY) $(LPROF) $< Output/$*.prof
#
Modified: test-suite/trunk/Makefile.tests
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.tests?rev=91011&r1=91010&r2=91011&view=diff
==============================================================================
--- test-suite/trunk/Makefile.tests (original)
+++ test-suite/trunk/Makefile.tests Wed Dec 9 18:30:03 2009
@@ -39,27 +39,27 @@
# Compile from X.c to Output/X.bc
Output/%.bc: %.c $(LCC1) Output/.dir $(INCLUDES)
- $(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# Compile from X.cpp to Output/X.bc
Output/%.bc: %.cpp $(LCC1XX) Output/.dir $(INCLUDES)
- $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# Compile from X.cc to Output/X.bc
Output/%.bc: %.cc $(LCC1XX) Output/.dir $(INCLUDES)
- $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# Compile from X.C to Output/X.bc
Output/%.bc: %.C $(LCC1XX) Output/.dir $(INCLUDES)
- $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# Compile from X.m to Output/X.bc
Output/%.bc: %.m $(LCC1) Output/.dir $(INCLUDES)
- $(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGCC) $(CPPFLAGS) $(CFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# Compile from X.mm to Output/X.bc
Output/%.bc: %.mm $(LCC1XX) Output/.dir $(INCLUDES)
- $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
+ $(RUNTOOLSAFELY) $(LLVMGXX) $(CPPFLAGS) $(CXXFLAGS) $(LOPTFLAGS) $(TARGET_FLAGS) -c $< -o $@ -emit-llvm
# LLVM Assemble from X.ll to Output/X.bc. Because we are coming directly from
# LLVM source, use the non-transforming assembler.
Added: test-suite/trunk/RunToolSafely.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/RunToolSafely.sh?rev=91011&view=auto
==============================================================================
--- test-suite/trunk/RunToolSafely.sh (added)
+++ test-suite/trunk/RunToolSafely.sh Wed Dec 9 18:30:03 2009
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+set -eu
+
+if [ $# -lt 2 ]; then
+ echo "usage: $0 <timeout> <program> <args...>"
+ echo
+ echo " This script simply runs another program under ulimit and always"
+ echo " returns true. It is used for invoking tools from the LLVM test suite"
+ echo " Makefiles, where we need them to always return true so that we don't"
+ echo " abort the test run."
+ exit 1
+fi
+
+# Save a copy of the original arguments in a string before we
+# clobber them with the shift command.
+TIMEOUT=$1
+shift
+PROGRAM=$1
+shift
+
+SYSTEM=`uname -s`
+
+ULIMITCMD=""
+case $SYSTEM in
+ CYGWIN*)
+ ;;
+ Darwin*)
+ # Disable core file emission, the script doesn't find it anyway because it
+ # is put into /cores.
+ ULIMITCMD="$ULIMITCMD ulimit -c 0;"
+ ULIMITCMD="$ULIMITCMD ulimit -t $TIMEOUT;"
+ # To prevent infinite loops which fill up the disk, specify a limit on size
+ # of files being output by the tests. 10 MB should be enough for anybody. ;)
+ ULIMITCMD="$ULIMITCMD ulimit -f 10485760;"
+ ;;
+ *)
+ ULIMITCMD="$ULIMITCMD ulimit -t $TIMEOUT;"
+ ULIMITCMD="$ULIMITCMD ulimit -c unlimited;"
+ # To prevent infinite loops which fill up the disk, specify a limit on size
+ # of files being output by the tests. 10 MB should be enough for anybody. ;)
+ ULIMITCMD="$ULIMITCMD ulimit -f 10485760;"
+
+ # virtual memory: 300 MB should be enough for anybody. ;)
+ ULIMITCMD="$ULIMITCMD ulimit -v 300000;"
+esac
+
+if ( ! sh -c "$ULIMITCMD sh -c '$PROGRAM $*'" ); then
+ echo "warning: command failed: '$PROGRAM $*'"
+fi
+
+# Always return "successful" so that tests will continue to be run.
+exit 0
Propchange: test-suite/trunk/RunToolSafely.sh
------------------------------------------------------------------------------
svn:executable = *
More information about the llvm-commits
mailing list