pmrep: fix archive end time reporting
[pcp.git] / qa / 156
blob8a5c561cb0170c48bb3de3d9bd80922b1c7eae78
1 #! /bin/sh
2 # PCP QA Test No. 156
3 # check out sample PMDA
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 filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
17 _wait_for_pmcd
18 _wait_for_pmlogger
20 _filter()
22 _filter_pmda_install | \
23 sed -e 's/ 13[0-9][0-9] values/ 1300+ values/' \
24 -e 's/ 1[0-9] warnings/ 10+ warnings/' \
25 -e 's/ 3 warnings/ 10+ warnings/' \
26 -e 's/ 1[0-9][0-9] metrics/ 100+ metrics/' \
27 -e "s;$tmp;TMP;" \
28 -e "s/$port1/PORT1/" \
29 -e "s/$port2/PORT2/"
32 _filter_rem()
34 sed \
35 -e '/mips_64/d' \
36 -e '/mips_o32/d' \
37 -e '/mips_n32/d'
40 _check_pmda_gone()
42 sleep 2
43 pminfo -v $1 && echo "Error: pminfo -v found some \"$1\" metrics"
44 $PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep "[p]mda$1" >$tmp.tmp
45 if [ -s $tmp.tmp ]
46 then
47 echo "Error: some \"$1\" PMDAs still present"
48 cat $tmp.tmp
50 rm -f $tmp.tmp
53 status=1
55 # save pmcd.conf and restore it after the test
56 cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
58 home=$PCP_PMDAS_DIR
59 iam=sample
60 if [ ! -d $home/$iam ]
61 then
62 echo "Where is $home/$iam?"
63 exit 1
65 cd $home/$iam
66 unset ROOT MAKEFLAGS
68 if [ ! -f dynamic.indom ]
69 then
70 echo "1 one" >$tmp.indom
71 echo "2 two" >>$tmp.indom
72 $sudo cp $tmp.indom dynamic.indom
75 # make sure sample agent is running again at the end, so other QA tests
76 # continue to work
78 trap "echo; echo 'Reinstall PMDA ...'; $sudo ./Install </dev/null >$tmp.out; _filter <$tmp.out; $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH; $sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15
80 # real QA test starts here
82 echo
83 echo "=== remove agent ==="
84 $sudo ./Remove >$tmp.out 2>&1
85 _filter_rem <$tmp.out
86 _check_pmda_gone $iam
88 echo
89 echo "=== pipe agent ==="
90 echo 'both
91 pipe' | $sudo ./Install -e >$tmp.out 2>&1
92 _filter <$tmp.out
93 pminfo -v sample || echo "... failed!"
94 echo 'both
95 pipe' | $sudo ./Install -e >$tmp.out 2>&1
96 _filter <$tmp.out
97 pminfo -v sample || echo "... failed!"
99 echo
100 echo "=== socket Internet agent ==="
102 # pick a tcp port that is not in use
104 port1=`_get_port tcp 5670 5689`
105 if [ -z "$port1" ]
106 then
107 echo "Arrgh ... no free TCP port in the range 5670 ... 5689"
108 exit 1
111 echo 'both
112 socket
113 Internet
114 '$port1 | $sudo ./Install -e >$tmp.out 2>&1
115 _filter <$tmp.out
116 pminfo -v sample || echo "... failed!"
118 # use next port this time
119 port2=`expr $port1 + 1`
121 echo 'both
122 socket
123 Internet
124 '$port2 | $sudo ./Install -e >$tmp.out 2>&1
125 _filter <$tmp.out
126 pminfo -v sample || echo "... failed!"
128 echo
129 echo "=== socket Unix agent ==="
130 echo 'both
131 socket
132 Unix
133 '"$tmp.fifo" | $sudo ./Install -e >$tmp.out 2>&1
134 _filter <$tmp.out
135 pminfo -v sample || echo "... failed!"
136 echo 'both
137 socket
138 Unix
139 '"$tmp.fifo" | $sudo ./Install -e >$tmp.out 2>&1
140 _filter <$tmp.out
141 pminfo -v sample || echo "... failed!"
143 $sudo ./Remove >$tmp.out 2>&1
144 _filter_rem <$tmp.out
145 _check_pmda_gone $iam
147 status=0
148 exit