zsh completions: minor tweaks
[pcp.git] / qa / 463
blobda0c9da69c595717c4a36d6f368b507abe34ac03
1 #!/bin/sh
2 # PCP QA Test No. 463
3 # Test ascii PMNS without cpp
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=0 # success is the default!
17 $sudo rm -rf $tmp.* $seq.full
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 _filter()
22 sed \
23 -e "s;$tmp;TMP;g" \
24 -e "s;$PCP_VAR_DIR;PCP_VAR_DIR;g"
27 # real QA test starts here
28 echo "no error cases ..."
29 echo "---------------- 1 -----------------"
30 cat <<End-of-File >$tmp.root
31 root {
32 one 1:2:3
33 two
34 four
36 two {
37 three 4:5:6
39 four {
40 five
42 four.five {
43 six 7:8:9
45 End-of-File
46 pmcpp $tmp.root 2>&1 | _filter
48 echo
49 echo "---------------- 2 -----------------"
50 cat <<End-of-File >$tmp.root
51 root {
52 one 1:2:3
53 #include "$tmp.1"
54 End-of-File
55 cat <<End-of-File >$tmp.1
56 two
57 four
59 two {
60 three 4:5:6
62 #include "$tmp.2"
63 End-of-File
64 cat <<End-of-File >$tmp.2
65 four {
66 five
68 four.five {
69 six 7:8:9
71 End-of-File
72 pmcpp $tmp.root 2>&1 | _filter
73 rm -f $tmp.?
75 echo
76 echo "---------------- 3 -----------------"
77 cat <<End-of-File >$tmp.root
78 root {
79 one 1:2:3
80 #ifdef foo
81 foo 2:4:5
82 #endif
83 #ifndef foo
84 #include "$tmp.1"
85 #endif
87 End-of-File
88 cat <<End-of-File >$tmp.1
89 two
91 two {
92 three 4:5:6
93 End-of-File
94 pmcpp $tmp.root 2>&1 | _filter
95 rm -f $tmp.?
97 echo
98 echo "---------------- 4 -----------------"
99 cat <<End-of-File >$tmp.root
100 root {
101 one 1:2:3
102 #define foo yes
103 #ifdef foo
104 foo 2:4:5
105 #endif
106 #ifndef foo
107 #include "$tmp.1"
108 #endif
110 End-of-File
111 cat <<End-of-File >$tmp.1
114 two {
115 three 4:5:6
116 End-of-File
117 pmcpp $tmp.root 2>&1 | _filter
118 rm -f $tmp.?
120 echo
121 echo "---------------- 5 -----------------"
122 cat <<End-of-File >$tmp.root
123 #define one two
124 #define foo_path3 foo.three
125 #define THREE 3
126 #define FOUR 4
127 #define FIVE 5
128 root {
129 one 2:2:2
132 foo {
134 three
136 foo.one {
137 eek THREE:FOUR:FIVE
139 foo_path3 {
140 urk FIVE:FOUR:THREE
142 End-of-File
143 pmcpp $tmp.root 2>&1 | _filter
144 rm -f $tmp.?
146 echo
147 echo "---------------- 6 -----------------"
148 cat <<End-of-File >$tmp.root
149 /* comment at the beginning */
150 root {
151 one 1:2:3
153 four
155 two {
156 three /*inline comment*/ 4:5:6
158 four {
159 five/* strange
160 but syntactically ok */
162 four.five {
163 /**/six 7:8:9
166 * multi-line comment at the end
168 End-of-File
169 pmcpp $tmp.root 2>&1 | _filter
170 rm -f $tmp.?
172 # note ... strip blank lines here because number of lines in
173 # <stdpmid> may vary over time
175 echo
176 echo "---------------- 7 -----------------"
177 cat <<End-of-File >$tmp.root
178 #include <stdpmid>
179 root {
180 sample SAMPLE:*:*
181 sampledso SAMPLEDSO:*:*
183 End-of-File
184 pmcpp $tmp.root 2>&1 | _filter | sed -e '/^[ ]*$/d'
186 echo
187 echo "---------------- 8 -----------------"
188 cat <<End-of-File >$tmp.root
189 root {
190 #ifdef foo
191 sample SAMPLE:*:*
192 sampledso SAMPLEDSO:*:*
193 #endif
195 End-of-File
196 pmcpp -DSAMPLE=29 -DSAMPLEDSO=30 -Dfoo $tmp.root 2>&1 | _filter
198 echo "---------------- 8a -----------------"
199 echo foo >$tmp.1
200 echo bar >$tmp.2
201 echo mumble >$tmp.3
202 echo fumble >$tmp.4
203 cat <<End-of-File >$tmp.in
204 /* white space after include filename */
205 #include "$tmp.1" /* spaces */
206 /* spaces, no comment ... this was Nathan's Mac OS X failure */
207 #include <$tmp.2>
208 #include <$tmp.3> /* tab */
209 /* tab, no comment */
210 #include "$tmp.4"
211 End-of-File
212 pmcpp -P $tmp.in 2>&1 | _filter
214 echo "---------------- 8b -----------------"
215 cat <<End-of-File >$tmp.in
216 # white space after include filename
217 # spaces, no comment ... this was Nathan's Mac OS X failure */
218 %include <$tmp.1>
219 # tab this time
220 %include "$tmp.2"
221 End-of-File
222 pmcpp -sP $tmp.in 2>&1 | _filter
224 echo
225 echo "#include errors ..."
226 echo "---------------- 9 -----------------"
227 cat <<End-of-File >$tmp.root
228 root {
229 #include $tmp.1
231 End-of-File
232 pmcpp $tmp.root 2>&1 | _filter
233 rm -f $tmp.?
235 echo "---------------- 10 -----------------"
236 cat <<End-of-File >$tmp.root
237 root {
238 #include "$tmp.1
240 End-of-File
241 pmcpp $tmp.root 2>&1 | _filter
243 echo "---------------- 11 -----------------"
244 cat <<End-of-File >$tmp.root
245 root {
246 #include <$tmp.1
248 End-of-File
249 pmcpp $tmp.root 2>&1 | _filter
251 echo "---------------- 12 -----------------"
252 cat <<End-of-File >$tmp.root
253 root {
254 #include "$tmp.1" junk
256 End-of-File
257 pmcpp $tmp.root 2>&1 | _filter
258 rm -f $tmp.?
260 echo "---------------- 13 -----------------"
261 cat <<End-of-File >$tmp.root
262 root {
263 #include "$tmp.1"
265 End-of-File
266 pmcpp $tmp.root 2>&1 | _filter
267 rm -f $tmp.?
269 echo "---------------- 14 -----------------"
270 cat <<End-of-File >$tmp.root
271 root {
272 zero 1:0:0
273 #include "$tmp.1"
275 End-of-File
276 cat <<End-of-File >$tmp.1
277 one 1:0:1
278 #include "$tmp.2"
279 End-of-File
280 cat <<End-of-File >$tmp.2
281 two 1:0:2
282 #include "$tmp.3"
283 End-of-File
284 cat <<End-of-File >$tmp.3
285 three 1:0:3
286 #include "$tmp.4"
287 End-of-File
288 cat <<End-of-File >$tmp.4
289 four 1:0:4
290 #include "$tmp.5"
291 End-of-File
292 pmcpp $tmp.root 2>&1 | _filter
293 rm -f $tmp.?
295 echo
296 echo "#define errors ..."
297 echo "---------------- 15 -----------------"
298 cat <<End-of-File >$tmp.root
299 root {
300 #define
302 End-of-File
303 pmcpp $tmp.root 2>&1 | _filter
305 echo "---------------- 16 -----------------"
306 cat <<End-of-File >$tmp.root
307 root {
308 /* white space at the end of the next line */
309 #define
311 End-of-File
312 pmcpp $tmp.root 2>&1 | _filter
314 echo "---------------- 17 -----------------"
315 cat <<End-of-File >$tmp.root
316 root {
317 #define foo
319 End-of-File
320 pmcpp $tmp.root 2>&1 | _filter
322 echo "---------------- 18 -----------------"
323 cat <<End-of-File >$tmp.root
324 root {
325 #define bad_123_macro!name
327 End-of-File
328 pmcpp $tmp.root 2>&1 | _filter
330 echo "---------------- 19 -----------------"
331 cat <<End-of-File >$tmp.root
332 root {
333 #define dup yes
334 #define dup no
336 End-of-File
337 pmcpp $tmp.root 2>&1 | _filter
339 echo "---------------- 20 -----------------"
340 cat <<End-of-File >$tmp.root
341 root {
343 End-of-File
344 pmcpp -Dfoo=1 -Dfoo $tmp.root 2>&1 | _filter
346 echo "---------------- 21 -----------------"
347 cat <<End-of-File >$tmp.root
348 root {
350 End-of-File
351 pmcpp -Dfoo-bar=1 $tmp.root 2>&1 | _filter
353 echo
354 echo "#ifdef etc errors ..."
355 echo "---------------- 22 -----------------"
356 cat <<End-of-File >$tmp.root
357 root {
358 #ifndef extra /*does not count*/ !
360 End-of-File
361 pmcpp $tmp.root 2>&1 | _filter
363 echo "---------------- 23 -----------------"
364 cat <<End-of-File >$tmp.root
365 root {
366 #ifdef foo
367 #endif
368 #endif /* not matched */
370 End-of-File
371 pmcpp $tmp.root 2>&1 | _filter
373 echo "---------------- 24 -----------------"
374 cat <<End-of-File >$tmp.root
375 root {
376 #define foo yippee
377 #ifdef foo
378 #define nested yes
379 #ifdef nested /* <- error */
380 #endif
381 #endif
383 End-of-File
384 pmcpp $tmp.root 2>&1 | _filter
386 echo "---------------- 25 -----------------"
387 cat <<End-of-File >$tmp.root
388 root {
389 #undef foo
390 #ifndef foo
391 #undef nested
392 #ifndef nested /* <- error */
393 #endif
394 #endif
396 End-of-File
397 pmcpp $tmp.root 2>&1 | _filter
399 echo
400 echo "other #cpp line errors ..."
401 echo "---------------- 26 -----------------"
402 cat <<End-of-File >$tmp.root
403 root {
404 #fumble
406 End-of-File
407 pmcpp $tmp.root 2>&1 | _filter
409 # success, all done
410 exit