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
|
#!/bin/sh
# PCP QA Test No. 1195
# pmlogrewrite handling of empty archives
#
# Copyright (c) 2020 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
if which xz >/dev/null
then
:
else
_notrun "No xz(1) executable"
# NOTREACHED
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=1 # failure is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
mkdir $tmp
# really empty
#
for suff in 0 meta index
do
echo >$tmp/0.$suff
done
# just the label record, and an OK archive
#
for suff in 0 meta index
do
if [ "$PCP_ARCHIVE_VERSION" = 3 ]
then
labelsize=808
else
labelsize=132
fi
dd if=tmparch/foo.$suff of=$tmp/1.$suff ibs=1 count=$labelsize >/dev/null 2>&1
cp tmparch/foo.$suff $tmp/2.$suff
done
# and now compressed versions of the .meta and .0 files
#
for s in 0 1 2
do
d=`expr $s + 3`
cp $tmp/$s.index $tmp/$d.index
for suff in 0 meta
do
cp $tmp/$s.$suff $tmp/$d.$suff
xz $tmp/$d.$suff
done
done
ls -l $tmp >>$seq_full
# real QA test starts here
cd $tmp
for arch in ?.index
do
arch=`echo "$arch" | sed -e 's/\.index$//'`
echo "=== $arch ===" | tee -a $seq_full
pmlogrewrite -Dappl7 -i $arch 2>$tmp.err
cat $tmp.err >>$seq_full
grep -v '^TI\[' $tmp.err
done
cd $here
pmdumplog -a tmparch/foo >$tmp.ref
echo "=== foo:2 expect no diffs ==="
pmdumplog -a $tmp/2 | diff - $tmp.ref
echo "=== foo:5 expect no diffs ==="
pmdumplog -a $tmp/5 | diff - $tmp.ref
# diags for CI failure
#
echo "--- TI tmparch/foo --" >>$seq_full
pmdumplog -t tmparch/foo >>$seq_full
echo "--- TI 2 --" >>$seq_full
pmdumplog -t $tmp/2 >>$seq_full
echo "--- TI 5 --" >>$seq_full
pmdumplog -t $tmp/5 >>$seq_full
# success, all done
status=0
exit
|