File: Torture

package info (click to toggle)
twin 0.4.0-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,804 kB
  • ctags: 23,904
  • sloc: ansic: 61,860; cpp: 1,023; makefile: 777; sh: 552; lex: 302; yacc: 231
file content (81 lines) | stat: -rw-r--r-- 1,314 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

#
# this partially duplicates MkDep...
#

BITMAP=
TORTURE=
FILES=

BITMAP=$1
shift

while [ "$1" ]; do
  case "$1" in
    -- )
      break
      ;;
    *\ * )
      TORTURE="$TORTURE \"$1\""
      shift
      ;;
    *\"* )
      TORTURE="$TORTURE '$1'"
      shift
      ;;
    * )
      TORTURE="$TORTURE $1"
      shift
      ;;
  esac
done

if [ "$1" = "--" ]; then
  shift
else
  exit 1
fi


i="$1"


name=`echo $i | sed -e 's/\./_/g'`
  
DEFS=
# search `#include "name"' `CONF_name' and `DEBUG_name' in the file
# and turn them into ` INC_name ' ` CONF_name ' and ` DEBUG_name '
MATCH=`grep -E '(^#.*def.*CONF_)|(^#.*def.*DEBUG_)' "$i" \
| sed -e 's:CONF_\([A-Za-z0-9_]*\): CONF_\1 :g'    \
      -e 's:DEBUG_\([A-Za-z0-9_]*\): DEBUG_\1 :g'`

for j in $MATCH; do
  case "$j" in
    CONF_* )
      eval "ALREADY=\"\$${name}_${j}_AWARE\""
      if [ ! "$ALREADY" ]; then
        DEFS="$j $DEFS"
	eval "${name}_${j}_AWARE=y"
      fi
      ;;
    DEBUG_* )
      eval "ALREADY=\"\$${name}_${j}_AWARE\""
      if [ ! "$ALREADY" ]; then
        DEFS="$j $DEFS"
	eval "${name}_${j}_AWARE=y"
      fi
      ;;
  esac
done

FLAGS=`echo .${i}.flags | sed -e 's/\.c/\.o/'`
echo "rm -f $FLAGS"
rm -f $FLAGS

eval "$BITMAP $DEFS" | while read THIS; do

  echo "$TORTURE $THIS"
  eval "$TORTURE $THIS" || exit 1
  
done