Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 581
blobb8223a39a616bb9417b0925f6bf1b9366be2fda3
1 #! /bin/sh
2 # PCP QA Test No. 581
3 # pmie, #687355
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 signal=$PCP_BINADM_DIR/pmsignal
17 status=1 # failure is the default!
18 control=$PCP_PMDAS_DIR/sample/dynamic.indom
19 needclean=true
21 HOST=`hostname`
23 cat <<End-of-File >$tmp.pmie
24 // disk indom
25 some_inst disk.dev.total >= 0 -> print "\nDISK %i";
27 // cpu indom
28 some_inst kernel.percpu.cpu.user >= 0 -> print "\nCPU %i";
29 End-of-File
31 if [ $PCP_PLATFORM != solaris ]
32 then
33 cat <<End-of-File >>$tmp.pmie
35 // network interface indom
36 some_inst network.interface.total.packets >= 0 -> print "\nNETWORK %i";
38 // filesys indom
39 some_inst filesys.capacity >= 0 -> print "\nFILESYS %i";
40 End-of-File
43 cat <<End-of-File >>$tmp.pmie
45 // sample.mirage
46 some_inst sample.mirage >= 0 -> print "\nMIRAGE %i";
48 // the dynamic ones ...
49 some_inst sample.dynamic.discrete >= 0 -> print "DYN_DISCRETE" " %i";
50 some_inst sample.dynamic.instant >= 0 -> print "DYN_INSTANT" " %i";
51 End-of-File
53 _cleanup()
55 if $needclean
56 then
57 $sudo rm -f $control
58 [ -f $control.$seq ] && $sudo mv $control.$seq $control
59 _restore_loggers
60 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
61 _wait_for_pmcd
62 _wait_for_pmlogger
63 needlcean=false
65 $sudo rm -f $tmp.*
68 _filter()
70 sed \
71 -e '/value/s/ [0-9]*$/ N/'
74 $sudo rm -f $control.$seq
75 trap "_cleanup; exit \$status" 0 1 2 3 15
76 [ -f $control ] && $sudo mv $control $control.$seq
78 PMCD_RECONNECT_TIMEOUT=1
79 export PMCD_RECONNECT_TIMEOUT
81 # instances - mk I
83 cat >$tmp.indom <<End-of-File
84 10 ten
85 20 twenty
86 30 thirty
87 End-of-File
89 $sudo rm -f $control
90 $sudo cp $tmp.indom $control
91 _disable_loggers
92 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
93 _wait_for_pmcd
94 pminfo -f sample.dynamic.instant | _filter
95 echo
97 # real QA test starts here
99 pmie -t 250msec -c $tmp.pmie >$tmp.out 2>&1 &
100 pid_pmie=$!
102 # sleep_stop time to sleep before stopping pmcd
103 # sleep_start time to sleep before starting pmcd
104 sleep_start=4
105 sleep_stop=5
107 # and again with the same instances
109 sleep $sleep_stop
110 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
111 sleep $sleep_start
112 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
113 _wait_for_pmcd
114 pminfo -f sample.dynamic.instant |_filter
115 echo
117 # instances - mk II
119 sleep $sleep_stop
120 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
121 cat >$tmp.indom <<End-of-File
122 20 twenty
123 25 twenty-five
124 30 thirty
125 40 forty
126 49 forty-nine
127 50 fifty
128 58 fifty-eight
129 106 one-hundred-and-six
130 End-of-File
131 $sudo cp $tmp.indom $control
132 sleep $sleep_start
133 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
134 _wait_for_pmcd
135 pminfo -f sample.dynamic.instant |_filter
136 echo
138 # instances - mk III
140 sleep $sleep_stop
141 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
142 cat >$tmp.indom <<End-of-File
143 07 seven
144 08 eight
145 10 ten
146 20 twenty
147 30 thirty-*
148 100 one-hundred
149 End-of-File
150 $sudo cp $tmp.indom $control
151 sleep $sleep_start
152 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
153 _wait_for_pmcd
154 pminfo -f sample.dynamic.instant |_filter
155 echo
157 # instances - mk IV
159 sleep $sleep_stop
160 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
161 cat >$tmp.indom <<End-of-File
162 End-of-File
163 $sudo cp $tmp.indom $control
164 sleep $sleep_start
165 $sudo $PCP_RC_DIR/pcp start | _filter_pcp_start
166 _wait_for_pmcd
167 pminfo -f sample.dynamic.instant |_filter
168 echo
170 sleep $sleep_stop
171 $signal -s TERM $pid_pmie
172 wait
174 cp $tmp.out $seq.full
176 echo
177 echo "Expect only connection lost/re-established and DYN_* lines ..."
178 echo
180 # in addition to the regular filtering, some versions of Linux return
181 # ECONNRESET on the write() when pmcd is signald, rather than waiting
182 # to return the error on the following read() ... as far as this test
183 # is concerned, these are synonyms
185 _filter_pmie_log <$tmp.out \
186 | sed \
187 -e "/ Error: /s/$HOST/HOST/g" \
188 -e "/ Error: /s/local:/HOST/g" \
189 -e "/ Error: /s/localhost/HOST/g" \
190 -e "/ Info: /s/$HOST/HOST/g" \
191 -e "/ Info: /s/localhost/HOST/g" \
192 -e "/ Info: /s/local:/HOST/g" \
193 -e '/ Error: __pmCloseChannelbyContext: /d' \
194 -e 's/failed: Connection reset by peer/failed: IPC protocol failure/' \
195 -e '/^DATE: *$/d' \
196 -e '/^FILESYS \/dev\//d' \
197 -e '/^FILESYS \/dev$/d' \
198 -e '/^FILESYS none$/d' \
199 -e '/^FILESYS devfs$/d' \
200 -e '/^FILESYS map -hosts$/d' \
201 -e '/^FILESYS map auto_home$/d' \
202 -e '/^MIRAGE m-[0-9][0-9]*$/d' \
203 -e '/^DISK dks[0-9][0-9]*d[0-9][0-9]*/d' \
204 -e '/^DISK [a-f0-9][a-f0-9]*\/lun[0-9][0-9]*\/c[0-9][0-9]*p[0-9][0-9]*/d' \
205 -e '/^DISK hd[a-z]/d' \
206 -e '/^DISK sd[a-z0-9]/d' \
207 -e '/^DISK dasd[a-z]/d' \
208 -e '/^DISK mmcblk[0-9]/d' \
209 -e '/^DISK cmdk[0-9]/d' \
210 -e '/^DISK rd\//d' \
211 -e '/^DISK scsi\/host/d' \
212 -e '/^DISK vd[a-z]/d' \
213 -e '/^DISK xscsi\/pci/d' \
214 -e '/^DISK xvm\//d' \
215 -e '/^DISK disk[0-9][0-9]*$/d' \
216 -e '/^CPU cpu[0-9][0-9]*$/d' \
217 -e '/^CPU cpu:[0-9][0-9]*\.[0-9][0-9]*\.[ab]$/d' \
218 -e '/^CPU cpu:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[a-d]$/d' \
219 -e '/^NETWORK dummy[0-9]/d' \
220 -e '/^NETWORK br[0-9][0-9]*$/d' \
221 -e '/^NETWORK enccw[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/d' \
222 -e '/^NETWORK docker[0-9][0-9]*$/d' \
223 -e '/^NETWORK e[cfmnt][0-9][0-9]*$/d' \
224 -e '/^NETWORK eno[0-9]*d[0-9]*$/d' \
225 -e '/^NETWORK eno[0-9]*$/d' \
226 -e '/^NETWORK ens[0-9]*$/d' \
227 -e '/^NETWORK enp[0-9][0-9]*s[0-9][0-9]*$/d' \
228 -e '/^NETWORK enp[0-9][0-9]*s[0-9][0-9]*f[0-9][0-9]*$/d' \
229 -e '/^NETWORK enp[0-9][0-9]*s[0-9][0-9]*f[0-9][0-9]*u[0-9][0-9]*$/d' \
230 -e '/^NETWORK enP[0-9][0-9]*p[0-9][0-9]*s[0-9][0-9]*f[0-9][0-9]*$/d' \
231 -e '/^NETWORK eth[0-9]/d' \
232 -e '/^NETWORK fw[0-9][0-9]*$/d' \
233 -e '/^NETWORK gif[0-9][0-9]*$/d' \
234 -e '/^NETWORK lo[0-9][0-9]*$/d' \
235 -e '/^NETWORK lo$/d' \
236 -e '/^NETWORK p[0-9][0-9]*p[0-9][0-9]*$/d' \
237 -e '/^NETWORK pan[0-9][0-9]*$/d' \
238 -e '/^NETWORK ppp[0-9][0-9]*$/d' \
239 -e '/^NETWORK sit[0-9]/d' \
240 -e '/^NETWORK sl[0-9][0-9]*$/d' \
241 -e '/^NETWORK stf[0-9][0-9]*$/d' \
242 -e '/^NETWORK tun[0-9][0-9]*$/d' \
243 -e '/^NETWORK usb[0-9][0-9]*$/d' \
244 -e '/^NETWORK vde[0-9][0-9]*$/d' \
245 -e '/^NETWORK veth[a-f0-9][a-f0-9]*$/d' \
246 -e '/^NETWORK vnet[0-9][0-9]*$/d' \
247 -e '/^NETWORK virbr[0-9][0-9]*$/d' \
248 -e '/^NETWORK virbr[0-9][0-9]*-nic$/d' \
249 -e '/^NETWORK wlan[0-9][0-9]*$/d' \
250 -e '/^NETWORK wlp[0-9][0-9]*s[0-9][0-9]*$/d' \
251 -e '/^NETWORK wwan[0-9][0-9]*$/d' \
252 -e '/^NETWORK wmaster[0-9][0-9]*$/d' \
253 -e '/^NETWORK xp[0-9][0-9]*$/d' \
254 | $PCP_AWK_PROG '
255 BEGIN { last["DYN_DISCRETE"] = last["DYN_INSTANT"] = "" }
256 $2 ~ /DYN_/ { if (last[$2] != $0) {
257 print $0
258 last[$2] = $0
260 next
262 { print }
263 /Lost connection/ { last["DYN_DISCRETE"] = last["DYN_INSTANT"] = "" }'
265 # success, all done
266 status=0
267 exit