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
|
#!/bin/sh
# PCP QA Test No. 1420
# comparing input archive and pmlogreduce output archive in terms
# of metadata and metric values, for both V2 and V3 archives
#
# non-valgrind variant, see qa/1421 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
[ $PCPQA_VALGRIND = both ] || \
_notrun "valgrind variant qa/1421 will be run"
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
cat <<End-of-File >$tmp.config
sample.colour
sample.write_me
sample.dupnames.four.colour
sample.dupnames.two.write_me
sample.dupnames.three.write_me
sample.long.million
sample.long.write_me
sample.long.bin_ctr
sample.ulong.million
sample.ulong.bin_ctr
sample.float.million
sample.float.bin_ctr
sample.longlong.million
sample.longlong.bin_ctr
sample.ulonglong.million
sample.ulonglong.bin_ctr
sample.double.million
sample.double.bin_ctr
sample.string.hullo
sample.string.bin
# sample.proc.ordinal
sample.proc.exec
# sample.proc.time
# sampledso.event.records
# sampledso.event.highres_records
pmcd.seqnum
pmcd.pid
pmcd.pmlogger.archive
pmcd.pmlogger.port
pmcd.pmlogger.host
# event.flags
# event.missed
End-of-File
_filter()
{
tee -a $seq_full \
| sed \
-e "s@$tmp@TMP@g" \
-e '/^end:/s/ .*/ DATE/' \
-e '/^archive:/s/ .*/ PATH/' \
# end
}
# filter out and sort unique metadata records
# also pmlogreduce does not emit help text records nor
# label records, so cull these
#
_scanmeta()
{
src/scanmeta -a "$1.meta" \
| tee -a $seq_full \
| sed -n -e '/^\[/s/[^ ]*] //p' \
| sed \
-e 's/$/ /' \
-e 's/@ [^ ]* //' \
-e '/oneline text/d' \
-e '/help text/d' \
-e '/metric label/d' \
-e 's/ $//' \
| LC_COLLATE=POSIX sort \
| uniq
}
# real QA test starts here
echo "Mostly silence is golden ..."
for vers in 2 3
do
echo
echo "=== Version $vers ===" | tee -a $seq_full
echo
# remove problematic metrics, like event records
#
rm -f $tmp.x.0 $tmp.x.meta $tmp.x.index
pmlogextract -c $tmp.config archives/omnibus-nomark_v$vers $tmp.x
echo "+++ input archive scanmeta" >>$seq_full
_scanmeta $tmp.x >$tmp.in.meta
rm -f $tmp.0 $tmp.meta $tmp.index
if $do_valgrind
then
_run_valgrind pmlogreduce -t 1sec $tmp.x $tmp
else
pmlogreduce -t 1sec $tmp.x $tmp 2>&1
fi \
| sed -e "s@$tmp@TMP@g"
echo "+++ output archive scanmeta" >>$seq_full
_scanmeta $tmp >$tmp.out.meta
if diff $tmp.in.meta $tmp.out.meta >$tmp.diff
then
:
else
echo "--- metadata differences ---"
cat $tmp.diff
fi
sed -e '/^#/d' <$tmp.config \
| while read metric
do
echo "+++ input archive pmval for $metric" >>$seq_full
pmval -a $tmp.x -z -S +1.01sec -s 5 -w 12 -t 1sec $metric | _filter >$tmp.in
echo "+++ output archive pmval for $metric" >>$seq_full
pmval -a $tmp -z -S +1.01sec -s 5 -w 12 -t 1sec $metric | _filter >$tmp.out
if diff $tmp.in $tmp.out >$tmp.diff
then
:
else
echo "--- $metric ---"
cat $tmp.diff
fi
done
done
# success, all done
exit
|