File: TESTmallocfail

package info (click to toggle)
dwarfutils 20201201-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 11,868 kB
  • sloc: ansic: 104,667; sh: 5,947; cpp: 4,675; python: 878; makefile: 646; awk: 11
file content (33 lines) | stat: -rw-r--r-- 686 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/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