mirror of
https://github.com/davea42/libdwarf-code.git
synced 2025-10-23 18:58:26 +08:00

about the origin of this test (intended to stress libdwarf in the face of malloc failure).
34 lines
686 B
Bash
34 lines
686 B
Bash
#!/bin/bash
|
|
#
|
|
# This runs dwarfgen/libdwarf with a malloc failure
|
|
# at the $ct'th call to malloc.
|
|
# To expose errors in malloc failure handling.
|
|
|
|
# Probably any small C file compiled -c will do
|
|
# to produce test.o For example just use a .o
|
|
# generated by the build of dwarfgen
|
|
|
|
subj=test.o
|
|
ct=0
|
|
|
|
while [ $ct -lt 500 ]
|
|
do
|
|
echo '===== START TEST'
|
|
rm -f core
|
|
rm -f dwarfgen
|
|
sed -e "s/FAILCOUNT/$ct/" <fakemalloc.in >fakemalloc.c
|
|
echo TEST $ct
|
|
grep if fakemalloc.c
|
|
make
|
|
./dwarfgen -h -t obj -c 0 -o $subj ./dwarfgen >junk.x
|
|
cat junk.x
|
|
if [ -f core ]
|
|
then
|
|
echo "CORE FILE EXISTS, test" $ct
|
|
fi
|
|
rm -f core
|
|
echo '===== END TEST'
|
|
ct=`expr $ct + 1`
|
|
done
|
|
|