1 #
   2 # One of the problems that we can encounter involves trying to typedef a struct
   3 # that has an error in it. The problem here is that we actually create the type
   4 # itself for the struct before we add members. So what we need is something that
   5 # will fail validation. So here we go!
   6 #
   7 
   8 TMPFILE="$(mktemp -p /tmp mtest.XXXXXX)"
   9 if [[ -z "$TMPFILE" ]]; then
  10         echo "Failed to get a temp file" 2>&1
  11         exit 1
  12 fi
  13 
  14 $MDB <<EOF
  15 ::typedef "struct foo { int r; }" foo_t
  16 ::typedef -l ! cat > $TMPFILE
  17 EOF
  18 
  19 DATA=$(cat $TMPFILE)
  20 rm -f $TMPFILE
  21 
  22 [[ -z $DATA ]]