/var/lib/pcp/testsuite/956 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 | #!/bin/sh
# PCP QA Test No. 956
# Exercise pmcd attribute PDU handling after agent failure.
#
# Copyright (c) 2015 Red Hat.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_get_libpcp_config
$unix_domain_sockets || _notrun "No unix domain socket support available"
_filter()
{
sed -e 's/\.\.\.*/\.\.\./g'
}
_cleanup()
{
_service pmcd stop | _filter_pcp_stop
unset PMCD_PORT
_restore_config $PCP_PMCDOPTIONS_PATH
_service pcp start | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
if pmprobe -I pmcd.agent.status | grep '"dynamic"' >/dev/null
then
cd $here/pmdas/dynamic
$sudo ./Remove >>$here/$seq.full 2>&1
cd $here
fi
$sudo rm -f $tmp.*
}
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
signal=$PCP_BINADM_DIR/pmsignal
trap "_cleanup; exit \$status" 0 1 2 3 15
port=`_get_port tcp 6060 6070`
if [ -z "$port" ]
then
echo "Arrggh ... no free TCP port in the range 6060 ... 6070"
$NETSTAT -a
exit 1
fi
echo "port=$port" >>$seq.full
_save_config $PCP_PMCDOPTIONS_PATH
cat <<End-of-File >$tmp.newoptions
# New pmcd.options file created by QA $seq
#
-s $tmp.socket
End-of-File
$sudo cp $tmp.newoptions $PCP_PMCDOPTIONS_PATH
_service pcp stop | _filter_pcp_stop
# need to start pmcd indirectly in a shell script because sudo
# may cleanse the environment, which also means we cannot use
# the _service wrapper
#
echo "export PMCD_PORT=$port" >$tmp.start
echo "$PCP_RC_DIR/pmcd restart" >>$tmp.start
$sudo sh $tmp.start | _filter_pcp_start
export PMCD_PORT=$port
_wait_for_pmcd
cd $here/pmdas/dynamic
if [ -f GNUmakefile.install ]
then
$PCP_MAKE_PROG -f GNUmakefile.install clean >>$here/$seq.full 2>&1
$PCP_MAKE_PROG -f GNUmakefile.install >>$here/$seq.full 2>&1
else
$PCP_MAKE_PROG clean >>$here/$seq.full 2>&1
$PCP_MAKE_PROG >>$here/$seq.full 2>&1
fi
$sudo ./Install < /dev/null >$tmp.out 2>&1
cat $tmp.out | tee -a $here/$seq.full | _filter_pmda_install | _filter
cd $here
# real QA test starts here
echo "Initial check of some metric access"
pmprobe -h unix:$tmp.socket -i hinv.ncpu
pmsleep 0.2
echo "Terminate a PMDA needing attributes" | tee -a $here/$seq.full
date >>$here/$seq.full
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep pmdadynamic >> $here/$seq.full
$signal -s KILL -an pmdadynamic >> $here/$seq.full 2>&1
$sudo $signal -s KILL -a pmdadynamic >> $here/$seq.full 2>&1
# wait up to 2 seconds for dynamic PMDA to die
i=0
while [ $i -lt 10 ]
do
$PCP_PS_PROG $PCP_PS_ALL_FLAGS >$tmp.tmp
echo "ps probe #$i" >>$here/$seq.full
egrep '[P]ID|[p]mdadynamic' $tmp.tmp >>$here/$seq.full
# looking for a defunct PMDA process
#
if egrep '(pmdadynamic.*defunct)|( Z .*pmdadynamic)|\(pmdadynamic\)' $tmp.tmp >/dev/null
then
rm -f $tmp.tmp
break
elif grep "pmdadynamic" $tmp.tmp >/dev/null
then
# still running, keep trying
:
else
# not running at all
rm -f $tmp.tmp
break
fi
pmsleep 0.2
i=`expr $i + 1`
done
if [ -f $tmp.tmp ]
then
echo "Arrgh ... dynamic PMDA won't die"
egrep '[P]ID|[p]mdadynamic' $tmp.tmp
exit
fi
date >>$here/$seq.full
# and a bit more for pmcd to notice the PMDA has exited
pmsleep 3.75
echo "Tickle access to the failed PMDA, must see 'Try Again'"
pmprobe -h unix:$tmp.socket -i hinv.ncpu | tee $tmp.tmp
nval=`$PCP_AWK_PROG <$tmp.tmp '{print $2}'`
if [ "$nval" -ge 0 ]
then
# this is not expected
#
echo "Error: nval=$nval not as expected ... see $seq.full"
echo "+++ Tickle failed `date` +++" >>$here/$seq.full
cat $PCP_LOG_DIR/pmcd/pmcd.log >>$here/$seq.full
cat $PCP_LOG_DIR/pmcd/dynamic.log >>$here/$seq.full
fi
echo "Verify subsequent return to healthy state"
pmprobe -h unix:$tmp.socket -i hinv.ncpu
# success, all done
status=0
exit
|