/var/lib/pcp/testsuite/230 is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | #!/bin/sh
# PCP QA Test No. 230
#
# Check timeouts for pmlc's calls to __pmGetPDU
#
# Copyright (c) 2009 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=1
$sudo rm -rf $tmp.*
rm -f $seq.full
trap "_cleanup" 0 1 2 3 15
_cleanup()
{
if [ -f $PCP_TMP_DIR/pmlogger/primary.qa.$seq ]
then
$sudo cp $PCP_TMP_DIR/pmlogger/primary.qa.$seq $PCP_TMP_DIR/pmlogger/primary
$sudo rm -f $PCP_TMP_DIR/pmlogger/primary.qa.$seq
fi
_restore_primary_logger
rm -f $tmp.*
exit $status
}
_check()
{
echo "_check $1" >>$seq.full
sleep 2
pidlist=`_get_pids_by_name "pmlc"`
echo "pidlist=$pidlist" >>$seq.full
for pid in $pidlist
do
if [ "$pid" = "$1" ]
then
echo "pmlc still running ... killing it off"
kill -TERM $pid
return
fi
done
echo "pmlc has exited"
}
_filter()
{
echo >>$seq.full
echo "=== $tmp.out ===">>$seq.full
cat $tmp.out >>$seq.full
sed <$tmp.out \
-e 's/^\[.*]/[DATE]/' \
-e 's/pmlc([0-9][0-9]*)/pmlc(PID)/' \
-e "s/`pmhostname`/MYHOST/g" \
-e "s/`hostname`/MYHOST/g" \
-e "s/localhost\.localdomain/MYHOST/g" \
-e "s/localhost/MYHOST/g" \
-e "s/local:/MYHOST/g" \
-e '/^PMCD host/s/\( *\).*/\1HOST/' \
-e '/^log started/s/\( *\).*/\1DATE/' \
-e '/^last log entry/s/\( *\).*/\1DATE/' \
-e '/^current time/s/\( *\).*/\1DATE/' \
-e '/^log volume/s/\( *\).*/\1NUMBER/' \
-e '/^log size/s/\( *\).*/\1NUMBER/' \
}
if [ ! -f $PCP_TMP_DIR/pmlogger/primary ]
then
echo "Arrgh ... cannot find $PCP_TMP_DIR/pmlogger/primary"
status=1
exit
#NOTREACHED#
fi
# see comment in src/drain-server.c for choice of port #
#
port=1214
# real QA test starts here
_change_config pmcd on
_change_config pmlogger on
_writable_primary_logger
$sudo $PCP_RC_DIR/pcp restart >/dev/null 2>&1
_wait_for_pmlogger
$sudo sed -e "1s/.*/$port/" $PCP_TMP_DIR/pmlogger/primary >$tmp.primary
$sudo cp $PCP_TMP_DIR/pmlogger/primary $PCP_TMP_DIR/pmlogger/primary.qa.$seq
$sudo cp $tmp.primary $PCP_TMP_DIR/pmlogger/primary
echo "=== Hang on Connection Cases ===" | tee -a $seq.full
echo | tee -a $seq.full
echo "Expect hang ..." | tee -a $seq.full
src/drain-server -h &
draino=$!
sleep 2
pmlc -e -h localhost -P >$tmp.out 2>&1 &
sleep 2
_check $!
_filter
pidlist=`_get_pids_by_name "drain-server"`
for pid in $pidlist
do
[ "$draino" = "$pid" ] && kill -TERM $draino
done
sleep 2
echo | tee -a $seq.full
echo "Expect hang and warning ..." | tee -a $seq.full
src/drain-server -h &
draino=$!
sleep 2
export PMLOGGER_REQUEST_TIMEOUT=1.5
pmlc -e -h localhost -P >$tmp.out 2>&1 &
sleep 2
_check $!
_filter
pidlist=`_get_pids_by_name "drain-server"`
for pid in $pidlist
do
[ "$draino" = "$pid" ] && kill -TERM $draino
done
sleep 2
echo | tee -a $seq.full
echo "Expect no hang and unable to connect to pmlogger ..." | tee -a $seq.full
src/drain-server &
draino=$!
sleep 2
export PMLOGGER_REQUEST_TIMEOUT=1
pmlc -e -h localhost -P >$tmp.out 2>&1 </dev/null
_check $!
_filter
pidlist=`_get_pids_by_name "drain-server"`
for pid in $pidlist
do
[ "$draino" = "$pid" ] && kill -TERM $draino
done
echo | tee -a $seq.full
echo "=== Timeout on pmlc commands cases ===" | tee -a $seq.full
# put port info back to original state
#
$sudo cp $PCP_TMP_DIR/pmlogger/primary.qa.$seq $PCP_TMP_DIR/pmlogger/primary
$sudo rm -f $PCP_TMP_DIR/pmlogger/primary.qa.$seq
echo | tee -a $seq.full
echo "Check QA code cleared when pmlc exits ..." | tee -a $seq.full
unset PMLOGGER_REQUEST_TIMEOUT
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
qa 1
quit
End-of-File
_check $!
_filter
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
status
quit
End-of-File
_check $!
_filter
echo | tee -a $seq.full
echo "Expect no hang and log command to timeout connecting to pmcd ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
qa 1
log mandatory on once sample.long.million
quit
End-of-File
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect no hang and 2nd log command to timeout changing logging status ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
log mandatory on once sample.long.million
qa 1
log mandatory on once sample.long.million
quit
End-of-File
sleep 1 # pmlogger needs a little longer for this one
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect no hang and status command to timeout ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
qa 1
status
quit
End-of-File
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect hang and flush command to timeout ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
qa 1
flush
quit
End-of-File
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect hang and new volume command to timeout ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1 &
qa 1
new volume
quit
End-of-File
sleep 2
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
# skip show loggers command ... this one communicates with pmcd not
# pmlogger
#
#echo | tee -a $seq.full
#echo "Expect hang and show loggers to timeout ..." | tee -a $seq.full
#export PMLOGGER_REQUEST_TIMEOUT=1
#cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1 &
#qa 1
#show loggers
#quit
#End-of-File
#sleep 2
#_check $!
#_filter
#sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect no hang and query command to timeout connecting to pmcd ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
qa 1
query sample.long.million
quit
End-of-File
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
echo | tee -a $seq.full
echo "Expect no hang and 2nd query command to timeout fetching logging status ..." | tee -a $seq.full
export PMLOGGER_REQUEST_TIMEOUT=1
cat <<'End-of-File' | pmlc -e -P >$tmp.out 2>&1
query sample.long.million
qa 1
query sample.long.million
quit
End-of-File
sleep 1 # pmlogger needs a little longer for this one
_check $!
_filter
sleep 3 # let pmlogger get out of sleep() so can use pmlc again
# success, all done
status=0
exit
|