2006-09-03 12:48:23 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Check that LD_PRELOAD'ing libumem works. This is how it can be used
|
|
|
|
# to replace malloc for any program.
|
|
|
|
#
|
|
|
|
|
|
|
|
FILE=Makefile.am
|
2008-06-03 03:39:58 +00:00
|
|
|
TMPLOC=`mktemp -d /tmp/umem_test4.XXXXXX`
|
2006-09-03 12:48:23 +00:00
|
|
|
trap 'rm -rf $TMPLOC' 1 2 15
|
|
|
|
|
|
|
|
LD_PRELOAD=.libs/libumem.so /usr/bin/ldd /bin/ls >$TMPLOC/log 2>&1
|
|
|
|
|
|
|
|
# Check we got the expected result
|
|
|
|
ret=0
|
|
|
|
grep -E '(symbol lookup error|undefined symbol)' $TMPLOC/log >/dev/null 2>&1
|
|
|
|
if [ "$?" = "0" ]; then
|
|
|
|
# Matched = failed to load up libumem
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf $TMPLOC
|
|
|
|
|
|
|
|
exit $ret
|