File: test.twpre.sh

package info (click to toggle)
tripwire 1.2-15
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 1,428 kB
  • ctags: 866
  • sloc: ansic: 7,938; sh: 1,316; makefile: 425; yacc: 413; lex: 133; perl: 101
file content (101 lines) | stat: -rwxr-xr-x 1,455 bytes parent folder | download | duplicates (3)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/sh

ME=$0

TMPINFILE=/tmp/tw1
TMPOUTFILE=/tmp/tw2
TMPOUTCTRL=/tmp/twctrl
TMPINC1=/tmp/twinc1
TMPINC2=/tmp/twinc2

cat << EOF

=== $ME: DESCRIPTION

    This script excercises the Tripwire preprocessor, testing correctness
variable expansion and include files.

=== $ME: BEGIN ===

EOF
TW="../src/tripwire -E"

cat << EOF > $TMPINFILE
@@define VN1
@@define VN2
@@define VN3
@@define VN4
@@define VN5
@@define V1	Z+pinugs123
@@define V2	Y+pinugs123
@@define V3	Z+pinugs123
@@define V4	W+pinugs123
@@define V5	V+pinugs123
@@VN1
@@VN2
@@VN3
@@VN4
@@VN5
@@V1
@@V2
@@V3
@@V4
@@V5
@@V1 @@V1 @@V1 @@V1 @@V1
@@V1@@V1@@V1@@V1@@V1
@@V1@@V1@@V1@@V1@@V1@@V1@@V1@@V1@@V1@@V1
@@define X1_1	XX
@@{X1_1}
X1_1
@@define X 1
@@define XX 2
@@define XXX 3
@@{X}@@{XX}@@{XXX}
@@include $TMPINC1
EOF

cat << EOF > $TMPOUTCTRL





Z+pinugs123
Y+pinugs123
Z+pinugs123
W+pinugs123
V+pinugs123
Z+pinugs123 Z+pinugs123 Z+pinugs123 Z+pinugs123 Z+pinugs123
Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123
Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123Z+pinugs123
XX
X1_1
123
xxx xxx
xxx xxx
EOF

cat > $TMPINC1 << EOF
@@define F1 xxx
@@{F1} @@F1
@@include $TMPINC2
EOF

cat > $TMPINC2 << EOF
@@{F1} @@F1
EOF

$TW -c $TMPINFILE > $TMPOUTFILE
diff  $TMPOUTFILE $TMPOUTCTRL

if [ $? -ne 0 ] 
then 
	echo "=== $ME: FAILED ==="
	exit 1
else
	echo "=== $ME: PASS ==="
	exit 0
fi

#rm -f $TMPOUTFILE $TMPINFILE $TMPOUTCTRL