/var/lib/pcp/testsuite/462 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 | #! /bin/sh
# PCP QA Test No. 462
# For pv #581025, pv #589006
#
# Test out pmcd_wait
#
# Test:
# * Success:
#1 - try on already running pmcd
# * Failure:
#2 - pmcd not running at all
#3 - pmcd running but taking too long to get around to
# accepting connections
# * Wait delta:
#4 - delta = X, have pmcd dead for X-1 seconds
#5 - delta = X, have pmcd dead for X+1 seconds
#
# 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 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
host=`hostname`
_cleanup()
{
_change_config pmlogger on
_service pcp restart >/dev/null 2>&1
_restore_auto_restart pmcd
_wait_for_pmcd
_wait_for_pmlogger
rm -f $tmp.*
}
_filter()
{
_filter_pcp_start \
| _filter_pcp_stop \
| sed -e '/^$PCP_RC_DIR\/pmlogger: pmlogger not running/d'
}
_wait_filter()
{
sed -e "s/$host/LOCALHOST/g" -e "s/local:/LOCALHOST/g"
}
_start()
{
echo "restart @ `date` ..." >>$seq.full
$sudo $PCP_RC_DIR/pmcd restart >$tmp.start.out
echo "restart log @ `date` ..." >>$seq.full
cat $tmp.start.out >>$seq.full
_wait_for_pmcd
}
_stop()
{
echo "stop @ `date`..." >>$seq.full
$sudo $PCP_RC_DIR/pmcd stop >$tmp.stop.out
echo "stop log @ `date` ..." >>$seq.full
cat $tmp.stop.out >>$seq.full
}
# real QA test starts here
_change_config pmlogger off
_stop_auto_restart pmlogger
_service pcp stop | _filter_pcp_stop
delta=10
pre_delta=5
post_delta=15
rm -f $seq.full
echo "*** test 1 ***" | tee -a $seq.full
_start
sleep 2
if pmcd_wait -v 2>$tmp.err
then
echo ""
echo "pmcd_wait succeeded as expected for running pmcd"
echo ""
else
_wait_filter < $tmp.err
fi
_filter <$tmp.start.out
echo "*** test 2 ***" | tee -a $seq.full
_stop
sleep 2
if pmcd_wait -v -t $delta 2>$tmp.err
then
echo ""
echo "ERROR: pmcd_wait should not have succeeded !" | tee -a $seq.full
echo ""
else
_wait_filter < $tmp.err
echo ""
echo "pmcd_wait failed as expected for dead pmcd"
echo ""
fi
_filter <$tmp.stop.out
echo "*** test 4 ***" | tee -a $seq.full
_stop
sleep 2
rm -f $tmp.done
( sleep $pre_delta; _start; touch $tmp.done ) &
if pmcd_wait -v -t $delta 2>$tmp.err
then
echo ""
echo "pmcd_wait succeeded as expected for sleeping pmcd - under timeout"
echo ""
else
echo ""
echo "ERROR: pmcd_wait should have succeeded !" | tee -a $seq.full
echo ""
_wait_filter < $tmp.err
fi
# Need to wait until _start is _really_ done and pmcd.log has been
# reported
for i in 1 2 3 4 5
do
[ -f $tmp.done ] && break
sleep 1
done
if [ ! -f $tmp.done ]
then
echo "Arrgh @ `date` ... _start is really dragging the chain ... check $seq.full" | tee -a $seq.full
status=1
exit
fi
_filter <$tmp.stop.out \
| sed -e '/pmlogger not running/d'
_filter <$tmp.start.out
echo "*** test 5 ***" | tee -a $seq.full
_stop
sleep 2
(sleep $post_delta; _start ) &
pid=$!
if pmcd_wait -v -t $delta 2>$tmp.err
then
echo ""
echo "ERROR: pmcd_wait should not have succeeded !" | tee -a $seq.full
echo ""
else
_wait_filter < $tmp.err
echo ""
echo "pmcd_wait failed as expected for sleeping pmcd - over timeout"
echo ""
fi
_filter <$tmp.stop.out \
| sed -e '/pmlogger not running/d'
_filter <$tmp.start.out
wait $pid # for background processs, "pcp start" to finish
# success, all done
status=0
exit
|