/var/lib/pcp/testsuite/169 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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | #! /bin/sh
# PCP QA Test No. 169
#
# Test pmcd timeouts with the pmcd PMDA's pmcd.control.timeout
#
# Test setting the app's timeouts < pmcd's timeout and vice versa
#
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.check
. ./common.filter
echo ""
echo "Test pmcd timeouts with the pmcd PMDA's pmcd.control.timeout"
echo ""
LOCALHOST=`hostname`
signal=$PCP_BINADM_DIR/pmsignal
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
_cleanup()
{
$sudo $PCP_RC_DIR/pcp stop >$tmp.stop
_filter_pcp_stop <$tmp.stop | sed -e 's/\.\.\.\.\.*/[dots]/'
[ -f $tmp.pmcd.conf ] && $sudo mv $tmp.pmcd.conf $PCP_PMCDCONF_PATH
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
$sudo $PCP_RC_DIR/pcp restart >$tmp.start
_filter_pcp_start <$tmp.start | sed -e 's/\.\.\.\.\.*/[dots]/'
_wait_for_pmcd
_wait_for_pmlogger
rm -f $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
rm -f $seq.full
# real QA test starts here
# This value is passed to processes this script creates on the command line.
# It's unlikely to occur anywhere in a ps output and is used as a tag to
# terminate or check for the existence of the processes later.
#
TAG=000000660066
_check_pmcd_procs()
{
n_pmcd=`ps $PCP_PS_ALL_FLAGS \
| tee $tmp.pmcd \
| fgrep "$PCP_PMCD_PATH" \
| grep -v grep \
| wc -l \
| tr -d ' '`
if [ "X$n_pmcd" != "X$1" ]
then
echo "Expected $1 pmcd processes but found $n_pmcd:"
cat $tmp.pmcd
cat $PCP_PMCDLOG_PATH
file $PCP_LOG_DIR/core* $PCP_LOG_DIR/pmcd/core*
return 1
else
return 0
fi
}
_set_timeouts()
{
pmcd_timeout=$1
app_timeout=$2
echo "app timeout = $app_timeout"
echo "pmcd timeout = $pmcd_timeout"
PMCD_REQUEST_TIMEOUT=$app_timeout
export PMCD_REQUEST_TIMEOUT
pmstore pmcd.control.timeout $pmcd_timeout
}
_echo()
{
echo "$*"
echo "$*" >>$seq.full
}
rm -rf $tmp.*
pmns=$tmp.pmns
# use a dummy pmns for pminfo
dummy_domain=160 # choose non-existent domain
cat >$pmns <<EOF
root {
dummyproc $dummy_domain:0:0
}
EOF
# pmcd will run a dumb_pmda, masquerading as the IRIX agent. This will
# not respond to PDUs from PMCD, which should then time it out.
# The pmcd PMDA is required so that pmcd.control.timeout can be modified.
# Save the current pmcd.conf so it can be restored afterwards.
cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
cat >$tmp.tmp <<End-Of-File
# QA test 169 dummy pmcd.conf (blame Jonathan if you find this!)
#
dummyproc $dummy_domain pipe binary $here/src/dumb_pmda -d $dummy_domain $TAG
End-Of-File
$PCP_AWK_PROG <$PCP_PMCDCONF_PATH >>$tmp.tmp '
$3 == "dso" && $4 == "irix_init" { print }
$3 == "dso" && $4 == "linux_init" { print }
$3 == "dso" && $4 == "pmcd_init" { print }
$3 == "pipe" && $1 == "pmcd" { print }
{ next }'
pmcdlog=$PCP_PMCDLOG_PATH
$sudo mv $tmp.tmp $PCP_PMCDCONF_PATH
$sudo $PCP_RC_DIR/pcp start >$tmp.start
_filter_pcp_start <$tmp.start | sed -e 's/\.\.\.\.\.*/[dots]/'
_wait_for_pmcd
if _check_pmcd_procs 1
then
:
else
_echo "pmcd didn't start!"
_echo ""
cat $pmcdlog >>$seq.full
exit 1
fi
ps $PCP_PS_ALL_FLAGS >$tmp.ps
egrep '[P]ID|[p]m' $tmp.ps >>$seq.full
if grep "[d]umb_pmda" $tmp.ps >/dev/null
then
:
else
_echo "pmcd didn't create the dumb_pmda agent"
_echo ""
cat $pmcdlog >>$seq.full
exit 1
fi
# force to a known state
#
pmstore pmcd.control.timeout 5 >/dev/null
# for debugging
#
#debug# pmstore pmcd.control.tracenobuf 1 >/dev/null
#
# pmcd agent timeout < application time out
#
_echo ""
_echo "*** pmcd agent timeout < app timeout ***"
_echo "*** pmcd will killoff agent ***"
_echo ""
_set_timeouts 5 10
# Fetch from dummy domain. This should cause the dumb_pmda agent to be
# timed-out by pmcd, resulting in its termination.
#
_echo ""
_echo "Expect dummyproc to fail (IPC protocol failure):"
pminfo -n $pmns -d dummyproc
_echo ""
# make sure pmcd has had a chance to wait() on the pmda process
#
sleep 2
pminfo -n $pmns -d dummyproc >/dev/null 2>&1
ps $PCP_PS_ALL_FLAGS >$tmp.ps
egrep '[P]ID|[p]m' $tmp.ps >>$seq.full
if grep "[d]umb_pmda" <$tmp.ps >/dev/null
then
_echo "Error: pmcd didn't terminate the dumb_pmda agent"
cat $pmcdlog >>$seq.full
exit 1
else
_echo "pmcd terminated dummy the dumb_pmda agent as desired"
fi
echo >>$seq.full
cat $PCP_LOG_DIR/pmcd/pmcd.log >>$seq.full
echo >>$seq.full
cat $PCP_LOG_DIR/pmcd/dumb_pmda.log >>$seq.full
# Restart pmcd and its agents
_echo ""
$sudo $signal -a -s HUP pmcd
sleep 1
_wait_for_pmcd
if _check_pmcd_procs 1
then
:
else
_echo "pmcd was sent SIGHUP and died"
_echo ""
cat $pmcdlog >>$seq.full
exit 1
fi
ps $PCP_PS_ALL_FLAGS >$tmp.ps
egrep '[P]ID|[p]m' $tmp.ps >>$seq.full
if grep "[d]umb_pmda" <$tmp.ps >/dev/null
then
psline=`ps $PCP_PS_ALL_FLAGS | grep "[d]umb_pmda"`
old_dummy_pid=`echo $psline | cut -d ' ' -f 2`
else
_echo "pmcd SIGHUP didn't restart the dumb_pmda agent"
_echo ""
cat $pmcdlog >>$seq.full
exit 1
fi
#
# pmcd agent timeout > application time out
#
_echo ""
_echo "*** pmcd agent timeout > app timeout ***"
_echo "*** pmcd will not killoff agent until later ***"
_echo ""
_set_timeouts 10 5
# Fetch from dummy domain. This should cause the dumb_pmda agent to be
# timed-out by pmcd, resulting in its termination.
#
_echo ""
_echo "Expect dummyproc to fail (timeout for pmcd failure):"
#DEBUG# date
pminfo -n $pmns -d dummyproc
#DEBUG# date
_echo ""
ps $PCP_PS_ALL_FLAGS >$tmp.ps
egrep '[P]ID|[p]m' $tmp.ps >>$seq.full
if grep "[d]umb_pmda" <$tmp.ps >/dev/null
then
_echo "pmcd did NOT terminate the dumb_pmda agent as desired"
# make sure it is really the same process - check pid
psline=`ps $PCP_PS_ALL_FLAGS | grep "[d]umb_pmda"`
new_dummy_pid=`echo $psline | cut -d ' ' -f 2`
if [ $old_dummy_pid -ne $new_dummy_pid ]
then
_echo "Error: dumb_pmda proc has been recreated"
_echo "pid mismatch: $old_dummy_pid versus $new_dummy_pid"
exit 1
fi
else
_echo "Error: pmcd terminated the dumb_pmda agent"
cat $pmcdlog >>$seq.full
exit 1
fi
_echo ""
_echo "Now wait for pmcd to timeout..."
_echo ""
sleep 6
ps $PCP_PS_ALL_FLAGS >$tmp.ps
egrep '[P]ID|[p]m' $tmp.ps >>$seq.full
if grep "[d]umb_pmda" <$tmp.ps >/dev/null
then
_echo "Error: pmcd didn't terminate the dumb_pmda agent"
cat $pmcdlog >>$seq.full
exit 1
else
_echo "pmcd terminated the dumb_pmda agent as desired"
fi
echo >>$seq.full
cat $PCP_LOG_DIR/pmcd/pmcd.log >>$seq.full
echo >>$seq.full
cat $PCP_LOG_DIR/pmcd/dumb_pmda.log >>$seq.full
_echo ""
status=0
|