zsh completions: minor tweaks
[pcp.git] / qa / 110
blobdf1fb36b7a60f81f962694fe0b10cd79ae600eff
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
45 $sudo rm -f $tmp.*
46 exit $status
49 trap "_cleanup" 0 1 2 3 15
51 _failed()
53 echo
54 echo "... failed! ... here is the Install log ..."
55 cat $tmp.out
56 echo
57 echo "... and the tail of the pmcd log ..."
58 tail -20 $PCP_PMCDLOG_PATH
59 echo
60 echo "... and the root PMDA log ..."
61 cat $ROOT_LOG_PATH
62 echo
63 echo "...and the PMDA log ..."
64 cat $PMDA_LOG_PATH
67 _filter()
69 _filter_pmda_install | \
70 sed \
71 -e 's/ or perl//' \
72 -e 's/ or python//' \
73 -e "s;$tmp;TMP;" \
74 -e "s/$port1/PORT1/" \
75 -e "s/$port2/PORT2/"
78 _full()
80 echo "--- pmcd.conf ---" >>$here/$seq.full
81 cat $PCP_PMCDCONF_PATH >>$here/$seq.full
82 echo "--- pmcd.log ---" >>$here/$seq.full
83 cat $PCP_PMCDLOG_PATH >>$here/$seq.full
84 echo "--- root.log ---" >>$here/$seq.full
85 if [ -f $ROOT_LOG_PATH ]
86 then
87 cat $ROOT_LOG_PATH >>$here/$seq.full
88 else
89 echo "$ROOT_LOG_PATH: file not found" >>$here/$seq.full
91 echo "--- simple.log ---" >>$here/$seq.full
92 if [ -f $PMDA_LOG_PATH ]
93 then
94 cat $PMDA_LOG_PATH >>$here/$seq.full
95 else
96 echo "$PMDA_LOG_PATH: file not found" >>$here/$seq.full
98 echo >>$here/$seq.full
101 rm -f $seq.full
103 # real QA test starts here
104 home=$PCP_PMDAS_DIR
105 iam=simple
106 if [ ! -d $home/$iam ]
107 then
108 echo "Where is $home/$iam?"
109 exit 1
111 cd $home/$iam
112 unset ROOT MAKEFLAGS
114 # copy the pmcd config file to restore state later.
115 _save_config $PCP_PMCDCONF_PATH
116 # ditto for simple pmda config
117 [ -f $home/$iam/$iam.conf ] && _save_config $home/$iam/$iam.conf
119 if $sudo $PCP_MAKE_PROG clobber >$tmp.out 2>&1
120 then
122 else
123 cat $tmp.out
124 echo "Arrgh, make clobber failed"
125 exit
128 # start from a known starting point
129 $sudo ./Remove >/dev/null 2>&1
131 echo
132 echo "=== pipe daemon agent ==="
133 echo "=== pipe daemon agent ===" >>$here/$seq.full
134 $sudo ./Remove >$tmp.out 2>&1
135 $sudo rm -f $PMDA_LOG_PATH
136 echo 'both
137 daemon
138 pipe' | $sudo ./Install -e >>$tmp.out 2>&1
139 _full
141 _filter <$tmp.out
143 if pminfo -v simple
144 then
146 else
147 _failed
150 echo
151 echo "=== Unix socket daemon agent ==="
152 echo "=== Unix socket daemon agent ===" >>$here/$seq.full
153 $sudo ./Remove >$tmp.out 2>&1
154 echo 'both
155 daemon
156 socket
157 Unix
158 '"$tmp.fifo-1" | $sudo ./Install -e >>$tmp.out 2>&1
159 $sudo rm -f $PMDA_LOG_PATH
160 echo 'both
161 daemon
162 socket
163 Unix
164 '"$tmp.fifo-2" | $sudo ./Install -e >>$tmp.out 2>&1
165 _full
167 _filter <$tmp.out
169 if pminfo -v simple
170 then
172 else
173 _failed
176 echo
177 echo "=== Internet socket daemon agent ==="
178 echo "=== Internet socket daemon agent ===" >>$here/$seq.full
179 $sudo ./Remove >$tmp.out 2>&1
181 # pick a tcp port that is not in use
183 port1=`_get_port tcp 5650 5699`
184 if [ -z "$port1" ]
185 then
186 echo "Arrgh ... no free TCP port in the range 5650 ... 5699"
187 exit 1
190 echo 'both
191 daemon
192 socket
193 Internet
194 '$port1 | $sudo ./Install -e >>$tmp.out 2>&1
196 # use next port this time
197 port2=`expr $port1 + 1`
199 $sudo rm -f $PMDA_LOG_PATH
200 echo 'both
201 daemon
202 socket
203 Internet
204 '$port2 | $sudo ./Install -e >>$tmp.out 2>&1
205 _full
207 _filter <$tmp.out
209 if pminfo -v simple
210 then
212 else
213 _failed
216 echo
217 echo "=== dso agent ==="
218 echo "=== dso agent ===" >>$here/$seq.full
219 $sudo ./Remove >$tmp.out 2>&1
220 echo 'both
221 dso' | $sudo ./Install -e >>$tmp.out 2>&1
222 $sudo rm -f $PMDA_LOG_PATH
223 echo 'both
224 dso' | $sudo ./Install -e >>$tmp.out 2>&1
225 _full
227 _filter <$tmp.out
229 if pminfo -v simple
230 then
232 else
233 _failed
236 $sudo ./Remove >$tmp.out 2>&1
237 _filter <$tmp.out
239 status=0
240 exit