/var/lib/pcp/testsuite/200 is in pcp-testsuite 4.0.1-1.
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 | #! /bin/sh
# PCP QA Test No. 200
# $PMCD_RECONNECT_TIMEOUT validation
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
status=1
rm -f $seq.full
trap _cleanup 0 1 2 3 15
_stop_auto_restart pmcd
_cleanup()
{
[ -f $tmp.pmcd.conf ] && $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH
[ "$PCP_PLATFORM" != "linux" ] && _change_config pmlogger on
_service pcp restart >/dev/null
_restore_auto_restart pmcd
_wait_for_pmcd
_wait_for_pmlogger
$sudo rm -f $tmp.pmcd.conf
rm -f $tmp.*
exit $status
}
_wait_for_pmcd_exit()
{
# 3 seconds default seems like a reasonble max time to cleanup
#debug# set -x
_can_wait=${1-3}
_i=0
_dead=false
while [ $_i -lt $_can_wait ]
do
if netstat -t -n -l | grep :44321 >/dev/null
then
sleep 1
_i=`expr $_i + 1`
else
_dead=true
break
fi
done
if $_dead
then
:
else
date
echo "Arrgghhh ... pmcd at $_host failed to stop after $_can_wait seconds"
case $_host
in
localhost|unix:|local:|`hostname`)
# these are all local PMCD's
#
echo "=== pmcd.log ==="
cat $PCP_LOG_DIR/pmcd/pmcd.log
echo "likely looking processes ..."
ps "$PCP_PS_ALL_FLAGS" | egrep "[p]m|[P]ID"
;;
*)
# assume a remote PMCD
#
ssh pcpqa@$_host "sh -c '. \$PCP_DIR/etc/pcp.env; echo; echo "=== pmcd.log ==="; [ -f \$PCP_LOG_DIR/pmcd/pmcd.log ] && cat \$PCP_LOG_DIR/pmcd/pmcd.log; [ -f \$PCP_LOG_DIR/pmcd.log ] && cat \$PCP_LOG_DIR/pmcd.log; echo; echo likely looking processes ...; ( ps \$PCP_PS_ALL_FLAGS | egrep \"[p]m|[P]ID\" )'" </dev/null
;;
esac
status=2
exit $status
fi
}
_filter()
{
$PCP_AWK_PROG '
BEGIN { last = "" }
$0 != last { print; last = $0 }' \
| sed \
-e 's/failed: Connection reset by peer/failed: IPC protocol failure/' \
-e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/' \
-e '/recon([0-9][0-9]*)/s//recon(PID)/' \
-e '/^Context\[/d' \
-e '/^contexts\[/d' \
-e '/^pmReconnectContext(/d' \
-e '/^Dump Contexts:/d' \
-e '/^Dump Instance Profile /d' \
-e '/^IPC table fd/d' \
-e '/^__pmConnectPMCD(/d' \
-e '/^__pmDecodeXtendError:/d' \
-e '/^pmNewContext(/d' \
-e '/^__pmSendCreds:/d' \
-e '/^__pmSetSocketIPC:/d' \
-e '/^__pmSetVersionIPC:/d' \
-e '/^__pmSetFeaturesIPC:/d' \
-e '/^__pmDataIPC: /d' \
-e '/^__pmSetDataIPC:/d' \
-e '/^pmWhichContext(/d' \
-e '/__pmConnect(fd=.*) ->/d' \
-e '/__pmCloseChannelbyContext/d' \
| $PCP_AWK_PROG '
/delay: 2 / { print "delay: 2-4 secs"; next }
/delay: 3 / { print "delay: 2-4 secs"; next }
/delay: 4 / { print "delay: 2-4 secs"; next }
/delay: 5 / { print "delay: 5-7 secs"; next }
/delay: 6 / { print "delay: 5-7 secs"; next }
/delay: 7 / { print "delay: 5-7 secs"; next }
{ print }'
# note: now that pmcd starts and stops very quickly, we use a
# strategy in testing valid reconnect strings with less-than-
# five-seconds (alot less) and any errors fall back to using
# the defaults, which are 5,10,etc.
}
cat >$tmp.new <<End-of-File
# From QA 200
#
# Name Id IPC IPC Params File/Cmd
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.$DSO_SUFFIX
sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
End-of-File
# copy the pmcd config file to restore state later.
$sudo cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
$sudo cp $tmp.new $PCP_PMCDCONF_PATH
# ensure we have pmcd ready for the first iteration.
# just doing a start may race and find the pmcd socket busy,
# so stop, wait a little, and start
_service pcp stop >/dev/null 2>&1
_wait_for_pmcd_exit
_service pmcd start >/dev/null 2>&1
_wait_for_pmcd
# real QA test starts here
for xxx in "" "1,1,2,2" "2" "1-2" "1,2,foo"
do
if [ "X$xxx" = X ]
then
unset PMCD_RECONNECT_TIMEOUT
else
PMCD_RECONNECT_TIMEOUT="$xxx"
export PMCD_RECONNECT_TIMEOUT
fi
echo
echo "PMCD_RECONNECT_TIMEOUT=\"$PMCD_RECONNECT_TIMEOUT\""
echo "start PMCD_RECONNECT_TIMEOUT=$PMCD_RECONNECT_TIMEOUT" >>$seq.full
echo "start `date`" >>$seq.full
DEBUG=
DEBUG=-D16
src/recon $DEBUG >$tmp.out 2>&1 &
pmsleep 1.1
echo "begin stop pmcd `date`" >>$seq.full
_service pmcd stop | _filter_pcp_stop
echo "end stop pmcd `date`" >>$seq.full
_wait_for_pmcd_exit
pmsleep 1.1
echo "begin start pmcd `date`" >>$seq.full
_service pmcd start \
| _filter_pcp_start
echo "end start pmcd `date`" >>$seq.full
wait
_filter <$tmp.out
cat $tmp.out >>$seq.full
done
status=0
exit
|