/var/lib/pcp/testsuite/183 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | #! /bin/sh
# PCP QA Test No. 183
# pmnewlog error handling
#
# Copyright (c) 2014 Red Hat.
# Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.product
. ./common.filter
. ./common.check
_cleanup()
{
_restore_auto_restart pmcd
_restore_auto_restart pmlogger
$sudo rm -f $tmp.* /tmp/Latest
}
signal=$PCP_BINADM_DIR/pmsignal
newlog=$PCP_BINADM_DIR/pmnewlog
trap "_cleanup; exit \$status" 0 1 2 3 15
status=1
_stop_auto_restart pmcd
_stop_auto_restart pmlogger
# used to debug qa test (tes:June/2000)
rm -rf $seq.full
hostname=`hostname`
_filter_ls()
{
sed \
-e 's/tmp\/[0-9][0-9]*/tmp\/PID/' \
-e 's/[A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]/TIME/' \
| $PCP_AWK_PROG '
/TIME/ { $3 = "user"; $4 = "group" }
{ print }'
}
_filter()
{
sed \
-e "s|${PCP_BINADM_DIR}|PCP_BINADM_DIR|" \
-e 's/process [0-9][0-9]*/process PID/' \
-e "s/ at $hostname:/ at HOST:/" \
-e "s/ at local::/ at HOST:/" \
-e "s/ on port [0-9][0-9]*//" \
-e "s/ pid [0-9][0-9]*//" \
-e '/Error \[<stdin>,/d' \
-e '/Warning \[<stdin>,/d' \
-e '/Not connected to any/d' \
-e '/Logging statement ignored/d' \
-e '/Problem with lookup for metric/d' \
-e '/Reason: Unknown metric name/d' \
-e '/Try again. Information not currently available/d' \
-e '/Unknown or illegal metric identifier/d' \
-e '/Unknown or illegal instance domain identifier/d' \
-e '/Operation not permitted/s/line 1: //' \
-e 's/Address already in use/[TCP\/IP error]/' \
-e 's/Connection reset by peer/[TCP\/IP error]/' \
-e 's/Connection refused/[TCP\/IP error]/'
}
cat <<End-of-File >$tmp.config
log mandatory on once hinv.ndisk
End-of-File
# real QA test starts here
echo "=== usage ==="
$newlog
echo
echo "=== archive exists ==="
echo "=== archive exists ===" >>$seq.full
$sudo rm -f $tmp.save.*
_start_up_pmlogger -c $tmp.config -l $tmp.log $tmp.save >$tmp.err 2>&1
_wait_for_pmlogger $pid $tmp.log
$sudo $newlog -p $pid -l $tmp.pmlogger.log $tmp.save >$tmp.out 2>&1
ok=true
for base in $tmp.save $tmp.save-00
do
for suff in 0 index meta
do
[ -f $base.$suff ] && continue
echo "Failed! expected file $base.$suff not found"
ok=false
done
done
if $ok
then
echo "OK, previous one renamed using \"-00\" suffix"
else
echo "output from pmnewlog ..."
cat $tmp.out
fi
$sudo $signal -a -s TERM pmlogger >/dev/null 2>&1
echo "-- new pmlogger log file --" >>$seq.full
cat $tmp.pmlogger.log >>$seq.full
echo
echo "=== no non-primary logger ==="
echo "=== no non-primary logger ===" >>$seq.full
date >/dev/null &
_wait_pmlogger_end $pid
$sudo $newlog -p $! $tmp 2>&1 | tee -a $seq.full | _filter
echo
echo "=== no primary logger ==="
echo "=== no primary logger ===" >>$seq.full
$sudo $signal -a -s TERM pmlogger
pmsleep 1.1
$sudo $newlog $tmp 2>&1 | tee -a $seq.full | _filter
_service pcp restart \
| _filter_pcp_start \
| sed -e '/pmlogger not running/d'
_wait_for_pmcd
_wait_for_pmlogger
echo
echo "=== process is not called pmlogger ==="
echo "=== process is not called pmlogger ===" >>$seq.full
pmsleep 10 &
$sudo $newlog -p $! $tmp 2>&1 | tee -a $seq.full | _filter
echo
echo "=== process is not really pmlogger ==="
echo "=== process is not really pmlogger ===" >>$seq.full
cp `which sleep` $tmp.pmlogger
$tmp.pmlogger 10 &
$sudo $newlog -p $! $tmp 2>&1 | tee -a $seq.full | _filter \
| sed -e "/\.pmlogger/s/.*/-- ps line removed --/" -e "s/$!/PID/"
echo
echo "=== non-primary logger busy ==="
echo "=== non-primary logger busy ===" >>$seq.full
$sudo rm -f $tmp.save.*
_start_up_pmlogger -L -c /dev/null -l $tmp.log $tmp.save >$tmp.err 2>&1
_wait_for_pmlogger $pid $tmp.log
(( echo "connect $pid"; pmsleep 3.0 ) | pmlc ) &
$sudo $newlog -p $pid $tmp 2>&1 | tee -a $seq.full | _filter \
| sed -e "/\.save/s/.*/-- ps line removed --/" -e "s/$pid/PID/"
$sudo $signal -s TERM $pid
echo
echo "=== primary logger busy ==="
echo "=== primary logger busy ===" >>$seq.full
(( echo "connect primary"; sleep 3 ) | pmlc ) &
$sudo $newlog $tmp 2>&1 | tee -a $seq.full | _filter \
| sed -e "/\/pmlogger/s/.*/-- ps line removed --/"
echo
echo "=== no extracted configuration ==="
echo "=== no extracted configuration ===" >>$seq.full
$sudo rm -f $tmp.save.*
_start_up_pmlogger -L -c /dev/null -l $tmp.log $tmp.save >$tmp.err 2>&1
_wait_for_pmlogger $pid $tmp.log
echo "pid=$pid" >>$seq.full
ps $PCP_PS_ALL_FLAGS | grep pmlogger >>$seq.full
pmsleep 1.1
$sudo $newlog -p $pid $tmp 2>&1 \
| tee -a $seq.full \
| _filter \
| sed \
-e "/\.save/s/.*/-- ps line removed --/" \
-e "s/$pid/PID/" \
-e '/to get logging state/d' \
-e '/errors from talking/d' \
-e '/continuing/d' \
-e '/Reason: Metric not supported by this version/d' \
-e '/Reason: IPC protocol failure/d' \
-e '/^$/d'
$sudo $signal -s TERM $pid
_wait_pmlogger_end $pid
echo "-- tmp.log --" >>$seq.full
cat $tmp.log >>$seq.full
echo "-- tmp.err --" >>$seq.full
cat $tmp.err >>$seq.full
echo "-- pmnewlog --" >>$seq.full
echo
echo "=== wrong uid to kill pmlogger ==="
echo "=== wrong uid to kill pmlogger ===" >>$seq.full
echo "=== initial pmloggers ===" >>$seq.full
# root 29697 1 0 10:45 pts/1 00:00:00 pmlogger -P -c config.default 20101021.10.45
ps $PCP_PS_ALL_FLAGS \
| grep '[p]mlogger' \
| tee -a $seq.full \
| grep -v sudo \
| $PCP_AWK_PROG '
$1 == "root" { print $2 }' >$tmp.old
cat $tmp.old >>$seq.full
$sudo rm -f $tmp.save.*
_start_up_pmlogger -L -c $tmp.config -l $tmp.log $tmp.save >$tmp.err 2>&1
pmsleep 1.1
echo "=== final pmloggers ===" >>$seq.full
ps $PCP_PS_ALL_FLAGS \
| grep '[p]mlogger' \
| tee -a $seq.full \
| grep -v sudo \
| $PCP_AWK_PROG '
$1 == "root" { print $2 }' >$tmp.new
cat $tmp.new >>$seq.full
#for pid in `cat $tmp.new`
#do
# if grep "^$pid"'$' $tmp.old >/dev/null
# then
# :
# else
# break
# fi
#done
echo "target pmlogger pid=$pid" >>$seq.full
pmsleep 1.1
$newlog -p $pid $tmp 2>&1 \
| tee -a $seq.full \
| _filter \
| sed \
-e "/\.save/s/.*/-- ps line removed --/" \
-e '/^kill:.*Not owner/s/Not owner/Operation not permitted/' \
-e '/.*: kill:.*Not owner/s/Not owner/Operation not permitted/' \
-e 's/.*kill:.*Operation not permitted/KILL: Operation not permitted/' \
-e 's/.*kill:.*permission denied/KILL: Operation not permitted/' \
-e '/to get logging state/d' \
-e '/errors from talking/d' \
-e '/continuing/d' \
-e '/Reason: Metric not supported by this version/d' \
-e '/Reason: Broken pipe/d' \
-e '/^$/d'
$sudo $signal -s TERM $pid
status=0
exit
|