2009-04-08 17:18:57 +05:30
|
|
|
# "Check many leaks" test #1
|
|
|
|
# Cramming all kinds of weird commands in here.
|
|
|
|
# As you find leaks, please create separate, small test
|
|
|
|
# for each leak.
|
|
|
|
# Narrowing down the leak using this large test may be difficult.
|
|
|
|
# It is intended to be a blanket "is everything ok?" test
|
|
|
|
|
|
|
|
echo "Warm up"
|
|
|
|
i=1
|
|
|
|
l=1
|
|
|
|
t=1
|
|
|
|
export t
|
|
|
|
while test $i != 99; do
|
|
|
|
t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1
|
|
|
|
{ t=value3_$i /bin/true; } </dev/null
|
|
|
|
if true; t=valueA_$i false >>/dev/null; true; then
|
|
|
|
: << HERE >/dev/null; true <<HERE
|
|
|
|
Hello builtin :
|
|
|
|
HERE
|
2009-04-08 22:29:24 +05:30
|
|
|
Hello $i true
|
2009-04-08 17:18:57 +05:30
|
|
|
HERE
|
|
|
|
elif false; then
|
|
|
|
true; echo Doesnt run
|
|
|
|
else
|
|
|
|
{ true; }; echo Doesnt run too >>/foo/bar
|
|
|
|
fi
|
2009-04-08 22:29:24 +05:30
|
|
|
{ : /bin/*; }
|
2009-04-11 05:18:03 +05:30
|
|
|
unset var
|
|
|
|
echo >/dev/null ${var#}
|
|
|
|
echo >/dev/null ${var##}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%}
|
|
|
|
echo >/dev/null ${var%%}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
|
|
|
var=
|
|
|
|
echo >/dev/null ${var#}
|
|
|
|
echo >/dev/null ${var##}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%}
|
|
|
|
echo >/dev/null ${var%%}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
|
|
|
var=ababcdcd
|
|
|
|
echo >/dev/null ${var#ab}
|
|
|
|
echo >/dev/null ${var##ab}
|
|
|
|
echo >/dev/null ${var#a*b}
|
|
|
|
echo >/dev/null ${var##a*b}
|
|
|
|
echo >/dev/null ${var#?}
|
|
|
|
echo >/dev/null ${var##?}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%cd}
|
|
|
|
echo >/dev/null ${var%%cd}
|
|
|
|
echo >/dev/null ${var%c*d}
|
|
|
|
echo >/dev/null ${var%%c*d}
|
|
|
|
echo >/dev/null ${var%?}
|
|
|
|
echo >/dev/null ${var%%?}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
2009-04-08 22:29:24 +05:30
|
|
|
set -- par1_$i par2_$i par3_$i par4_$i
|
|
|
|
trap "echo trap$i" WINCH
|
2009-04-11 16:07:10 +05:30
|
|
|
f() { true; true; true; true; true; true; true; true; }
|
|
|
|
f() { true; true; true; true; true; true; true; true; echo $1; }
|
2009-04-11 04:53:41 +05:30
|
|
|
f >/dev/null
|
2009-04-08 17:18:57 +05:30
|
|
|
: $((i++))
|
|
|
|
done
|
|
|
|
|
|
|
|
memleak
|
|
|
|
|
|
|
|
echo "Measuring memory leak..."
|
|
|
|
# Please copy the entire block from above verbatim
|
|
|
|
i=1
|
|
|
|
l=1
|
|
|
|
t=1
|
|
|
|
export t
|
|
|
|
while test $i != 99; do
|
|
|
|
t=value1_$i; t=value2_$i true; t=value3_$i /bin/true; t=value4_$i exec 1>&1
|
|
|
|
{ t=value3_$i /bin/true; } </dev/null
|
|
|
|
if true; t=valueA_$i false >>/dev/null; true; then
|
|
|
|
: << HERE >/dev/null; true <<HERE
|
|
|
|
Hello builtin :
|
|
|
|
HERE
|
2009-04-08 22:29:24 +05:30
|
|
|
Hello $i true
|
2009-04-08 17:18:57 +05:30
|
|
|
HERE
|
|
|
|
elif false; then
|
|
|
|
true; echo Doesnt run
|
|
|
|
else
|
|
|
|
{ true; }; echo Doesnt run too >>/foo/bar
|
|
|
|
fi
|
2009-04-08 22:29:24 +05:30
|
|
|
{ : /bin/*; }
|
2009-04-11 05:18:03 +05:30
|
|
|
unset var
|
|
|
|
echo >/dev/null ${var#}
|
|
|
|
echo >/dev/null ${var##}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%}
|
|
|
|
echo >/dev/null ${var%%}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
|
|
|
var=
|
|
|
|
echo >/dev/null ${var#}
|
|
|
|
echo >/dev/null ${var##}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%}
|
|
|
|
echo >/dev/null ${var%%}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
|
|
|
var=ababcdcd
|
|
|
|
echo >/dev/null ${var#ab}
|
|
|
|
echo >/dev/null ${var##ab}
|
|
|
|
echo >/dev/null ${var#a*b}
|
|
|
|
echo >/dev/null ${var##a*b}
|
|
|
|
echo >/dev/null ${var#?}
|
|
|
|
echo >/dev/null ${var##?}
|
|
|
|
echo >/dev/null ${var#*}
|
|
|
|
echo >/dev/null ${var##*}
|
|
|
|
echo >/dev/null ${var%cd}
|
|
|
|
echo >/dev/null ${var%%cd}
|
|
|
|
echo >/dev/null ${var%c*d}
|
|
|
|
echo >/dev/null ${var%%c*d}
|
|
|
|
echo >/dev/null ${var%?}
|
|
|
|
echo >/dev/null ${var%%?}
|
|
|
|
echo >/dev/null ${var%*}
|
|
|
|
echo >/dev/null ${var%%*}
|
2009-04-08 22:29:24 +05:30
|
|
|
set -- par1_$i par2_$i par3_$i par4_$i
|
|
|
|
trap "echo trap$i" WINCH
|
2009-04-11 16:07:10 +05:30
|
|
|
f() { true; true; true; true; true; true; true; true; }
|
|
|
|
f() { true; true; true; true; true; true; true; true; echo $1; }
|
2009-04-11 04:53:41 +05:30
|
|
|
f >/dev/null
|
2009-04-08 17:18:57 +05:30
|
|
|
: $((i++))
|
|
|
|
done
|
|
|
|
|
2009-04-11 05:18:03 +05:30
|
|
|
|
2009-04-08 17:18:57 +05:30
|
|
|
memleak
|
|
|
|
kb=$?
|
2009-04-11 05:18:03 +05:30
|
|
|
# Observed some variability, bumped to 12k
|
|
|
|
if test $kb -le 12; then
|
2009-04-08 17:18:57 +05:30
|
|
|
echo Ok #$kb
|
|
|
|
else
|
|
|
|
echo "Bad: $kb kb (or more) leaked"
|
|
|
|
fi
|