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
|
#!/bin/sh
# PCP QA Test No. 1197
# pmlogextract 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
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
pmlogextract 0 1 2 3 4 $tmp
if [ ! -f $tmp.0 ]
then
echo "Botch, no output file from pmlogextract!"
exit
fi
cd $here
pmdumplog -a tmparch/foo | sed -e '/PID for pmlogger:/d' >$tmp.ref
echo "=== foo:tmp expect no diffs ==="
pmdumplog -a $tmp.0 | sed -e '/PID for pmlogger:/d' >$tmp.xtract
if diff $tmp.ref $tmp.xtract
then
:
else
diff -u $tmp.ref $tmp.xtract >>$seq_full
ls -l tmparch/foo.* $tmp.* >>$seq_full
echo "=== metadata for .ref ===" >>$seq_full
src/scanmeta -a tmparch/foo.meta 2>&1 | tee -a $seq_full >$tmp.ref.meta
echo "=== metadata for .xtract ===" >>$seq_full
src/scanmeta -a $tmp.meta 2>&1 | tee -a $seq_full >$tmp.xtract.meta
echo "=== diffs ===" >>$seq_full
diff -u $tmp.ref.meta $tmp.xtract.meta >>$seq_full
fi
echo
echo "=== only empty archive(s) cases ==="
cd $tmp
pmlogextract 0 $tmp
pmlogextract 0 1 $tmp
pmlogextract 0 1 3 $tmp
pmlogextract 0 1 3 4 $tmp
cd $here
# success, all done
status=0
exit
|