[llvm-commits] [test-suite] r153022 - /test-suite/trunk/RunSafely.sh

Daniel Dunbar daniel at zuster.org
Sun Mar 18 12:12:05 PDT 2012


Author: ddunbar
Date: Sun Mar 18 14:12:04 2012
New Revision: 153022

URL: http://llvm.org/viewvc/llvm-project?rev=153022&view=rev
Log:
[test-suite] Update RunSafely to use the --limit arguments to timeit.
 - Simplifies a bunch more goop, we now are down to basically executing only two
   main commands to run tests (the monitor process and the actual target process).
 - Also kill off the random core file handling stuff, this isn't particularly useful.

Modified:
    test-suite/trunk/RunSafely.sh

Modified: test-suite/trunk/RunSafely.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/RunSafely.sh?rev=153022&r1=153021&r2=153022&view=diff
==============================================================================
--- test-suite/trunk/RunSafely.sh (original)
+++ test-suite/trunk/RunSafely.sh Sun Mar 18 14:12:04 2012
@@ -96,64 +96,53 @@
   PROG=`basename ${PROGRAM}`
 fi
 
-ULIMITCMD=""
+LIMITARGS=""
 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 $TIMELIMIT;"
-    # 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 $TIMELIMIT;"
-    ULIMITCMD="$ULIMITCMD ulimit -c unlimited;"
+    # Disable core file emission.
+    LIMITARGS="$LIMITARGS --limit-core 0"
+
+    # Set the CPU limit. We watchdog the process, so this is mostly just for
+    # paranoia.
+    LIMITARGS="$LIMITARGS --limit-cpu $TIMELIMIT"
+
     # 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;"
+    LIMITARGS="$LIMITARGS --limit-file-size 10485760"
 
-    # virtual memory: 400 MB should be enough for anybody. ;)
-    ULIMITCMD="$ULIMITCMD ulimit -v 400000;"
+    # virtual memory: 800 MB should be enough for anybody. ;)
+    LIMITARGS="$LIMITARGS --limit-rss-size 800000000"
 esac
-rm -f core core.*
 
-#
-# 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. Note that the
-# return code of the program is appended to the $OUTFILE on an "Exit Val ="
-# line.
-#
-# 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.
-#
+# Run the command, timing its execution and logging the status summary to
+# $OUTFILE.time.
 PWD=`pwd`
 COMMAND="$RUN_UNDER $PROGRAM $*"
-COMMAND=$(echo "$COMMAND" | sed -e 's#"#\\"#g')
 
-TIMEITCMD="$TIMEIT --timeout $TIMELIMIT --chdir $PWD"
+TIMEITCMD="$TIMEIT $LIMITARGS --timeout $TIMELIMIT --chdir $PWD"
 if [ "x$RHOST" = x ] ; then
   rm -f "$OUTFILE.time"
-  sh -c "$ULIMITCMD $TIMEITCMD --summary $OUTFILE.time --redirect-input $INFILE --redirect-output $OUTFILE $COMMAND"
+  $TIMEITCMD \
+      --summary $OUTFILE.time \
+      --redirect-input $INFILE \
+      --redirect-output $OUTFILE \
+      $COMMAND
 else
   rm -f "$PWD/${PROG}.command"
   rm -f "$PWD/${PROG}.remote"
   rm -f "$PWD/${OUTFILE}.remote.time"
-  echo "$ULIMITCMD cd $PWD; $TIMEITCMD --summary $PWD/$OUTFILE.remote.time --redirect-input $INFILE --redirect-output $PWD/${OUTFILE}.remote $COMMAND" > "$PWD/${PROG}.command"
+  echo "$TIMEITCMD --summary $PWD/$OUTFILE.remote.time --redirect-input $INFILE --redirect-output $PWD/${OUTFILE}.remote $COMMAND" > "$PWD/${PROG}.command"
   chmod +x "$PWD/${PROG}.command"
 
   ( $RCLIENT -l $RUSER $RHOST $RPORT "ls $PWD/${PROG}.command" ) > /dev/null 2>&1
   ( $RCLIENT -l $RUSER $RHOST $RPORT "$PWD/${PROG}.command" )
   cp $PWD/${OUTFILE}.remote.time $OUTFILE.time
-sleep 1
-cp -f $PWD/${OUTFILE}.remote ${OUTFILE}
-rm -f $PWD/${OUTFILE}.remote
-rm -f $PWD/${OUTFILE}.remote.time
+  sleep 1
+  cp -f $PWD/${OUTFILE}.remote ${OUTFILE}
+  rm -f $PWD/${OUTFILE}.remote
+  rm -f $PWD/${OUTFILE}.remote.time
 fi
 
 exitval=`grep '^exit ' $OUTFILE.time | sed -e 's/^exit //'`
@@ -187,22 +176,5 @@
        "$ORIG_ARGS" >> $OUTFILE
 fi
 
-if ls | egrep "^core" > /dev/null
-then
-    # If we are on a sun4u machine (UltraSparc), then the code we're generating
-    # is 64 bit code.  In that case, use gdb-64 instead of gdb.
-    myarch=`uname -m`
-    if [ "$myarch" = "sun4u" ]
-    then
-	GDB="gdb-64"
-    else
-	GDB=gdb
-    fi
-
-    corefile=`ls core* | head -n 1`
-    echo "where 100" > StackTrace.$$
-    $GDB -q -batch --command=StackTrace.$$ --core=$corefile $PROGRAM < /dev/null
-    rm -f StackTrace.$$ $corefile
-fi
 # Always return "successful" so that tests will continue to be run.
 exit 0





More information about the llvm-commits mailing list