Capture timing information and stdout/stderr to a file
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@6085 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/RunSafely.sh b/RunSafely.sh
index f05e850..9bf8b53 100755
--- a/RunSafely.sh
+++ b/RunSafely.sh
@@ -7,15 +7,20 @@
# like print a stack trace of a core dump. It always returns
# "successful" so that tests will continue to be run.
#
-# Syntax: ./RunSafely.sh <program> <arguments>
+# This script funnels stdout and stderr from the program into the
+# first argument specified, and outputs a <outputfile>.time file which
+# contains a timing of the program.
#
-
+# Syntax: ./RunSafely.sh <outputfile> <program> <arguments>
+#
+OUTFILE=$1
+shift
PROGRAM=$1
shift
-rm -f core*
+rm -f core core.*
ulimit -c hard
-$PROGRAM $*
+(time -p $PROGRAM $* > $OUTFILE 2>&1) 2> $OUTFILE.time
if ls | egrep "^core" > /dev/null
then
corefile=`ls core* | head -1`