Merge branch 'master' of https://github.com/kmcdonell/pcp into kenj-merge
[pcp.git] / qa / 464
blob0886b8c92ec11f90a8dfbd5010d36337ab904acf
1 #!/bin/sh
2 # PCP QA Test No. 464
3 # Test pmLoadASCIINameSpace with pmcpp instead of cpp
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
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 cat >$tmp.tmp
23 grep "^pmcpp:" <$tmp.tmp >$tmp.save
24 if [ -s $tmp.save ]
25 then
26 # pmcpp lines ... move 'em to the start
27 cat $tmp.save
28 grep -v "^pmcpp:" $tmp.tmp
29 else
30 cat $tmp.tmp
31 fi \
32 | sed \
33 -e "s;$tmp;TMP;g"
36 # real QA test starts here
37 echo "no error cases ..."
38 cat <<End-of-File >$tmp.root
39 root {
40 one 1:2:3
41 two
42 four
44 two {
45 three 4:5:6
47 four {
48 five
50 four.five {
51 six 7:8:9
53 End-of-File
54 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
55 cat $tmp.out $tmp.err | _filter
57 echo
58 cat <<End-of-File >$tmp.root
59 root {
60 one 1:2:3
61 #include "$tmp.1"
62 End-of-File
63 cat <<End-of-File >$tmp.1
64 two
65 four
67 two {
68 three 4:5:6
70 #include "$tmp.2"
71 End-of-File
72 cat <<End-of-File >$tmp.2
73 four {
74 five
76 four.five {
77 six 7:8:9
79 End-of-File
80 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
81 cat $tmp.out $tmp.err | _filter
82 rm -f $tmp.?
84 echo
85 cat <<End-of-File >$tmp.root
86 /* comment at the beginning */
87 root {
88 one 1:2:3
89 two
90 four
92 two {
93 three /*inline comment*/ 4:5:6
95 four {
96 five
98 four.five {
99 /**/six 7:8:9
102 * multi-line comment at the end
104 End-of-File
105 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
106 cat $tmp.out $tmp.err | _filter
108 echo
109 cat <<End-of-File >$tmp.root
110 #define one two
111 #define foo_path3 foo.three
112 #define THREE 3
113 #define FOUR 4
114 #define FIVE 5
115 root {
116 one 2:2:2
119 foo {
121 three
123 foo.one {
124 eek THREE:FOUR:FIVE
126 foo_path3 {
127 urk FIVE:FOUR:THREE
129 End-of-File
130 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
131 cat $tmp.out $tmp.err | _filter
133 echo
134 echo "#include errors ..."
135 cat <<End-of-File >$tmp.root
136 root {
137 #include $tmp.1
139 End-of-File
140 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
141 cat $tmp.out $tmp.err | _filter
142 rm -f $tmp.?
144 cat <<End-of-File >$tmp.root
145 root {
146 #include "$tmp.1
148 End-of-File
149 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
150 cat $tmp.out $tmp.err | _filter
152 cat <<End-of-File >$tmp.root
153 root {
154 #include "$tmp.1" junk
156 End-of-File
157 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
158 cat $tmp.out $tmp.err | _filter
159 rm -f $tmp.?
161 cat <<End-of-File >$tmp.root
162 root {
163 #include "$tmp.1"
165 End-of-File
166 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
167 cat $tmp.out $tmp.err | _filter
168 rm -f $tmp.?
170 cat <<End-of-File >$tmp.root
171 root {
172 zero 1:0:0
173 #include "$tmp.1"
175 End-of-File
176 cat <<End-of-File >$tmp.1
177 one 1:0:1
178 #include "$tmp.2"
179 End-of-File
180 cat <<End-of-File >$tmp.2
181 two 1:0:2
182 #include "$tmp.3"
183 End-of-File
184 cat <<End-of-File >$tmp.3
185 three 1:0:3
186 #include "$tmp.4"
187 End-of-File
188 cat <<End-of-File >$tmp.4
189 four 1:0:4
190 #include "$tmp.5"
191 End-of-File
192 pminfo -Dpmns -n $tmp.root -m >$tmp.out 2>$tmp.err
193 cat $tmp.out $tmp.err | _filter
194 rm -f $tmp.?
196 echo
197 echo "#define errors ..."
198 cat <<End-of-File >$tmp.root
199 root {
200 #define
202 End-of-File
203 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
204 cat $tmp.out $tmp.err | _filter
206 cat <<End-of-File >$tmp.root
207 root {
208 /* white space at the end of the next line */
209 #define
211 End-of-File
212 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
213 cat $tmp.out $tmp.err | _filter
215 cat <<End-of-File >$tmp.root
216 root {
217 #define foo
219 End-of-File
220 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
221 cat $tmp.out $tmp.err | _filter
223 cat <<End-of-File >$tmp.root
224 root {
225 #define bad_123_macro!name
227 End-of-File
228 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
229 cat $tmp.out $tmp.err | _filter
231 echo
232 echo "other #cpp line errors ..."
233 cat <<End-of-File >$tmp.root
234 root {
235 #fumble
237 End-of-File
238 pminfo -n $tmp.root -m >$tmp.out 2>$tmp.err
239 cat $tmp.out $tmp.err | _filter
241 # success, all done
242 exit