[llvm-commits] CVS: llvm/test/Programs/RunSafely.sh

John Criswell criswell at choi.cs.uiuc.edu
Wed Jul 2 15:43:00 PDT 2003


Changes in directory llvm/test/Programs:

RunSafely.sh updated: 1.7 -> 1.8

---
Log message:

Modified the time command so that it correctly logs program output in the
correct file and logs time information into the another file.



---
Diffs of the changes:

Index: llvm/test/Programs/RunSafely.sh
diff -u llvm/test/Programs/RunSafely.sh:1.7 llvm/test/Programs/RunSafely.sh:1.8
--- llvm/test/Programs/RunSafely.sh:1.7	Tue Jul  1 13:04:43 2003
+++ llvm/test/Programs/RunSafely.sh	Wed Jul  2 15:42:05 2003
@@ -25,7 +25,19 @@
 ulimit -t $ULIMIT
 rm -f core core.*
 ulimit -c unlimited
-(time -p $PROGRAM $* 2> $OUTFILE > $OUTFILE < $INFILE) 2> $OUTFILE.time
+
+#
+# Run the command, timing its execution.
+# The standard output and standard error of $PROGRAM should go in $OUTFILE,
+# and the standard error of time should go in $OUTFILE.time.
+#
+# Ah, the joys of shell programming!
+# To get the time program and the specified program different output filenames,
+# we tell time to launch a shell which in turn executes $PROGRAM with the
+# necessary I/O redirection.
+#
+(time sh -c "$PROGRAM $* >& $OUTFILE < $INFILE") >& $OUTFILE.time
+
 if test $? -eq 0
 then
   touch $OUTFILE.exitok
@@ -39,4 +51,4 @@
     rm -f StackTrace.$$ $corefile
 fi
 
-exit 0
\ No newline at end of file
+exit 0





More information about the llvm-commits mailing list