[llvm-commits] CVS: llvm-test/Makefile.programs RunSafely.sh TimedExec.sh

Evan Cheng evan.cheng at apple.com
Thu May 3 14:32:56 PDT 2007



Changes in directory llvm-test:

Makefile.programs updated: 1.264 -> 1.265
RunSafely.sh updated: 1.27 -> 1.28
TimedExec.sh updated: 1.5 -> 1.6
---
Log message:

Added support to do remote execution using rsh. e.g.
make TARGET_LLCFLAGS="-mcpu=armcpuname" TARGET_ARCH=arm REMOTE_HOST=board REMOTE_USER=id

TARGET_ARCH=<> specifies the arch. of the target (i.e. remote host), e.g. arm, x86
TARGET_LLCFLAGS=<> specifies additional flags passed to llc, e.g. --enable-tail-merge
REMOTE_HOST=<> specifies the remote host name where the programs are being run
REMOTE_USER=<> specifies the account user id on the remote host (passed along by rsh -l).


---
Diffs of the changes:  (+72 -13)

 Makefile.programs |   31 ++++++++++++++++++++++++++++---
 RunSafely.sh      |   44 ++++++++++++++++++++++++++++++++++++++------
 TimedExec.sh      |   10 ++++++----
 3 files changed, 72 insertions(+), 13 deletions(-)


Index: llvm-test/Makefile.programs
diff -u llvm-test/Makefile.programs:1.264 llvm-test/Makefile.programs:1.265
--- llvm-test/Makefile.programs:1.264	Wed Mar 28 03:31:17 2007
+++ llvm-test/Makefile.programs	Thu May  3 16:32:39 2007
@@ -88,10 +88,18 @@
 else
 EXIT_OK := 0
 endif
-ifndef GET_STABLE_NUMBERS
-RUNSAFELY := $(PROGDIR)/RunSafely.sh $(RUNTIMELIMIT) $(EXIT_OK)
-else
+ifdef GET_STABLE_NUMBERS
 RUNSAFELY := $(PROGDIR)/RunSafelyAndStable.sh $(RUNTIMELIMIT) $(EXIT_OK)
+else
+ifdef REMOTE_HOST
+ifdef REMOTE_USER
+RUNSAFELY := $(PROGDIR)/RunSafely.sh -r $(REMOTE_HOST) -l $(REMOTE_USER) $(RUNTIMELIMIT) $(EXIT_OK)
+else
+RUNSAFELY := $(PROGDIR)/RunSafely.sh -r $(REMOTE_HOST) $(RUNTIMELIMIT) $(EXIT_OK)
+endif
+else
+RUNSAFELY := $(PROGDIR)/RunSafely.sh $(RUNTIMELIMIT) $(EXIT_OK)
+endif
 endif
 
 # LLVMGCCLD - This sets up the command to use for linking test programs
@@ -229,6 +237,9 @@
 ifeq ($(ARCH),Sparc)
 LLCBETAOPTION := -enable-sparc-v9-insts
 endif
+ifeq ($(TARGET_ARCH),ARM)
+LLCBETAOPTION := -march=thumb
+endif
 
 print-llcbeta-option:
 	@echo $(LLCBETAOPTION)
@@ -302,6 +313,11 @@
 LLCFLAGS += -enable-correct-eh-support
 endif
 
+# Pass target specific llc flags
+ifdef TARGET_LLCFLAGS
+LLCFLAGS += $(TARGET_LLCFLAGS)
+endif
+
 #
 # Rules to compile the program for the C Back End
 #
@@ -408,6 +424,15 @@
 # output with the program's output.
 BUGPOINT_OPTIONS += -append-exit-code
 
+# Support remote execution
+ifdef REMOTE_HOST
+ifdef REMOTE_USER
+BUGPOINT_OPTIONS += -rsh-host=$(REMOTE_HOST) -rsh-user=$(REMOTE_USER)
+else
+BUGPOINT_OPTIONS += -rsh-host=$(REMOTE_HOST)
+endif
+endif
+
 # If a tolerance is set, pass it off to bugpoint
 ifdef FP_TOLERANCE
 BUGPOINT_OPTIONS += -rel-tolerance $(FP_TOLERANCE)


Index: llvm-test/RunSafely.sh
diff -u llvm-test/RunSafely.sh:1.27 llvm-test/RunSafely.sh:1.28
--- llvm-test/RunSafely.sh:1.27	Thu Jan 11 15:01:31 2007
+++ llvm-test/RunSafely.sh	Thu May  3 16:32:39 2007
@@ -11,17 +11,23 @@
 #           fourth argument specified, and outputs a <outfile>.time file which
 #           contains a timing of the program and the program's exit code.
 #          
-#           If the <exitok> (2nd) parameter is 0 then this script always
-#           returns 0, regardless of the actual exit of the <program>.
+#           If the <exitok> parameter is 0 then this script always returns 0,
+#           regardless of the actual exit of the <program>.
 #           If the <exitok> parameter is non-zero then this script returns
 #           the exit code of the <program>. If there is an error in getting
 #           the <program>'s exit code, this script returns 99.
 #
+#           If optional parameters -r <remote host> -l <remote user> are
+#           specified, it execute the program remotely using rsh.
+#
 # Syntax: 
 #
-#   RunSafely.sh <timeout> <exitok> <infile> <outfile> <program> <args...>
+#   RunSafely.sh [-r <rhost>] [-l <ruser>]
+#                <timeout> <exitok> <infile> <outfile> <program> <args...>
 #
 #   where:
+#     <rhost>   is the remote host to execute the program
+#     <ruser>   is the username on the remote host
 #     <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
@@ -35,6 +41,19 @@
 fi
 
 DIR=${0%%`basename $0`}
+
+RHOST=
+RUSER=`id -un`
+FLAG=$1
+if [ $1 = "-r" ]; then
+  RHOST=$2
+  shift 2
+fi
+if [ $1 = "-l" ]; then
+  RUSER=$2
+  shift 2
+fi
+
 ULIMIT=$1
 EXITOK=$2
 INFILE=$3
@@ -75,18 +94,31 @@
 # we tell time to launch a shell which in turn executes $PROGRAM with the
 # necessary I/O redirection.
 #
+PWD=`pwd`
 COMMAND="$PROGRAM $*"
 if [ "$SYSTEM" = "Darwin" ]; then
-  COMMAND="${DIR}TimedExec.sh $ULIMIT $COMMAND"
+  COMMAND="${DIR}TimedExec.sh $ULIMIT $PWD $COMMAND"
 fi
 
-( time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \
-  | awk -- '\
+if [ "x$RHOST" = x ] ; then
+  ( time -p sh -c "$COMMAND >$OUTFILE 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \
+    | awk -- '\
+BEGIN     { cpu = 0.0; }
+/^user/   { cpu += $2; print; }
+/^sys/    { cpu += $2; print; }
+!/^user/ && !/^sys/  { print; }
+END       { printf("program %f\n", cpu); }' > $OUTFILE.time
+else
+  ( rsh -l $RUSER $RHOST "cd $PWD; time -p $COMMAND >$OUTFILE.remote 2>&1 < $INFILE" ; echo exit $? ) 2>&1 \
+    | awk -- '\
 BEGIN     { cpu = 0.0; }
 /^user/   { cpu += $2; print; }
 /^sys/    { cpu += $2; print; }
 !/^user/ && !/^sys/  { print; }
 END       { printf("program %f\n", cpu); }' > $OUTFILE.time
+cp $OUTFILE.remote $OUTFILE
+rm -f $OUTFILE.remote
+fi
 
 exitval=`grep '^exit ' $OUTFILE.time | sed -e 's/^exit //'`
 if [ -z "$exitval" ] ; then


Index: llvm-test/TimedExec.sh
diff -u llvm-test/TimedExec.sh:1.5 llvm-test/TimedExec.sh:1.6
--- llvm-test/TimedExec.sh:1.5	Wed Jan 10 11:51:45 2007
+++ llvm-test/TimedExec.sh	Thu May  3 16:32:39 2007
@@ -4,11 +4,11 @@
 #
 # 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> <program> <args...>
+# Syntax: ./TimedExec.sh <timeout> <dir> <program> <args...>
 #
 
-if [ $# -lt 2 ]; then
-    echo "./TimedExec.sh <timeout> <program> <args...>"
+if [ $# -lt 3 ]; then
+    echo "./TimedExec.sh <timeout> <dir> <program> <args...>"
     exit 1
 fi
 
@@ -18,11 +18,13 @@
 fi
 
 TIMEOUT=$1
-shift
+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.






More information about the llvm-commits mailing list