Drop unused condition check
[pcp.git] / qa / 274
blobd54e783615ce9d984492253bfeb414ebe80a9b5e
1 #! /bin/sh
2 # PCP QA Test No. 274
3 # Throw a broken PMDA at libpcp_pmda and dbpmda
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. 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=1
17 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
19 _filter()
21 # "dbpmda> $" filter for Linux
22 sed \
23 -e '/pmResult/s/0x[^ ]*/ADDR/g' \
24 -e '/pmResult/s/amp: 0.000000 .* numpmid:/amp: EPOCH in LOCALTIME numpmid:/' \
25 -e 's/\/tmp.*/logfile/g' \
26 -e 's/\(broken_pmda_2_[0-9]\)([0-9][0-9]*)/\1(PID)/' \
27 -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/' \
28 -e 's/ [0-9\.]*e-[0-9]* 0x/ REAL 0x/g' \
29 -e 's/ 0 0x/ REAL 0x/g' \
30 -e '/dbpmda> $/d' \
31 -e '/Error PDU:/s/One-line/Oneline/'
33 # last sed substitution thanks to pv:937345 which changed the wording
34 # ... preserving the old form so QA passes
37 _filter2()
39 sed \
40 -e 's/^\[.*\] broken_pmda_2_.([0-9]*)/broken pmda/g' \
41 -e '/Info: direct map =/d' \
42 -e '/Info: metric map =/d' \
43 -e 's/^Log for.*/Log started/g' \
44 -e 's/^Log finished.*/Log finished/g'
47 _filter_ins()
49 sed \
50 -e 's/.* \(hash table entries\)/ NNN \1/' \
51 -e 's/.* \(non-leaf nodes\)/ NNN \1/' \
52 -e 's/.* \(leaf nodes\)/ NNN \1/' \
53 -e 's/.* \(bytes of symbol table\)/ NNN \1/'
56 _filterStartBrokenPMDA25 () {
57 # This filter came about as a result of a different ordering of
58 # output in both stdout and stderr from dbpmda in PCP 2.1. This
59 # filter makes it appear as it would in PCP 2.2 onwards so that
60 # the test can detect changes to the text itself rather than the
61 # position of the line "Start broken_pmda_2_5 PMDA..." in the
62 # output for the dbpmda "open" command.
63 $PCP_AWK_PROG '
64 BEGIN { found = false }
65 /Start broken_pmda_2_5 PMDA: / {
66 if (found = false) found = $0
67 else found = found $0
68 next
70 /dbpmda> / {
71 if ( found != false ) {
72 print found
73 found = false
75 print $0
76 next
78 { print }
83 # real QA test starts here
84 unset ROOT MAKEFLAGS
86 # Install the PMDA
87 cd $here/pmdas/broken
88 $sudo ./broken_Install -N < /dev/null | _filter_ins
89 # ensure help text built (-N above skips this)
90 $sudo make broken_v2.dir > /dev/null 2>&1
91 cd $here
93 # Remove the PMDA
94 _remove()
96 cd $here/pmdas/broken
97 $sudo ./broken_Remove -N
98 cd $here
101 trap "_remove; exit \$status" 0 1 2 3 15
103 dbpmda -ie 2>&1 <<End-of-File | _filter
104 open pipe pmdas/broken/broken_pmda_2_0 -D47104 -l $tmp.log
105 status
106 # Test the valid metrics
107 fetch broken.valid.one broken.valid.two broken.valid.three
108 text broken.valid.one
109 # Test for metric not defined in table but in the PMNS and fetch callback
110 fetch broken.bogus.one
111 # Test for metric not defined in table and PMNS but in the fetch callback
112 fetch broken.bogus.two
113 # Test for metric defined in table and fetch, but not the pmns
114 fetch broken.no.pmns
115 # Test for multiple fetch with an invalid metric between valid metrics
116 fetch broken.valid.one broken.bogus.one broken.valid.two
117 # Test for illegal data types
118 fetch broken.bad.type
119 # Test for metric with no fetch support
120 fetch broken.no.fetch
121 # Test for metric with no help
122 fetch broken.no.help broken.no.shorthelp broken.no.longhelp
123 text broken.no.help
124 text broken.no.shorthelp
125 text broken.no.longhelp
126 # Test for handling of bad semantics
127 fetch broken.bad.semantics
128 # Test for handling of bad scale
129 fetch broken.bad.scale
130 # Test for handling of empty instance lists
131 fetch broken.no.instances
132 # Test for handling of missing instances in fetch
133 fetch broken.no.instfetch
134 close
135 quit
136 End-of-File
138 sleep 1
139 [ -f $tmp.log ] && cat $tmp.log | _filter2
140 rm -f $tmp.log
142 dbpmda -ie 2>&1 <<End-of-File | _filter
143 open pipe pmdas/broken/broken_pmda_2_1 -D47104 -l $tmp.log
144 status
145 wait 5
146 fetch broken.bad.indom
147 close
148 quit
149 End-of-File
151 sleep 1
152 [ -f $tmp.log ] && cat $tmp.log | _filter2
153 rm -f $tmp.log
155 dbpmda -ie 2>&1 <<End-of-File | _filter
156 open pipe pmdas/broken/broken_pmda_2_2 -D47104 -l $tmp.log
157 status
158 close
159 quit
160 End-of-File
162 sleep 1
163 [ -f $tmp.log ] && cat $tmp.log | _filter2
164 rm -f $tmp.log
166 dbpmda -ie 2>&1 <<End-of-File | _filter
167 open pipe pmdas/broken/broken_pmda_2_3 -D47104 -l $tmp.log
168 status
169 close
170 quit
171 End-of-File
173 sleep 1
174 [ -f $tmp.log ] && cat $tmp.log | _filter2
175 rm -f $tmp.log
177 dbpmda -ie 2>&1 <<End-of-File | _filter
178 open pipe pmdas/broken/broken_pmda_2_4 -D47104 -l $tmp.log
179 status
180 text broken.valid.one
181 close
182 quit
183 End-of-File
185 sleep 1
186 [ -f $tmp.log ] && cat $tmp.log | _filter2
187 rm -f $tmp.log
189 dbpmda -ie 2>&1 <<End-of-File | _filter | _filterStartBrokenPMDA25
190 open pipe pmdas/broken/broken_pmda_2_5 -D47104 -l $tmp.log
191 status
192 text broken.valid.one
193 close
194 quit
195 End-of-File
197 sleep 1
198 [ -f $tmp.log ] && cat $tmp.log | _filter2
199 rm -f $tmp.log
201 # all done
202 status=0
203 exit