Permit this script to run correctly on Cygwin where /bin/sh is not the
Bourne Again Shell, just the Bourne Shell. It doesn't support the ulimit command so we avoid running it. git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@19191 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a80403d790
Коммит
e5866c5c8b
18
RunSafely.sh
18
RunSafely.sh
|
@ -18,13 +18,19 @@ INFILE=$2
|
|||
OUTFILE=$3
|
||||
PROGRAM=$4
|
||||
shift 4
|
||||
SYSTEM=`uname -s`
|
||||
|
||||
ulimit -t $ULIMIT
|
||||
case $SYSTEM in
|
||||
CYGWIN*)
|
||||
;;
|
||||
*)
|
||||
ulimit -t $ULIMIT
|
||||
ulimit -c unlimited
|
||||
# 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. ;)
|
||||
ulimit -f 10485760
|
||||
esac
|
||||
rm -f core core.*
|
||||
ulimit -c unlimited
|
||||
# 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. ;)
|
||||
ulimit -f 10485760
|
||||
|
||||
#
|
||||
# Run the command, timing its execution.
|
||||
|
@ -36,7 +42,7 @@ ulimit -f 10485760
|
|||
# we tell time to launch a shell which in turn executes $PROGRAM with the
|
||||
# necessary I/O redirection.
|
||||
#
|
||||
(time -p sh -c "$PROGRAM $* > $OUTFILE 2>&1 < $INFILE") 2>&1 | awk -- '\
|
||||
( time -p sh -c "$PROGRAM $* > $OUTFILE 2>&1 < $INFILE" ) 2>&1 | awk -- '\
|
||||
BEGIN { cpu = 0.0; }
|
||||
/^user/ { cpu += $2; print }
|
||||
/^sys/ { cpu += $2; print }
|
||||
|
|
Загрузка…
Ссылка в новой задаче