3 # PCP 2.2 duplicate of 349 (pmdatrace, pmtrace, and libpcp_trace tests)
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard filters
16 [ -d $PCP_PMDAS_DIR/trace
] || _notrun
"trace PMDA directory is not installed"
18 signal
=$PCP_BINADM_DIR/pmsignal
19 status
=1 # failure is the default!
24 if [ -n "$savedtracehost" ]
26 PCP_TRACE_HOST
=$savedtracehost; export PCP_TRACE_HOST
30 if $install_on_cleanup
32 ( cd $PCP_PMDAS_DIR/trace
; $sudo .
/Install
</dev
/null
>/dev
/null
2>&1 )
34 ( cd $PCP_PMDAS_DIR/trace
; $sudo .
/Remove
</dev
/null
>/dev
/null
2>&1 )
42 _filter_trace_install
()
44 # some warnings are *expected* - no trace values yet
45 tee -a $here/$seq.full | \
46 _filter_pmda_install |
sed \
47 -e 's/ *[0-9]+ warnings,//g' \
48 -e "s/$qahost/HOSTNAME/g"
51 install_on_cleanup
=false
52 pminfo trace
>/dev
/null
2>&1 && install_on_cleanup
=true
55 trap "_cleanup" 0 1 2 3 15
57 if [ -n "$PCP_TRACE_HOST" ]
59 savedtracehost
=$PCP_TRACE_HOST; unset PCP_TRACE_HOST
63 otherhost
=`./getpmcdhosts -L -n 1 2>$tmp.out`
64 [ -z "$otherhost" ] && _notrun
`cat $tmp.out`
65 qanet
=`_host_to_ipaddr $otherhost | sed -e 's/[0-9][0-9]*$/*/'`
68 echo "qahost=$qahost" >$seq.full
69 echo "qanet=$qanet" >>$seq.full
70 echo "otherhost=$otherhost" >>$seq.full
72 cat > $tmp.conf1
<< EOF
84 cat > $tmp.conf2
<< EOF
99 # real QA test starts here
100 cd $PCP_PMDAS_DIR/trace
102 echo >>$here/$seq.full
103 echo "=== first local trace PMDA config ===" >>$here/$seq.full
104 cat $tmp.conf1
>>$here/$seq.full
105 echo "===" >>$here/$seq.full
107 $sudo .
/Install
-R / < $tmp.conf1
2>&1 \
108 | _filter_trace_install
110 grep trace
$PCP_PMCDCONF_PATH >>$here/$seq.full
112 echo '=== Attempting bad local access ==='
113 echo "=== Attempting bad local access ===" >>$here/$seq.full
114 # Error message mapping is for Linux
116 pmtrace
-h $qahost $qahost 2>&1 \
117 |
tee -a $here/$seq.full \
119 -e "s/Connection reset by peer/Cannot connect to PMDA - permission denied/" \
120 -e "s/Connection refused/Cannot connect to PMDA - permission denied/"
121 if [ -f $PCP_LOG_DIR/pmcd
/trace.log
]
123 cat $PCP_LOG_DIR/pmcd
/trace.log
>>$here/$seq.full
124 elif [ -f $PCP_LOG_DIR/trace.log
]
126 cat $PCP_LOG_DIR/trace.log
>>$here/$seq.full
128 echo "Arrggh! Cannot find log for trace PMDA!" >>$here/$seq.full
133 echo >>$here/$seq.full
134 echo "=== second local trace PMDA config ===" >>$here/$seq.full
135 cat $tmp.conf2
>>$here/$seq.full
136 echo "===" >>$here/$seq.full
138 $sudo .
/Install
-R / < $tmp.conf2
2>&1 \
139 | _filter_trace_install
141 grep trace
$PCP_PMCDCONF_PATH >>$here/$seq.full
143 echo '=== Building demo program (app2) ==='
144 cd $PCP_DEMOS_DIR/trace
145 $sudo $PCP_MAKE_PROG app2
>$tmp.
make 2>&1
148 echo "trace app2 make failed. Here is the make output ..."
153 export PCP_TRACE_HOST
=$qahost
155 echo '=== Running demo program (app2) ==='
156 # use app2 process to bump the number of connections.
157 ( ( $PCP_DEMOS_DIR/trace
/app2
2>&1 >$tmp.out
& ) )
160 echo '=== Check access limits ==='
161 echo "=== Check access limits ===" >>$here/$seq.full
162 # Error message mapping is for Linux
164 pmtrace
-h $qahost 'limit exceeded' 2>&1 \
165 |
tee -a $here/$seq.full \
167 -e "s/Connection reset by peer/Cannot connect to PMDA - connection limit reached/"
169 $signal -a -s KILL app2
171 echo "=== app2 ===" >>$here/$seq.full
172 cat $tmp.out
>>$here/$seq.full
176 echo '=== Attempting bad remote access ==='
177 echo "=== Attempting bad remote access ===" >>$here/$seq.full
178 # Error message mapping is for Linux
180 ssh -q pcpqa@
$otherhost "sh -c 'PCP_TRACE_HOST=$qahost pmtrace -v 1 eek'" 2>&1 \
181 |
tee -a $here/$seq.full \
183 -e "s/Interrupted function call/Cannot connect to PMDA - permission denied/" \
184 -e "s/Connection refused/Cannot connect to PMDA - permission denied/"
185 if [ -f $PCP_LOG_DIR/pmcd
/trace.log
]
187 cat $PCP_LOG_DIR/pmcd
/trace.log
>>$here/$seq.full
188 elif [ -f $PCP_LOG_DIR/trace.log
]
190 cat $PCP_LOG_DIR/trace.log
>>$here/$seq.full
192 echo "Arrggh! Cannot find log for trace PMDA!" >>$here/$seq.full
198 echo >>$here/$seq.full
199 echo "=== Reinstall default config ===" >>$here/$seq.full
200 cd $PCP_PMDAS_DIR/trace
201 $sudo .
/Install
-R / < /dev
/null
2>&1 \
202 | _filter_trace_install