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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
#!/bin/sh
# PCP QA Test No. 1384
# simplest pmlogrewrite test for V3 (and V2) archives ... no
# delta indoms, so output archive should be the same as the
# input archive
# also feature bits rewriting tests
#
# non-valgrind variant, see qa/1386 for the valgrind variant
#
# Copyright (c) 2022 Ken McDonell. All Rights Reserved.
#
if [ $# -eq 0 ]
then
seq=`basename $0`
echo "QA output created by $seq"
else
# use $seq from caller, unless not set
[ -n "$seq" ] || seq=`basename $0`
echo "QA output created by `basename $0` $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
do_valgrind=false
if [ "$1" = "--valgrind" ]
then
_check_valgrind
do_valgrind=true
elif which valgrind >/dev/null 2>&1
then
: note we want to run both variants for this test, as the
: valgrind variant filters away the functional checks and
: only reports memory issues
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s@$tmp@TMP@g" \
# end
}
# real QA test starts here
for version in 2 3
do
echo
echo "--- Version $version archive ---"
rm -f $tmp.0 $tmp.meta $tmp.index
if $do_valgrind
then
_run_valgrind pmlogextract tmparch/sampledso-no-delta_v$version $tmp
else
pmlogrewrite tmparch/sampledso-no-delta_v$version $tmp 2>&1
fi \
| _filter
echo "=== scanmeta for input ===" >>$seq_full
src/scanmeta -a tmparch/sampledso-no-delta_v$version.meta 2>&1 \
| tee -a $seq_full \
| sed -e 's/^\[[0-9][0-9]*/[NN/' \
| LC_COLLATE=POSIX sort >$tmp.input
echo >>$seq_full
echo "=== scanmeta for output ===" >>$seq_full
src/scanmeta -a $tmp.meta 2>&1 \
| tee -a $seq_full \
| sed -e 's/^\[[0-9][0-9]*/[NN/' \
| LC_COLLATE=POSIX sort >$tmp.output
echo "=== scanmeta diffs ==="
diff $tmp.input $tmp.output
echo "=== dumplog for input ===" >>$seq_full
pmdumplog -aI tmparch/sampledso-no-delta_v$version 2>&1 \
| tee -a $seq_full \
| sed -e '/^PID for pmlogger:/s/[0-9][0-9]*/<PID>/' >$tmp.input
echo >>$seq_full
echo "=== dumplog for output ===" >>$seq_full
pmdumplog -aI $tmp 2>&1 \
| tee -a $seq_full \
| sed -e '/^PID for pmlogger:/s/[0-9][0-9]*/<PID>/' >$tmp.output
echo "=== pmdumplog diffs ==="
diff $tmp.input $tmp.output
done
$do_valgrind && exit
# exercise some V3 features and error checks
#
cat <<'End-of-File' >$tmp.0
global {
timezone -> "AEST-10"
}
End-of-File
cat <<'End-of-File' >$tmp.1
global {
zoneinfo -> ":Africa/Timbuktu"
}
End-of-File
cat <<'End-of-File' >$tmp.2
global {
features -> 2147483655
}
End-of-File
pmdumplog -z -L archives/bozo.client_v2 >$tmp.label.2
echo
echo "Expect timezone to change ..."
pmlogrewrite -V 3 -c $tmp.0 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
pmdumplog -z -L $tmp.eek >$tmp.label.3
diff $tmp.label.[23]
rm -f $tmp.eek.*
echo
echo "Expect zoneinfo to be added ..."
pmlogrewrite -V 3 -c $tmp.1 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
pmdumplog -z -L $tmp.eek >$tmp.label.3
diff $tmp.label.[23]
rm -f $tmp.eek.*
echo
echo "Expect feature bits 0,1,2 and 31 to be added ..."
pmlogrewrite -V 3 -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
pmdumplog -z -L $tmp.eek >$tmp.label.3
diff $tmp.label.[23]
echo
echo "Expect feature bit 0 and 1 to be removed ..."
cat <<'End-of-File' >$tmp.2
global {
features -> BITS(31,2)
}
End-of-File
pmlogrewrite -V 3 -c $tmp.2 $tmp.eek $tmp.urk 2>&1 | _filter
pmdumplog -z -L $tmp.urk >$tmp.label.4
diff $tmp.label.[34]
rm -f $tmp.eek.* $tmp.urk.*
echo
echo "Expect errors ..."
pmlogrewrite -c $tmp.1 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
cat <<'End-of-File' >$tmp.2
global {
# missing )
features -> bits(31.32
}
End-of-File
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
cat <<'End-of-File' >$tmp.2
global {
# space not comma
features -> bits(31 32)
}
End-of-File
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
cat <<'End-of-File' >$tmp.2
global {
# missing list...)
features -> bits(
}
End-of-File
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
cat <<'End-of-File' >$tmp.2
global {
# missing (list...)
features -> bits
}
End-of-File
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
echo
cat <<'End-of-File' >$tmp.2
global {
features -> bits(33)
}
End-of-File
pmlogrewrite -c $tmp.2 archives/bozo.client_v2 $tmp.eek 2>&1 | _filter
rm -f $tmp.eek.*
# success, all done
exit
|