tests: Enable GNU libc memory allocation error checking
MALLOC_CHECK_=3 makes glibc check for memory allocation programming errors. It's the factory default, but set it anyway just in case someone disabled it for speed. Non-zero MALLOC_PERTURB_ makes glibc wipe memory value on allocation and deallocation. The actual value determines the bit pattern. Set it to the value of environment variable EMPIRE_CHECK_MALLOC_PERTURB or else a pseudo-random number, and record it in sandbox/malloc-perturb. See mallopt(3) for more information. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
1abd3c5b0b
commit
6e80cf103f
1 changed files with 8 additions and 2 deletions
|
@ -20,6 +20,11 @@ empdump="src/util/empdump -e $econfig"
|
||||||
files="src/util/files -e $econfig"
|
files="src/util/files -e $econfig"
|
||||||
fairland="src/util/fairland -e $econfig"
|
fairland="src/util/fairland -e $econfig"
|
||||||
|
|
||||||
|
# GNU libc memory allocation checking, see mallopt(3)
|
||||||
|
# $RANDOM isn't portable
|
||||||
|
malloc_perturb=${EMPIRE_CHECK_MALLOC_PERTURB:-$(perl -e 'print int(rand(255))')}
|
||||||
|
env="MALLOC_CHECK_=3 MALLOC_PERTURB_=$malloc_perturb"
|
||||||
|
|
||||||
empthread=`sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile`
|
empthread=`sed -n 's/empthread *:= *\(.*\)/\1/p' <GNUmakefile`
|
||||||
warn_empthread=y
|
warn_empthread=y
|
||||||
|
|
||||||
|
@ -36,6 +41,7 @@ create_sandbox()
|
||||||
{
|
{
|
||||||
rm -rf sandbox
|
rm -rf sandbox
|
||||||
mkdir -p sandbox/etc/empire sandbox/share/empire/builtin $data
|
mkdir -p sandbox/etc/empire sandbox/share/empire/builtin $data
|
||||||
|
echo $malloc_perturb >sandbox/malloc-perturb
|
||||||
touch $schedule
|
touch $schedule
|
||||||
cat >$econfig <<EOF
|
cat >$econfig <<EOF
|
||||||
data "../../var/empire"
|
data "../../var/empire"
|
||||||
|
@ -94,7 +100,7 @@ run()
|
||||||
local name=$1 ret
|
local name=$1 ret
|
||||||
shift
|
shift
|
||||||
set +e
|
set +e
|
||||||
"$@" >>sandbox/$name.out 2>>sandbox/$name.err
|
env $env "$@" >>sandbox/$name.out 2>>sandbox/$name.err
|
||||||
ret=$?
|
ret=$?
|
||||||
set -e
|
set -e
|
||||||
echo $ret >>sandbox/$name.status
|
echo $ret >>sandbox/$name.status
|
||||||
|
@ -126,7 +132,7 @@ start_server()
|
||||||
check_empthread
|
check_empthread
|
||||||
|
|
||||||
pid=
|
pid=
|
||||||
src/server/emp_server -e $econfig -R 1 -s -E crash-dump
|
env $env src/server/emp_server -e $econfig -R 1 -s -E crash-dump
|
||||||
timeout=$((`now`+5))
|
timeout=$((`now`+5))
|
||||||
until pid=`cat $pidfile 2>/dev/null` && [ -n "$pid" ]
|
until pid=`cat $pidfile 2>/dev/null` && [ -n "$pid" ]
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue