/var/lib/pcp/testsuite/067 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 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 | #! /bin/sh
# PCP QA Test No. 067
# Test PMCD's ability to detect and cleanup agents it didn't create when they
# terminate
#
# 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
which netstat >/dev/null 2>&1 || _notrun "netstat not installed"
rm -f $seq.out
_get_libpcp_config
if $ipv6 ; then
ln $seq.out.ipv6 $seq.out || exit 1
else
ln $seq.out.nonipv6 $seq.out || exit 1
fi
trap "rm -f $tmp.*; exit" 0 1 2 3 15
# real QA test starts here
signal=$PCP_BINADM_DIR/pmsignal
log=$PCP_PMCDLOG_PATH
LOCALHOST=`hostname`
_filter_log()
{
sleep 1
_filter_pmcd_log <$log \
| sed \
-e '/^$/d' \
-e 's/ *$//' \
-e 's/^$//' \
-e '/^->/d' \
-e '/^00[08]:/d' \
-e '/^sample/s/.*/sample agent.../' \
-e 's/fd=[0-9][0-9]*/fd=<n>/g' \
-e 's/^ ok [0-9]*/ ok <n>/g' \
-e '/^test/s/ *[0-9][0-9]* *[0-9][0-9]* ... bin/ <n> <n> <n> bin/' \
-e '/Resource busy/d' \
-e 's/0x[^ ]*\([^ ][^ ][^ ]\)/ADDR...\1/' \
-e '/client connection from/,/^$/d' \
-e '/Cleanup/d' \
-e '/Info: spindle_stats_init/d' \
-e '/UNIX_DOMAIN_SOCKET/d' \
#end
}
_filter_pmda_log()
{
sed \
-e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
-e 's/^\(Log finished\) .*/\1 .../'
}
interrupt()
{
echo "Interrupted"
_restore_auto_restart pmcd
exit
}
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
cleanup()
{
_restore_config $PCP_PMCDCONF_PATH
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
echo "Restarting pmcd"
_service pcp restart | _filter_pcp_start
_restore_auto_restart pmcd
_wait_for_pmcd
_wait_for_pmlogger
rm -f $tmp.*
}
trap interrupt 1 2 3 15
trap cleanup 0
_stop_auto_restart pmcd
domain=246
if [ $PCP_PLATFORM = linux ]
then
cat >$tmp.config <<End-of-file
# pmcd.conf generated by QA $seq
linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
test $domain socket inet 2222
End-of-file
elif [ $PCP_PLATFORM = darwin ]
then
cat >$tmp.config <<End-of-file
# pmcd.conf generated by QA $seq
darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
test $domain socket inet 2222
End-of-file
elif [ $PCP_PLATFORM = solaris ]
then
cat >>$tmp.config <<End-of-File
# pmcd.conf generated by QA $seq
solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
test $domain socket inet 2222
End-of-File
elif [ $PCP_PLATFORM = freebsd ]
then
cat >>$tmp.config <<End-of-File
# pmcd.conf generated by QA $seq
freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
test $domain socket inet 2222
End-of-File
else
echo "Error - need pmcd.conf setup for $PCP_PLATFORM"
exit 1
fi
# netstat -an formats
#
# Redhat 7.3 and 9
# tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN
#
# Mac OS X 10.6
# tcp4 0 0 *.2222 *.* LISTEN
#
# openindiana
# *.2222 *.* 0 0 128000 0 LISTEN
#
$sudo $signal -a pmgadgets pmchart pmview pmie >/dev/null 2>&1
src/pmdashutdown -i 2222 -d $domain -l $tmp.pmdalog &
pid=$!
echo "pmdashutdown pid: $pid" >$seq.full
sleep 1
echo
echo "port 2222 should be listening"
netstat -an \
| tee -a $seq.full \
| grep '[.:]2222 ' \
| sed \
-e 's/127\.0\.0\.1/*/g' \
-e 's/0\.0\.0\.0/*/g' \
-e 's/:/./g' \
-e 's/.*\(\*.2222\).*\(LISTEN\).*/... \1 ... \2/'
echo
_save_config $PCP_PMCDCONF_PATH
$sudo cp $tmp.config $PCP_PMCDCONF_PATH
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
_service pcp stop | _filter_pcp_stop
# Note: need to use $PCP_RC_DIR/* here, not _service pcp so that
# systemd (if running) does not get to see the pmcd exit status
#
( $sudo $PCP_RC_DIR/pmcd start; $sudo $PCP_RC_DIR/pmlogger start ) | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
# echo "config:"
# cat $config | sed -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;"
echo
# wait for pmdashutdown to finish
#
for t in 1 2 3 4 5 6
do
echo >>$seq.full
echo "wait for pmdashutdown to finish ... cycle $t" >>$seq.full
if ps $PCP_PS_ALL_FLAGS | tee -a $seq.full | cut -f1 | grep $pid >/dev/null 2>&1
then
sleep 2
else
break
fi
done
echo >>$seq.full
cat $tmp.pmdalog >>$seq.full
echo
echo "pmda log (should have terminated):"
_filter_pmda_log <$tmp.pmdalog
echo
$sudo $signal -a -s HUP pmcd
# wait for PMCD to finish writing log (or 5 seconds)
for t in 1 2 3 4 5
do
if egrep '^Cleanup "test" agent' $log >/dev/null 2>&1
then
break
fi
sleep 1
done
_filter_log
|