/var/lib/pcp/testsuite/948 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 | #!/bin/sh
# PCP QA Test No. 948
# pmlogger local context functionality
#
# Copyright (c) 2015 Red Hat. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
_cleanup()
{
cd $here
_service pcp start | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
$sudo rm -rf $tmp.*
}
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "_cleanup; exit \$status" 0 1 2 3 15
cat <<End-of-File >$tmp.config
log mandatory on 1 sec {
kernel.all.hz
hinv.pagesize
sampledso.long.million
}
End-of-File
_filter_kernel()
{
sed \
-e "s/value $hertz$/value HZ/g" \
-e '/kernel.all.hz/s/[0-9][0-9.]* (/PMID (/' \
-e "s/value $pagesz$/value PAGESZ/g" \
-e '/hinv.pagesize/s/[0-9][0-9.]* (/PMID (/' \
-e 's/TIMESTAMP / /g' \
#end
}
_filter_usage()
{
sed -e '/^Options:/{
p
s/.*/.../
q
}'
}
# Unable to connect to pmlogger pid 28124 at local:: Connection refused
# Connected to pmlogger pid 25625 at local:
_filter_pmlc()
{
sed \
-e "/^Unable/s/ $pid / PID /" \
-e "/^Connected/s/ $pid / PID /" \
# end
}
# real QA test starts here
echo "=== error cases ===" | tee -a $seq.full
rm -f $tmp.0 $tmp.meta $tmp.index $tmp.log
pmlogger -c /dev/null -o -h localhost $tmp -l $tmp.log 2>&1 | _filter_usage
[ -f $tmp.log ] && cat $tmp.log >>$seq.full
echo | tee -a $seq.full
echo "=== linger tests ===" | tee -a $seq.full
echo "--- expect error from pmlc ---" | tee -a $seq.full
rm -f $tmp.0 $tmp.meta $tmp.index $tmp.log
pmlogger -c /dev/null -o -l $tmp.log $tmp &
pid=$!
echo "pid=$pid" >>$seq.full
cat <<End-of-File >$tmp.pmlc
quit
End-of-File
sleep 1
pmlc -e <$tmp.pmlc $! 2>&1 | _filter_pmlc
if ps -p $pid >/dev/null
then
echo "Error: pmlogger still alive!"
kill -TERM $pid
fi
[ -f $tmp.log ] && cat $tmp.log >>$seq.full
echo "--- expect success from pmlc ---" | tee -a $seq.full
rm -f $tmp.0 $tmp.meta $tmp.index $tmp.log
$sudo_local_ctx pmlogger -c /dev/null -L -o -l $tmp.log $tmp &
pid=$!
echo "pid=$pid" >>$seq.full
sleep 1
pmlc -e <$tmp.pmlc $! 2>&1 | _filter_pmlc
if ps -p $pid >/dev/null
then
$sudo_local_ctx kill -TERM $pid
else
echo "Error: pmlogger has died!"
fi
[ -f $tmp.log ] && cat $tmp.log >>$seq.full
echo | tee -a $seq.full
echo "=== OK case ===" | tee -a $seq.full
hertz=`pmprobe -v kernel.all.hz | $PCP_AWK_PROG '{ print $3 }'`
pagesz=`pmprobe -v hinv.pagesize | $PCP_AWK_PROG '{ print $3 }'`
# ensure pmcd is unavailable while this test is running
_service pcp stop | _filter_pcp_stop
$sudo_local_ctx rm -f $tmp.0 $tmp.meta $tmp.index $tmp.log
pmlogger -c $tmp.config -l $tmp.log -T 5 --local-PMDA -K add,30,$PCP_PMDAS_DIR/sample/pmda_sample.$DSO_SUFFIX,sample_init $tmp >$tmp.err 2>&1
_filter_pmlogger_log <$tmp.log
echo "verifying the archive"
pmlogcheck $tmp
# expect 4, 5 or 6 sample lines for each metric
echo PAGESZ samples:
pmdumplog $tmp \
| _filter_pmdumplog \
| grep 'hinv.pagesize' \
| _filter_kernel \
| sed -e 5d -e 6d
echo HZ samples:
pmdumplog $tmp \
| _filter_pmdumplog \
| grep 'kernel.all.hz' \
| _filter_kernel \
| sed -e 5d -e 6d
echo MILLION samples:
pmdumplog $tmp \
| _filter_pmdumplog \
| grep 'sampledso.long.million' \
| _filter_kernel \
| sed -e 5d -e 6d
echo "Full log dump:" >> $seq.full
pmdumplog $tmp >> $seq.full
# success, all done
status=0
exit
|