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
|
#! /bin/sh
# PCP QA Test No. 254
# exercise pmNameAll for distributed PMNS with given namespace
#
# 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
signal=$PCP_BINADM_DIR/pmsignal
_needclean=true
pmns="nameall.pmns"
mkdir $tmp
chmod ugo+rwx $tmp
cd $tmp
_cleanup()
{
cd $here
if $_needclean
then
_needclean=false
$signal -s TERM $pmcd
_wait_pmcd_end
unset PMCD_SOCKET
# address already in use seen on vm33, I'm unable to make it go away,
# but is does not seem relevant to the success or otherwise of this
# QA test, so filter it away - kenj Dec 2021
#
_filter_pcp_start <$tmp.err \
| tee -a $seq_full \
| sed \
-e '/__pmBind: Address already in use/d' \
# end
cat $tmp.log >>$seq_full
echo "Restart and ping pmcd ..."
# make sure pmcd's socket is torn down (failure on vm33, BSD 6.8)
#
sleep 2
_service pmcd restart 2>&1 | _filter_pcp_restart
_wait_for_pmcd
_restore_auto_restart pmcd
_service pmlogger restart 2>&1 | _filter_pcp_restart
_wait_for_pmlogger
fi
rm -rf $tmp $tmp.*
}
_hunt_pmcd_socket()
{
rm -f $tmp.tmp
echo "hunting for pmcd socket ..." >>$seq_full
netstat -a | grep ':44321' >>$seq_full
if which fstat >/dev/null 2>&1
then
fstat | grep -E '[P]PID|:[4]4321' >$tmp.out 2>>$seq_full
# fstat output ...
# pcp pmcd 81043 0* internet stream tcp 0x0 *:44321
$PCP_AWK_PROG <$tmp.out '{ print $3 }' \
| sed -e '/PID/d' \
| LC_COLLATE=POSIX sort \
| uniq >$tmp.tmp
elif which fuser >/dev/null 2>&1
then
# fuser output is mixed on stderr and stdout!
$sudo fuser 44321/tcp >$tmp.out 2>&1
# fuser output ...
# 44321/tcp: 624280
$PCP_AWK_PROG <$tmp.out '{ print $2 }' \
| LC_COLLATE=POSIX sort \
| uniq >$tmp.tmp
fi
cat $tmp.out >>$seq_full
if which pstree >/dev/null 2>&1
then
if pstree --help 2>&1 | grep '.--show-parents' >/dev/null
then
_gnu_pstree=true
else
_gnu_pstree=false
fi
cat $tmp.tmp \
| while read pid
do
echo "pid=$pid" >>$seq_full
if $_gnu_pstree
then
pstree --show-parents --show-pids $pid >>$seq_full
else
# BSD-style
pstree -p $pid >>$seq_full
fi
done
fi
}
trap "_cleanup; exit \$status" 0 1 2 3 15
_stop_auto_restart pmcd
# real QA test starts here
cat >$pmns <<End-of-File
root {
ten 29:0:11
another_ten 29:0:11
yet
}
yet {
another
again 29:0:11
}
yet.another {
ten 29:0:11
}
End-of-File
_wait_pmcd_end || _exit 1
if ! _service pmlogger stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmlogger_end || _exit 1
if ! _service pmcd stop 2>&1; then _exit 1; fi \
| _filter_pcp_stop
_wait_pmcd_end || _exit 1
# make sure pmcd's socket is torn down (failure on vm33, BSD 6.8)
sleep 1
# Note: start pmcd with -f so that its PID stays the same (no daemon)
#
PMCD_SOCKET=$tmp/pmcd.socket; export PMCD_SOCKET
_hunt_pmcd_socket
$PCP_PMCD_PROG -f -n $pmns -l $tmp.log 2>$tmp.err &
pmcd=$!
_wait_for_pmcd || _exit 1
_hunt_pmcd_socket
cd $here
src/nameall -s 2 ""
status=$?
|