/var/lib/pcp/testsuite/669 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 | #! /bin/sh
# PCP QA Test No. 669
# checks pmmgr large-archive-set functionality
#
# Copyright (c) 2016 Red Hat, Inc.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
which pmmgr >/dev/null 2>&1 || _notrun "No pmmgr binary installed"
echo pmmgr ok
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
rm -f $seq.full
status=1 # failure is the default!
hostname=`hostname`
trap "_cleanup" 0 1 2 3 15
_cleanup()
{
if [ -n "$pid" ]; then kill $pid; fi
# restart pmcd and primary pmlogger
_service pcp restart >>$seq.full 2>&1
_wait_for_pmcd
_wait_for_pmlogger
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
exit $status
}
_filter()
{
tee -a $seq.full |
sed -e 's,^\[.*\],TIMESTAMP,' \
-e 's,pmmgr.[0-9]*/[0-9]*.,pmmgr(PID/TID),' \
-e 's,hostid [a-zA-Z0-9_-.]*,hostid HOSTID,' \
-e 's,at [a-zA-Z0-9_-.:]*,at LOCAL,' \
-e 's,'$tmp.dir',TMPDIR,'
}
_filter2()
{
tee -a $seq.full |
sed -e 's,'$hostname',HOSTNAME,' \
-e 's,[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\.[0-9][0-9]*[0-9][0-9][0-9][0-9],YYYYMMDD-HHMMSS,'
}
# This test prereqs only pmcd running locally.
# In the future, remote, avahi
echo "hostname=$hostname" >>$seq.full
id >>$seq.full
date >>$seq.full
echo "=== 1. prepare blank pmmgr config directory ===" | tee -a $seq.full
$sudo rm -rf $tmp.dir
mkdir $tmp.dir
chmod 777 $tmp.dir
ls -ld $tmp.dir >>$seq.full
date >>$seq.full
echo "=== 2. generate a bunch of short archives ===" | tee -a $seq.full
# put in some blank lines and terminate without \n
echo >>$tmp.dir/target-host
echo >>$tmp.dir/target-host
$PCP_ECHO_PROG $PCP_ECHO_N 'local:'"$PCP_ECHO_C" >>$tmp.dir/target-host
echo $tmp.dir > $tmp.dir/log-directory
echo 'log advisory on default { pmcd.hostname }' > $tmp.dir/pmlogger.conf
echo '-t 1 -s 1 -c '$tmp.dir'/pmlogger.conf' > $tmp.dir/pmlogger # "one ping only"
# note -v -v here is the same as -D appl0,appl1
env PCP_PMMGR_MERGEBATCH=15 pmmgr -v -v -p 1 -l $tmp.out -c $tmp.dir >$tmp.valout 2>$tmp.valerr &
pid=$!
echo "pid=$pid" >>$seq.full
sleep 5
_service pmcd start >>$seq.full 2>&1
_wait_for_pmcd
sleep 90 # enough for some
_service pmcd stop >>$seq.full 2>&1
date >>$seq.full
echo "=== 3. check on number of archives and zip 'em up ===" | tee -a $seq.full
ls -l $tmp.dir/$hostname >> $seq.full
num=`ls -1 $tmp.dir/$hostname/*.index | wc -l | sed -e 's/ //g'`
if [ $num -gt 30 ]; then
echo more than thirty
else
echo "boo num=$num, expected > 30"
fi
(cd $tmp.dir; tar cf $hostname.tar $hostname)
date >>$seq.full
echo "=== 4. do a few rounds of batched log merging ===" | tee -a $seq.full
# a few blank lines - interpreted as though there was one
echo > $tmp.dir/pmlogmerge
echo VERY IGNORED >> $tmp.dir/pmlogmerge
echo IGNORED >> $tmp.dir/pmlogmerge
_service pmcd start >>$seq.full 2>&1
_wait_for_pmcd
sleep 20 # enough for some cycles of log merging batches
_service pmcd stop >>$seq.full 2>&1
date >>$seq.full
echo "=== 5. check on number of archives after batched logmerge ===" | tee -a $seq.full
ls -l $tmp.dir/$hostname >> $seq.full
num=`ls -1 $tmp.dir/$hostname/*.index | wc -l | sed -e 's/ //g'`
if [ $num -lt 5 ]; then
echo less than 5
else
echo "boo num=$num, expected < 5"
fi
date >>$seq.full
echo "=== 5. replace set with original archives ===" | tee -a $seq.full
(cd $tmp.dir; mv $hostname $hostname.OLD; tar xf $hostname.tar)
ls -l $tmp.dir/$hostname >> $seq.full
date >>$seq.full
echo "=== 6. corrupt ten of them ===" | tee -a $seq.full
ls -1 $tmp.dir/$hostname/*.meta | head -10 | while read file
do
dd if=/dev/zero of=$file count=1 bs=512 >/dev/null 2>&1
done
date >>$seq.full
echo "=== 7. do a few rounds of batched log merging ===" | tee -a $seq.full
touch $tmp.dir/pmlogmerge
_service pmcd start >>$seq.full 2>&1
_wait_for_pmcd
sleep 20 # enough for some cycles of log merging batches
_service pmcd stop >>$seq.full 2>&1
date >>$seq.full
echo "=== 8. expect 10 corrupt leftovers ===" | tee -a $seq.full
ls -1 $tmp.dir/$hostname/corrupt*.meta | wc -l | sed -e 's/ //g'
date >>$seq.full
echo "=== 9. turn on short-term corrupt-gc and cycle a little longer ===" | tee -a $seq.full
echo 10sec > $tmp.dir/pmlogcheck-corrupt-gc
_service pmcd start >>$seq.full 2>&1
_wait_for_pmcd
sleep 20 # enough for some cycles of log merging batches
_service pmcd stop >>$seq.full 2>&1
date >>$seq.full
echo "=== 10. expect no corrupt leftovers ===" | tee -a $seq.full
ls -1 $tmp.dir/$hostname/corrupt*.meta 2>/dev/null | wc -l | sed -e 's/ //g'
echo "== collecting full pmmgr logs:" >>$seq.full
cat $tmp.out >>$seq.full
echo >>$seq.full
echo "== collecting recent daemon logs:" >>$seq.full
for log in $tmp.dir/$hostname/*.log
do
if [ -f "$log" ]
then
echo "-- $log --" >>$seq.full
cat $log >>$seq.full
fi
done
status=0
exit
|