blob: cd68d3b436e592bdeb5e9832b587420ca01cf4aa (
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
195
196
197
198
199
200
201
202
203
204
205
206
|
#! /bin/sh
# PCP QA Test No. 603
# PCP 2.2 duplicate of 349 (pmdatrace, pmtrace, and libpcp_trace tests)
#
# 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
status=1 # failure is the default!
_cleanup()
{
cd $here
if [ -n "$savedtracehost" ]
then
PCP_TRACE_HOST=$savedtracehost; export PCP_TRACE_HOST
fi
if $_needclean
then
if $install_on_cleanup
then
( cd $PCP_PMDAS_DIR/trace; $sudo ./Install </dev/null >/dev/null 2>&1 )
else
( cd $PCP_PMDAS_DIR/trace; $sudo ./Remove </dev/null >/dev/null 2>&1 )
fi
_needclean=false
fi
rm -f $tmp.*
exit $status
}
_filter_trace_install()
{
# some warnings are *expected* - no trace values yet
tee -a $here/$seq.full | \
_filter_pmda_install | sed \
-e 's/ *[0-9]+ warnings,//g' \
-e "s/$qahost/HOSTNAME/g"
}
install_on_cleanup=false
pminfo trace >/dev/null 2>&1 && install_on_cleanup=true
_needclean=true
trap "_cleanup" 0 1 2 3 15
if [ -n "$PCP_TRACE_HOST" ]
then
savedtracehost=$PCP_TRACE_HOST; unset PCP_TRACE_HOST
fi
qahost=`_get_fqdn`
otherhost=`./getpmcdhosts -L -n 1 2>$tmp.out`
[ -z "$otherhost" ] && _notrun `cat $tmp.out`
qanet=`_host_to_ipaddr $otherhost | sed -e 's/[0-9][0-9]*$/*/'`
rm -f $seq.full
echo "qahost=$qahost" >$seq.full
echo "qanet=$qanet" >>$seq.full
echo "otherhost=$otherhost" >>$seq.full
cat > $tmp.conf1 << EOF
n
60
10
4323
y
y
D
$qahost
EOF
cat > $tmp.conf2 << EOF
n
60
10
4323
y
y
D
$qanet
A
$qahost
1
EOF
# real QA test starts here
cd $PCP_PMDAS_DIR/trace
echo >>$here/$seq.full
echo "=== first local trace PMDA config ===" >>$here/$seq.full
cat $tmp.conf1 >>$here/$seq.full
echo "===" >>$here/$seq.full
$sudo ./Install -R / < $tmp.conf1 2>&1 \
| _filter_trace_install
_wait_for_pmcd
grep trace $PCP_PMCDCONF_PATH >>$here/$seq.full
echo '=== Attempting bad local access ==='
echo "=== Attempting bad local access ===" >>$here/$seq.full
# Error message mapping is for Linux
#
pmtrace -h $qahost $qahost 2>&1 \
| tee -a $here/$seq.full \
| sed \
-e "s/Connection reset by peer/Cannot connect to PMDA - permission denied/" \
-e "s/Connection refused/Cannot connect to PMDA - permission denied/"
if [ -f $PCP_LOG_DIR/pmcd/trace.log ]
then
cat $PCP_LOG_DIR/pmcd/trace.log >>$here/$seq.full
elif [ -f $PCP_LOG_DIR/trace.log ]
then
cat $PCP_LOG_DIR/trace.log >>$here/$seq.full
else
echo "Arrggh! Cannot find log for trace PMDA!" >>$here/$seq.full
fi
echo
echo >>$here/$seq.full
echo "=== second local trace PMDA config ===" >>$here/$seq.full
cat $tmp.conf2 >>$here/$seq.full
echo "===" >>$here/$seq.full
$sudo ./Install -R / < $tmp.conf2 2>&1 \
| _filter_trace_install
_wait_for_pmcd
grep trace $PCP_PMCDCONF_PATH >>$here/$seq.full
echo '=== Building demo program (app2) ==='
cd $PCP_DEMOS_DIR/trace
$sudo make app2 >$tmp.make 2>&1
if [ $? -ne 0 ]
then
echo "trace app2 make failed. Here is the make output ..."
cat $tmp.make
exit 1
fi
export PCP_TRACE_HOST=$qahost
echo '=== Running demo program (app2) ==='
# use app2 process to bump the number of connections.
( ( $PCP_DEMOS_DIR/trace/app2 2>&1 >$tmp.out & ) )
sleep 3
echo '=== Check access limits ==='
echo "=== Check access limits ===" >>$here/$seq.full
# Error message mapping is for Linux
#
pmtrace -h $qahost 'limit exceeded' 2>&1 \
| tee -a $here/$seq.full \
| sed \
-e "s/Connection reset by peer/Cannot connect to PMDA - connection limit reached/"
$signal -a -s KILL app2
wait
echo "=== app2 ===" >>$here/$seq.full
cat $tmp.out >>$here/$seq.full
unset PCP_TRACE_HOST
echo '=== Attempting bad remote access ==='
echo "=== Attempting bad remote access ===" >>$here/$seq.full
# Error message mapping is for Linux
#
ssh -q pcpqa@$otherhost "sh -c 'PCP_TRACE_HOST=$qahost pmtrace -v 1 eek'" 2>&1 \
| tee -a $here/$seq.full \
| sed \
-e "s/Interrupted function call/Cannot connect to PMDA - permission denied/" \
-e "s/Connection refused/Cannot connect to PMDA - permission denied/"
if [ -f $PCP_LOG_DIR/pmcd/trace.log ]
then
cat $PCP_LOG_DIR/pmcd/trace.log >>$here/$seq.full
elif [ -f $PCP_LOG_DIR/trace.log ]
then
cat $PCP_LOG_DIR/trace.log >>$here/$seq.full
else
echo "Arrggh! Cannot find log for trace PMDA!" >>$here/$seq.full
fi
echo
# Reinstall defaults
echo >>$here/$seq.full
echo "=== Reinstall default config ===" >>$here/$seq.full
cd $PCP_PMDAS_DIR/trace
$sudo ./Install -R / < /dev/null 2>&1 \
| _filter_trace_install
_wait_for_pmcd
cd $here
# success, all done
status=0
exit
|