[llvm-commits] [test-suite] r152995 - in /test-suite/trunk: Makefile.programs RunSafely.sh TimedExec.sh

Daniel Dunbar daniel at zuster.org
Sat Mar 17 10:59:53 PDT 2012


Author: ddunbar
Date: Sat Mar 17 12:59:53 2012
New Revision: 152995

URL: http://llvm.org/viewvc/llvm-project?rev=152995&view=rev
Log:
[test-suite] Change RunSafely to use the timeit --timeout option, instead of
TimedExec.sh.
 - Also eliminate NO_WATCHDOG option, and TimedExec.sh script itself.

Removed:
    test-suite/trunk/TimedExec.sh
Modified:
    test-suite/trunk/Makefile.programs
    test-suite/trunk/RunSafely.sh

Modified: test-suite/trunk/Makefile.programs
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=152995&r1=152994&r2=152995&view=diff
==============================================================================
--- test-suite/trunk/Makefile.programs (original)
+++ test-suite/trunk/Makefile.programs Sat Mar 17 12:59:53 2012
@@ -132,7 +132,7 @@
 RUNSAFELYLOCAL := $(RUNSAFELYLOCAL) -t "$(TIMEIT)"
 
 ifdef NO_WATCHDOG
-RUNSAFELY := $(RUNSAFELY) -nw
+$(warning "NO_WATCHDOG make variable is no longer needed, please remove!")
 endif
 
 RUNSAFELY := $(RUNSAFELY) $(RUNTIMELIMIT) $(EXIT_OK)

Modified: test-suite/trunk/RunSafely.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/RunSafely.sh?rev=152995&r1=152994&r2=152995&view=diff
==============================================================================
--- test-suite/trunk/RunSafely.sh (original)
+++ test-suite/trunk/RunSafely.sh Sat Mar 17 12:59:53 2012
@@ -34,7 +34,6 @@
 #     <client>  is the remote client used to execute the program
 #     <port>    is the port used by the remote client
 #     <under>   is a wrapper that the program is run under
-#     -nw       disables the watchdog timer (allowing hung processes)
 #     <timeout> is the maximum number of seconds to let the <program> run
 #     <exitok>  is 1 if the program must exit with 0 return code
 #     <infile>  is a file from which standard input is directed
@@ -59,7 +58,6 @@
 RPORT=
 RUN_UNDER=
 TIMEIT=time
-WATCHDOG="ON"
 if [ $1 = "-r" ]; then
   RHOST=$2
   shift 2
@@ -84,11 +82,6 @@
   TIMEIT=$2
   shift 2
 fi
-# Please, please remove this option once TimedExec.sh is replaced.
-if [ $1 = "-nw" ]; then
-  WATCHDOG=""
-  shift
-fi
 
 TIMELIMIT=$1
 EXITOK=$2
@@ -141,13 +134,11 @@
 #
 PWD=`pwd`
 COMMAND="$RUN_UNDER $PROGRAM $*"
-if [ -n "$WATCHDOG" ]; then
-  COMMAND="${DIR}TimedExec.sh $TIMELIMIT $PWD $COMMAND"
-fi
 COMMAND=$(echo "$COMMAND" | sed -e 's#"#\\"#g')
 
+TIMEITCMD="$TIMEIT --posix --timeout $TIMELIMIT --chdir $PWD"
 if [ "x$RHOST" = x ] ; then
-  ( sh -c "$ULIMITCMD $TIMEIT -p sh -c '$COMMAND >$OUTFILE 2>&1 < $INFILE; echo exit \$?'" ) 2>&1 \
+  ( sh -c "$ULIMITCMD $TIMEITCMD sh -c '$COMMAND >$OUTFILE 2>&1 < $INFILE; echo exit \$?'" ) 2>&1 \
     | awk -- '\
 BEGIN     { cpu = 0.0; }
 /^user/   { cpu += $2; print; }
@@ -157,7 +148,7 @@
   rm -f "$PWD/${PROG}.command"
   rm -f "$PWD/${PROG}.remote"
   rm -f "$PWD/${PROG}.remote.time"
-  echo "$ULIMITCMD cd $PWD; ($TIMEIT -p sh -c '($COMMAND > $PWD/${OUTFILE}.remote 2>&1 < $INFILE;)'; echo exit \$?) > $PWD/${OUTFILE}.remote.time 2>&1" > "$PWD/${PROG}.command"
+  echo "$ULIMITCMD cd $PWD; ($TIMEITCMD sh -c '($COMMAND > $PWD/${OUTFILE}.remote 2>&1 < $INFILE;)'; echo exit \$?) > $PWD/${OUTFILE}.remote.time 2>&1" > "$PWD/${PROG}.command"
   chmod +x "$PWD/${PROG}.command"
 
   ( $RCLIENT -l $RUSER $RHOST $RPORT "ls $PWD/${PROG}.command" ) > /dev/null 2>&1

Removed: test-suite/trunk/TimedExec.sh
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/TimedExec.sh?rev=152994&view=auto
==============================================================================
--- test-suite/trunk/TimedExec.sh (original)
+++ test-suite/trunk/TimedExec.sh (removed)
@@ -1,45 +0,0 @@
-#!/bin/sh
-#
-# Program:  TimedExec.sh
-#
-# Synopsis: This script is a watchdog wrapper. It runs the specified program
-# but times out if it does not complete in the allocated time frame.
-# Syntax: ./TimedExec.sh <timeout> <dir> <program> <args...>
-#
-
-if [ $# -lt 3 ]; then
-    echo "./TimedExec.sh <timeout> <dir> <program> <args...>"
-    exit 1
-fi
-
-PARENT=""
-if [ "$1" = "-p" ]; then
-    PARENT=$2; shift; shift;
-fi
-
-TIMEOUT=$1
-DIR=$2
-shift 2
-
-if [ -z "$PARENT" ]; then
-    # Start a watchdog process
-    $0 -p $$ $TIMEOUT $* &
-    cd $DIR
-    exec "$@"
-else
-    # Sleep for a specified time then wake up to kill the parent process.
-    exec > /dev/null 2>&1
-    SEC=0
-    while [ $SEC -lt $TIMEOUT ]; do
-        sleep 1
-        # Check if parent has completed.
-        kill -0 $PARENT 2>/dev/null
-        if [ $? -eq 1 ]; then
-            exit 0
-        fi
-        SEC=$(($SEC + 1))
-    done
-    kill $PARENT && (sleep 2; kill -1 $PARENT) && (sleep 2; kill -9 $PARENT)
-fi 
-
-exit 0





More information about the llvm-commits mailing list