4 # Check timeouts for pmlc's calls to __pmGetPDU
6 # Copyright (c) 2009 Ken McDonell. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
20 trap "_cleanup" 0 1 2 3 15
24 if [ -f $PCP_TMP_DIR/pmlogger
/primary.qa.
$seq ]
26 $sudo cp $PCP_TMP_DIR/pmlogger
/primary.qa.
$seq $PCP_TMP_DIR/pmlogger
/primary
27 $sudo rm -f $PCP_TMP_DIR/pmlogger
/primary.qa.
$seq
29 _restore_primary_logger
36 echo "_check $1" >>$seq.full
38 pidlist
=`_get_pids_by_name "pmlc"`
39 echo "pidlist=$pidlist" >>$seq.full
44 echo "pmlc still running ... killing it off"
49 echo "pmlc has exited"
55 echo "=== $tmp.out ===">>$seq.full
56 cat $tmp.out
>>$seq.full
58 -e 's/^\[.*]/[DATE]/' \
59 -e 's/pmlc([0-9][0-9]*)/pmlc(PID)/' \
60 -e "s/`pmhostname`/MYHOST/g" \
61 -e "s/`hostname`/MYHOST/g" \
62 -e "s/localhost\.localdomain/MYHOST/g" \
63 -e "s/localhost/MYHOST/g" \
64 -e "s/local:/MYHOST/g" \
65 -e '/^PMCD host/s/\( *\).*/\1HOST/' \
66 -e '/^log started/s/\( *\).*/\1DATE/' \
67 -e '/^last log entry/s/\( *\).*/\1DATE/' \
68 -e '/^current time/s/\( *\).*/\1DATE/' \
69 -e '/^log volume/s/\( *\).*/\1NUMBER/' \
70 -e '/^log size/s/\( *\).*/\1NUMBER/' \
71 -e '/__pmCloseChannelbyFd/d' \
75 if [ ! -f $PCP_TMP_DIR/pmlogger
/primary
]
77 echo "Arrgh ... cannot find $PCP_TMP_DIR/pmlogger/primary"
83 # see comment in src/drain-server.c for choice of port #
87 # real QA test starts here
88 _change_config pmcd on
89 _change_config pmlogger on
90 _writable_primary_logger
91 $sudo $PCP_RC_DIR/pcp restart
>/dev
/null
2>&1
94 $sudo sed -e "1s/.*/$port/" $PCP_TMP_DIR/pmlogger
/primary
>$tmp.primary
95 $sudo cp $PCP_TMP_DIR/pmlogger
/primary
$PCP_TMP_DIR/pmlogger
/primary.qa.
$seq
96 $sudo cp $tmp.primary
$PCP_TMP_DIR/pmlogger
/primary
98 echo "=== Hang on Connection Cases ===" |
tee -a $seq.full
100 echo |
tee -a $seq.full
101 echo "Expect hang ..." |
tee -a $seq.full
102 src
/drain-server
-h &
105 pmlc
-e -h localhost
-P >$tmp.out
2>&1 &
109 pidlist
=`_get_pids_by_name "drain-server"`
112 [ "$draino" = "$pid" ] && kill -TERM $draino
116 echo |
tee -a $seq.full
117 echo "Expect hang and warning ..." |
tee -a $seq.full
118 src
/drain-server
-h &
121 export PMLOGGER_REQUEST_TIMEOUT
=1.5
122 pmlc
-e -h localhost
-P >$tmp.out
2>&1 &
126 pidlist
=`_get_pids_by_name "drain-server"`
129 [ "$draino" = "$pid" ] && kill -TERM $draino
133 echo |
tee -a $seq.full
134 echo "Expect no hang and unable to connect to pmlogger ..." |
tee -a $seq.full
138 export PMLOGGER_REQUEST_TIMEOUT
=1
139 pmlc
-e -h localhost
-P >$tmp.out
2>&1 </dev
/null
142 pidlist
=`_get_pids_by_name "drain-server"`
145 [ "$draino" = "$pid" ] && kill -TERM $draino
148 echo |
tee -a $seq.full
149 echo "=== Timeout on pmlc commands cases ===" |
tee -a $seq.full
151 # put port info back to original state
153 $sudo cp $PCP_TMP_DIR/pmlogger
/primary.qa.
$seq $PCP_TMP_DIR/pmlogger
/primary
154 $sudo rm -f $PCP_TMP_DIR/pmlogger
/primary.qa.
$seq
156 echo |
tee -a $seq.full
157 echo "Check QA code cleared when pmlc exits ..." |
tee -a $seq.full
158 unset PMLOGGER_REQUEST_TIMEOUT
159 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
165 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
172 echo |
tee -a $seq.full
173 echo "Expect no hang and log command to timeout connecting to pmcd ..." |
tee -a $seq.full
174 export PMLOGGER_REQUEST_TIMEOUT
=1
175 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
177 log mandatory on once sample.long.million
182 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
184 echo |
tee -a $seq.full
185 echo "Expect no hang and 2nd log command to timeout changing logging status ..." |
tee -a $seq.full
186 export PMLOGGER_REQUEST_TIMEOUT
=1
187 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
188 log mandatory on once sample.long.million
190 log mandatory on once sample.long.million
193 sleep 1 # pmlogger needs a little longer for this one
196 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
198 echo |
tee -a $seq.full
199 echo "Expect no hang and status command to timeout ..." |
tee -a $seq.full
200 export PMLOGGER_REQUEST_TIMEOUT
=1
201 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
208 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
210 echo |
tee -a $seq.full
211 echo "Expect hang and flush command to timeout ..." |
tee -a $seq.full
212 export PMLOGGER_REQUEST_TIMEOUT
=1
213 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
220 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
222 echo |
tee -a $seq.full
223 echo "Expect hang and new volume command to timeout ..." |
tee -a $seq.full
224 export PMLOGGER_REQUEST_TIMEOUT
=1
225 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1 &
233 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
235 # skip show loggers command ... this one communicates with pmcd not
238 #echo | tee -a $seq.full
239 #echo "Expect hang and show loggers to timeout ..." | tee -a $seq.full
240 #export PMLOGGER_REQUEST_TIMEOUT=1
241 #cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1 &
249 #sleep 3 # let pmlogger get out of sleep() so can use pmlc again
251 echo |
tee -a $seq.full
252 echo "Expect no hang and query command to timeout connecting to pmcd ..." |
tee -a $seq.full
253 export PMLOGGER_REQUEST_TIMEOUT
=1
254 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
256 query sample.long.million
261 sleep 3 # let pmlogger get out of sleep() so can use pmlc again
263 echo |
tee -a $seq.full
264 echo "Expect no hang and 2nd query command to timeout fetching logging status ..." |
tee -a $seq.full
265 export PMLOGGER_REQUEST_TIMEOUT
=1
266 cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
267 query sample.long.million
269 query sample.long.million
272 sleep 1 # pmlogger needs a little longer for this one
275 sleep 3 # let pmlogger get out of sleep() so can use pmlc again