Merge branch 'master' of https://github.com/kmcdonell/pcp into kenj-merge
[pcp.git] / qa / 110
blob698f73068df2c9688b7029761d94da841e12c0d4
1 #! /bin/sh
2 # PCP QA Test No. 110
3 # check out simple 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 signal=$PCP_BINADM_DIR/pmsignal
17 status=1
19 ROOT_LOG_PATH=`echo $PCP_PMCDLOG_PATH | sed -e 's/pmcd.log/root.log/'`
20 PMDA_LOG_PATH=`echo $PCP_PMCDLOG_PATH | sed -e 's/pmcd.log/simple.log/'`
22 _cleanup()
24 [ -f $home/$iam/$iam.conf.$seq ] && _restore_config $home/$iam/$iam.conf
25 if diff $PCP_PMCDCONF_PATH.$seq $PCP_PMCDCONF_PATH > /dev/null 2>&1
26 then
27 _restore_config $PCP_PMCDCONF_PATH
28 else
30 # do a default install which ensures the pmns and any views are installed
32 $sudo ./Install < /dev/null > /dev/null 2>&1
34 # PMDA may have been installed differently to default. As everything is
35 # installed we can use the old pmcd.conf file to restore state.
37 if diff $PCP_PMCDCONF_PATH.$seq $PCP_PMCDCONF_PATH > /dev/null 2>&1
38 then
39 _restore_config $PCP_PMCDCONF_PATH
40 else
41 _restore_config $PCP_PMCDCONF_PATH
42 $sudo $signal -a -s HUP pmcd
46 _service pmlogger start >>$here/$seq.full
47 _wait_for_pmlogger
49 $sudo rm -f $tmp.*
50 exit $status
53 trap "_cleanup" 0 1 2 3 15
55 _failed()
57 echo
58 echo "... failed! ... here is the Install log ..."
59 cat $tmp.out
60 echo
61 echo "... and the tail of the pmcd log ..."
62 tail -20 $PCP_PMCDLOG_PATH
63 echo
64 echo "... and the root PMDA log ..."
65 cat $ROOT_LOG_PATH
66 echo
67 echo "...and the PMDA log ..."
68 cat $PMDA_LOG_PATH
71 _filter()
73 _filter_pmda_install | \
74 sed \
75 -e 's/ or perl//' \
76 -e 's/ or python//' \
77 -e "s;$tmp;TMP;" \
78 -e "s/$port1/PORT1/" \
79 -e "s/$port2/PORT2/"
82 _full()
84 echo "--- pmcd.conf ---" >>$here/$seq.full
85 cat $PCP_PMCDCONF_PATH >>$here/$seq.full
86 echo "--- pmcd.log ---" >>$here/$seq.full
87 cat $PCP_PMCDLOG_PATH >>$here/$seq.full
88 echo "--- root.log ---" >>$here/$seq.full
89 if [ -f $ROOT_LOG_PATH ]
90 then
91 cat $ROOT_LOG_PATH >>$here/$seq.full
92 else
93 echo "$ROOT_LOG_PATH: file not found" >>$here/$seq.full
95 echo "--- simple.log ---" >>$here/$seq.full
96 if [ -f $PMDA_LOG_PATH ]
97 then
98 cat $PMDA_LOG_PATH >>$here/$seq.full
99 else
100 echo "$PMDA_LOG_PATH: file not found" >>$here/$seq.full
102 echo >>$here/$seq.full
105 rm -f $seq.full
107 # pmlogger may get confused by pmcd reconfig ... safest to stop it
108 # first, and restart it in cleanup()
110 _service pmlogger stop >>$here/$seq.full
112 # real QA test starts here
113 home=$PCP_PMDAS_DIR
114 iam=simple
115 if [ ! -d $home/$iam ]
116 then
117 echo "Where is $home/$iam?"
118 exit 1
120 cd $home/$iam
121 unset ROOT MAKEFLAGS
123 # copy the pmcd config file to restore state later.
124 _save_config $PCP_PMCDCONF_PATH
125 # ditto for simple pmda config
126 [ -f $home/$iam/$iam.conf ] && _save_config $home/$iam/$iam.conf
128 if $sudo $PCP_MAKE_PROG clobber >$tmp.out 2>&1
129 then
131 else
132 cat $tmp.out
133 echo "Arrgh, make clobber failed"
134 exit
137 # start from a known starting point
138 $sudo ./Remove >/dev/null 2>&1
140 echo
141 echo "=== pipe daemon agent ==="
142 echo "=== pipe daemon agent ===" >>$here/$seq.full
143 $sudo ./Remove >$tmp.out 2>&1
144 $sudo rm -f $PMDA_LOG_PATH
145 echo 'both
146 daemon
147 pipe' | $sudo ./Install -e >>$tmp.out 2>&1
148 _full
150 _filter <$tmp.out
152 if pminfo -v simple
153 then
155 else
156 _failed
159 echo
160 echo "=== Unix socket daemon agent ==="
161 echo "=== Unix socket daemon agent ===" >>$here/$seq.full
162 $sudo ./Remove >$tmp.out 2>&1
163 echo 'both
164 daemon
165 socket
166 Unix
167 '"$tmp.fifo-1" | $sudo ./Install -e >>$tmp.out 2>&1
168 $sudo rm -f $PMDA_LOG_PATH
169 echo 'both
170 daemon
171 socket
172 Unix
173 '"$tmp.fifo-2" | $sudo ./Install -e >>$tmp.out 2>&1
174 _full
176 _filter <$tmp.out
178 if pminfo -v simple
179 then
181 else
182 _failed
185 echo
186 echo "=== Internet socket daemon agent ==="
187 echo "=== Internet socket daemon agent ===" >>$here/$seq.full
188 $sudo ./Remove >$tmp.out 2>&1
190 # pick a tcp port that is not in use
192 port1=`_get_port tcp 5650 5699`
193 if [ -z "$port1" ]
194 then
195 echo "Arrgh ... no free TCP port in the range 5650 ... 5699"
196 exit 1
199 echo 'both
200 daemon
201 socket
202 Internet
203 '$port1 | $sudo ./Install -e >>$tmp.out 2>&1
205 # use next port this time
206 port2=`expr $port1 + 1`
208 $sudo rm -f $PMDA_LOG_PATH
209 echo 'both
210 daemon
211 socket
212 Internet
213 '$port2 | $sudo ./Install -e >>$tmp.out 2>&1
214 _full
216 _filter <$tmp.out
218 if pminfo -v simple
219 then
221 else
222 _failed
225 echo
226 echo "=== dso agent ==="
227 echo "=== dso agent ===" >>$here/$seq.full
228 $sudo ./Remove >$tmp.out 2>&1
229 echo 'both
230 dso' | $sudo ./Install -e >>$tmp.out 2>&1
231 $sudo rm -f $PMDA_LOG_PATH
232 echo 'both
233 dso' | $sudo ./Install -e >>$tmp.out 2>&1
234 _full
236 _filter <$tmp.out
238 if pminfo -v simple
239 then
241 else
242 _failed
245 $sudo ./Remove >$tmp.out 2>&1
246 _filter <$tmp.out
248 status=0
249 exit