blob: 0a02dec254bd73677ac1de92ef46d48b0d605c88 (
plain)
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
|
#! /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
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
config=$PCP_PMCDCONF_PATH
oconfig=$tmp.pmcd.config
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'
}
_filter_pmda_log()
{
sed \
-e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
-e 's/^\(Log finished\) .*/\1 .../'
}
interrupt()
{
echo "Interrupted"
exit
}
if [ -d $PCP_LOG_DIR/pmlogger ]
then
LOGGING_DIR=$PCP_LOG_DIR/pmlogger
else
LOGGING_DIR=$PCP_LOG_DIR
fi
cleanup()
{
if [ -f $oconfig ]
then
$sudo mv $oconfig $config
fi
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
echo "Restarting pmcd"
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
rm -f $tmp.*
}
trap interrupt 1 2 3 15
trap cleanup 0
domain=246
if [ $PCP_PLATFORM = linux ]
then
cat >$tmp <<End-of-file
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 <<End-of-file
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 <<End-of-File
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
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
cp $config $oconfig
$sudo mv $tmp $config
pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
&& $sudo sh $tmp.cmd
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
# 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
|