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
|
#!/bin/sh
# PCP QA Test No. 566
# basic pmlogcheck workout
#
# Copyright (c) 2013 Ken McDonell. All Rights Reserved.
# Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
status=1 # failure is the default!
trap "cd $here; rm -rf $tmp $tmp.*; exit \$status" 0 1 2 3 15
mkdir $tmp
_filter_hostnames()
{
sed -e 's/host \".*\"/host \"HOST\"/g' $tmp.out > $tmp.out.1
mv $tmp.out.1 $tmp.out
sed -e 's/host \".*\"/host \"HOST\"/g' $tmp.err > $tmp.err.1
mv $tmp.err.1 $tmp.err
}
_filter_metalabel()
{
# sometimes a pmcd_label_change event occurs during recording (.meta)
sed -e 's/found 35 records$/found 34 records/g' $tmp.err > $tmp.err.1
mv $tmp.err.1 $tmp.err
}
_filter()
{
_filter_hostnames
_filter_metalabel
echo >>$seq_full
echo "stdout" >>$seq_full
cat $tmp.out >>$seq_full
echo "stderr" >>$seq_full
cat $tmp.err >>$seq_full
sed -e "s;$tmp;TMP;g" $tmp.out
sed -e "s;$tmp;TMP;g" $tmp.err
}
# real QA test starts here
LC_COLLATE=POSIX; export LC_COLLATE
echo "== new diagnostics ==" >> $seq.full
pmdumplog -dehIL tmparch/foo >> $seq.full
echo "== pre diagnostic0 ==" >> $seq.full
pmlogcheck -z -v tmparch/foo >> $seq.full 2>&1
echo "== pre diagnostic1 ==" >> $seq.full
$here/src/scanmeta -a tmparch/foo.meta >> $seq.full
echo "== end diagnostics ==" >> $seq.full
echo "=== directory traversal and file checks ===" | tee -a $seq_full
cp tmparch/foo.index $tmp
( echo; echo "TMP/foo.index alone:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
_filter
cp tmparch/foo.0 $tmp
( echo; echo "TMP/foo.meta missing:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
_filter
rm $tmp/foo.0
cp tmparch/foo.meta $tmp
( echo; echo "TMP/foo.0 missing:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
_filter
rm $tmp/foo.index
cp tmparch/foo.0 $tmp
( echo; echo "TMP/foo.index missing:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
_filter
cp tmparch/foo.index $tmp
touch $tmp/foo
touch $tmp/foo.
touch $tmp/foobar.0
touch $tmp/foo.999
touch $tmp/foo.1
chmod 0 $tmp/foo.1
touch $tmp/foo.bar
touch $tmp/foo.9x9
( echo; echo "TMP/bar:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/bar >$tmp.out 2>$tmp.err
_filter
( echo; echo "TMP/foo:" ) | tee -a $seq_full
pmlogcheck -z -v $tmp/foo >$tmp.out 2>$tmp.err
_filter
cd $tmp
( echo; echo "foo:" ) | tee -a $seq_full
pmlogcheck -z -v foo >$tmp.out 2>$tmp.err
_filter
chmod 644 foo.1
( echo; echo "foo.index:" ) | tee -a $seq_full
pmlogcheck -z -v foo.index >$tmp.out 2>$tmp.err
_filter
( echo; echo "archive-20150415.044829:" ) | tee -a $seq_full
ln foo.0 archive-20150415.044829.0
ln foo.meta archive-20150415.044829.meta
ln foo.index archive-20150415.044829.index
pmlogcheck -z -v archive-20150415.044829 >$tmp.out 2>$tmp.err
_filter
cd $here
echo | tee -a $seq_full
echo "=== pass 0 failures ===" | tee -a $seq_full
for arch in `ls badarchives/badlen-*.meta` badarchives/badti-1 `ls badarchives/badlabel-*.meta`
do
# some of the bad archives may not have pass 0 style corruption,
# so skip these ones for now
#
case $arch
in
badarchives/badlen-0.meta|badarchives/badlen-8.meta|badarchives/badlabel-0.meta)
;;
*)
( echo; echo "$arch:" ) | tee -a $seq_full
pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
_filter
;;
esac
done
echo | tee -a $seq_full
echo "=== pass 1 failures ===" | tee -a $seq_full
for arch in `ls badarchives/badti-*.index`
do
# some of the bad archives may not have pass 1 style corruption,
# so skip these ones for now
#
case $arch
in
badarchives/badti-1.index)
;;
*)
( echo; echo "$arch:" ) | tee -a $seq_full
pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
_filter
;;
esac
done
echo | tee -a $seq_full
echo "=== pass 3 failures ===" | tee -a $seq_full
for arch in `ls badarchives/badlog-*.0`
do
# some of the bad archives may not have pass 3 style corruption,
# so skip these ones for now
#
case $arch
in
*)
( echo; echo "$arch:" ) | tee -a $seq_full
pmlogcheck -z -v $arch >$tmp.out 2>$tmp.err
_filter
;;
esac
done
# success, all done
status=0
exit
|