mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
test/path.sh: don't fail if 'command -x' test runs out of memory
Some systems issue SIGKILL if a process takes up too much memory. That is easy to check for.
This commit is contained in:
parent
a35a47b835
commit
5939964725
1 changed files with 18 additions and 14 deletions
|
@ -24,6 +24,7 @@ function err_exit
|
||||||
let Errors+=1
|
let Errors+=1
|
||||||
}
|
}
|
||||||
alias err_exit='err_exit $LINENO'
|
alias err_exit='err_exit $LINENO'
|
||||||
|
alias warning='err\_exit $((Errors--,LINENO)) warning:'
|
||||||
|
|
||||||
Command=${0##*/}
|
Command=${0##*/}
|
||||||
integer Errors=0
|
integer Errors=0
|
||||||
|
@ -341,7 +342,7 @@ scr=$tmp/script
|
||||||
exp=126
|
exp=126
|
||||||
|
|
||||||
if [[ $(id -u) == '0' ]]; then
|
if [[ $(id -u) == '0' ]]; then
|
||||||
print -u2 "\t${Command}[$LINENO]: warning: running as root: skipping tests involving unreadable scripts"
|
warning "running as root: skipping tests involving unreadable scripts"
|
||||||
else
|
else
|
||||||
|
|
||||||
: > $scr
|
: > $scr
|
||||||
|
@ -571,22 +572,25 @@ sleep_pid=$!
|
||||||
' static_argzero "$@" final_static_arg_1 final_static_arg_2
|
' static_argzero "$@" final_static_arg_1 final_static_arg_2
|
||||||
) >$ofile &
|
) >$ofile &
|
||||||
pid=$!
|
pid=$!
|
||||||
wait $pid
|
{ wait $pid; } 2>/dev/null # wait and suppress signal messages
|
||||||
e=$?
|
e=$?
|
||||||
trap - TERM INT
|
trap - TERM INT
|
||||||
[[ $sleep_pid ]] && kill $sleep_pid
|
[[ $sleep_pid ]] && kill $sleep_pid
|
||||||
if let "e > 0"
|
if [[ ${ kill -l "$e"; } == KILL ]]
|
||||||
then err_exit "'command -x' test yielded exit status $e$( let "e>128" && print -n / && kill -l "$e")"
|
then warning "'command -x' test killed, probably due to lack of memory; skipping test"
|
||||||
fi
|
else if let "e > 0"
|
||||||
if [[ ! -s $ofile ]]
|
then err_exit "'command -x' test yielded exit status $e$( let "e>128" && print -n / && kill -l "$e")"
|
||||||
then err_exit "'command -x' test failed to produce output"
|
fi
|
||||||
else save_Command=$Command
|
if [[ ! -s $ofile ]]
|
||||||
Command+=": ${ofile##*/}"
|
then err_exit "'command -x' test failed to produce output"
|
||||||
. "$ofile"
|
else save_Command=$Command
|
||||||
Command=$save_Command
|
Command+=": ${ofile##*/}"
|
||||||
let "args == expargs && size == expsize" || err_exit "'command -x' did not correctly divide arguments" \
|
. "$ofile"
|
||||||
"(expected $expargs args of total size $expsize, got $args args of total size $size;" \
|
Command=$save_Command
|
||||||
"divided in $chunks chunks)"
|
let "args == expargs && size == expsize" || err_exit "'command -x' did not correctly divide arguments" \
|
||||||
|
"(expected $expargs args of total size $expsize, got $args args of total size $size;" \
|
||||||
|
"divided in $chunks chunks)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ======
|
# ======
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue