/var/lib/pcp/testsuite/041 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 | #! /bin/sh
# PCP QA Test No. 041
# Test $PCP_RC_DIR/pcp start
#
# 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
[ $PCP_PLATFORM = mingw ] && _notrun "Process stop signal not available on Win32"
rm -f $seq.out
if [ $PCP_VER -lt 3611 ]
then
ln $seq.out.1 $seq.out || exit 1
else
ln $seq.out.2 $seq.out || exit 1
fi
_filter()
{
tee -a $seq.full \
| _filter_pmcd_log \
| sed \
-e '/^ *$/d' \
-e 's/ -t [0-9][0-9]* / /' \
-e '/UID/d' \
-e '/UNAME/d' \
-e '/USER/d' \
-e '/host/s/host "[^"]*"/host SOMEHOST/' \
-e 's/^ *root[^/]*\// USERNAME ... \//' \
-e 's/^ *pcp[^/]*\// USERNAME ... \//' \
-e 's/pmcd -.*/pmcd/' \
-e '/__pmGetPDU:.*illegal PDU len=0/d' \
| _filter_pcp_start
}
_expect()
{
echo "" | tee -a $seq.full
echo "### Expect: $* ###" | tee -a $seq.full
echo "" | tee -a $seq.full
}
tmp=/var/tmp/qa041.$$
_needclean=true
TAG=000666000magic
status=1
[ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
PCP_PMLOGGERCONTROL_PATH="$PCP_SYSCONF_DIR/pmlogger/control"
trap "_cleanup" 0 1 2 3 15
_cleanup()
{
if $_needclean
then
[ -f $tmp.control ] && \
$sudo cp $tmp.control $PCP_PMLOGGERCONTROL_PATH
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
_needclean=false
fi
$sudo rm -f $tmp.*
exit $status
}
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
rm -f $seq.full
# real QA test starts here
# disable all pmloggers ... Linux does not have "chkconfig pmlogger off"
#
$sudo cp $PCP_PMLOGGERCONTROL_PATH $tmp.control
cat <<End-of-File >$tmp.tmp
# dummy file created by qa/$seq on `date`
# the goal here is to have a controlled primary logger that does
# not make requests to pmcd!
\$version=1.1
LOCALHOSTNAME y n $LOGGING_DIR/LOCALHOSTNAME -c /dev/null
End-of-File
$sudo cp $tmp.tmp $PCP_PMLOGGERCONTROL_PATH
# I have no idea why this is required, but this test run
# after 040 sometimes produces garbled messages unless
# this is done!
$sudo $PCP_RC_DIR/pcp stop >$tmp.out 2>$tmp.err
cat $tmp.out >>$seq.full
_filter_pcp_stop <$tmp.out
cat $tmp.err
# allow pmcd's socket teardown to complete
#
sleep 2
rm -f $tmp.out $tmp.err
_expect "connection refused"
pminfo -f sample.long.million 2>&1 | _filter
$sudo $PCP_RC_DIR/pcp start >$tmp.one 2>&1
_wait_for_pmcd
_expect "one million retrieved OK from sample.long.million"
pminfo -f sample.long.million
sleep 3 # make sure pmlogger is not clobbered
pid=`_get_pids_by_name pmcd`
if [ -z "$pid" ]
then
echo "Arrgh ... cannot find PID for pmcd!"
ps $PCP_PS_ALL_FLAGS
echo "=== pmcd.log ==="
cat $PCP_LOG_DIR/pmcd/pmcd.log
echo "=== pmcd.log.prev ==="
cat $PCP_LOG_DIR/pmcd/pmcd.log.prev
exit
fi
echo "pmcd pid=$pid" >>$seq.full
ps $PCP_PS_ALL_FLAGS | egrep "PID|$pid" >>$seq.full
$sudo kill -STOP $pid
sleep 3 # make sure pmcd gets the SIGSTOP
# this will hang, and then see a timeout failure when PMCD is
# killed off
$sudo rm -f $tmp.tmp
PMCD_CONNECT_TIMEOUT=1000
export PMCD_CONNECT_TIMEOUT
pminfo -f sample.long.million >$tmp.tmp 2>&1 &
_expect "Starting, Waiting, Forcing termination and Starting again"
ps $PCP_PS_ALL_FLAGS | egrep "PID|$pid" >>$seq.full
$sudo $PCP_RC_DIR/pcp start >$tmp.two 2>&1
_wait_for_pmcd
wait
_filter_pcp_start <$tmp.one | _filter
_filter <$tmp.two
rm -f $tmp.out $tmp.err
_expect "Timeout waiting for a response from PMCD"
_filter <$tmp.tmp
rm -f $tmp.tmp
_expect "one million again"
pminfo -f sample.long.million
# all OK
status=0
exit
|