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
|
#!/bin/sh
# PCP QA Test No. 1509
# derived metrics - iostat.conf workout
#
# non-valgrind variant, see qa/1516 for the valgrind variant
#
# Copyright (c) 2024 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/1516 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
_filter()
{
sed \
-e "s@$tmp@TMP@g" \
-e '/pmie: timezone set to/d' \
# end
}
unset PCP_DERIVED_CONFIG
# Usage: _doit archive metric-to-cull ...
#
_doit()
{
archive="$1"
shift
base=`echo "$2" | sed -e 's/\.[^.][^.]*$//'`
echo
echo "=== $base.* ===" | tee -a $seq_full
# get all real metrics, including derived ones, and build pmie script
#
pminfo -a "$archive" $base \
| sed >$tmp.pmie \
-e '/^pmcd\./d' \
-e '/^event\./d' \
-e 's/.*\.\([^.][^.]*\)$/\1 = &;/' \
# end
# baseline
#
pmie -t 3 -v -z -a "$archive" -c $tmp.pmie 2>>$seq_full \
| _filter >$tmp.baseline
pmlogdump -a "$archive" >$tmp.dump.baseline
# all the real metrics in the archive
#
PCP_DERIVED_CONFIG= pminfo -a "$archive" \
| sed -e '/^event\./d' >$tmp.all
_filter <$tmp.baseline
for m
do
echo
echo "--- cull $m from archive" | tee -a $seq_full
sed -e "/^$m\$/d" <$tmp.all >$tmp.xtract
if diff $tmp.all $tmp.xtract >/dev/null
then
echo "Botch: metric $m not in list from archive $archive"
status=1
exit
fi
rm -f $tmp.index $tmp.meta $tmp.0
pmlogextract -c $tmp.xtract "$archive" $tmp
# audit extracted archive diffs
#
pmlogdump -a $tmp >$tmp.tmp
diff $tmp.dump.baseline $tmp.tmp >>$seq_full
# rerun pmie
#
if $do_valgrind
then
_run_valgrind --save-output pmie -t 3 -v -z -a $tmp -c $tmp.pmie 2>&1 \
| _filter
cat $tmp.err >>$seq_full
_filter <$tmp.out >$tmp.tmp
else
pmie -t 3 -v -z -a $tmp -c $tmp.pmie 2>>$seq_full \
| _filter >$tmp.tmp
fi
# show only diffs
#
diff $tmp.baseline $tmp.tmp | _filter
done
}
# real QA test starts here
_doit archives/disk-a \
disk.dev.total_rawactive disk.dev.read_rawactive disk.dev.write_rawactive \
disk.dev.discard_rawactive disk.dev.discard \
disk.dev.flush_rawactive disk.dev.flush \
disk.dev.discard_bytes disk.dev.avactive
_doit archives/disk-a \
disk.dm.total_rawactive disk.dm.read_rawactive disk.dm.write_rawactive \
disk.dm.discard_rawactive disk.dm.discard \
disk.dm.flush_rawactive disk.dm.flush \
disk.dm.discard_bytes disk.dm.avactive
_doit archives/disk-a \
disk.md.total_rawactive disk.md.read_rawactive disk.md.write_rawactive \
disk.md.discard_rawactive disk.md.discard \
disk.md.flush_rawactive disk.md.flush \
disk.md.discard_bytes disk.md.avactive
_doit archives/disk-b \
disk.wwid.total_rawactive disk.wwid.read_rawactive disk.wwid.write_rawactive \
disk.wwid.discard_rawactive disk.wwid.discard \
disk.wwid.flush_rawactive disk.wwid.flush \
disk.wwid.discard_bytes disk.wwid.avactive
# success, all done
exit
|