Debian Codegraph @

src/bin/dwarfgen/TESTmallocfail

raw
1 #!/bin/bash
2 #
3 # This runs dwarfgen/libdwarf with a malloc failure
4 # at the $ct'th call to malloc.
5 # To expose errors in malloc failure handling.
6
7 # Probably any small C file compiled -c will do
8 # to produce test.o For example just use a .o
9 # generated by the build of dwarfgen
10
11 subj=test.o
12 ct=0
13
14 while [ $ct -lt 500 ]
15 do
16 echo '===== START TEST'
17 rm -f core
18 rm -f dwarfgen
19 sed -e "s/FAILCOUNT/$ct/" <fakemalloc.in >fakemalloc.c
20 echo TEST $ct
21 grep if fakemalloc.c
22 make
23 ./dwarfgen -h -t obj -c 0 -o $subj ./dwarfgen >junk.x
24 cat junk.x
25 if [ -f core ]
26 then
27 echo "CORE FILE EXISTS, test" $ct
28 fi
29 rm -f core
30 echo '===== END TEST'
31 ct=`expr $ct + 1`
32 done
33