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
|
#!/bin/sh
# PCP QA Test No. 1010
# Test pmdumptext output formats
#
seq=`basename $0`
echo "QA output created by $seq"
status=1 # failure is the default!
. ./common.qt
trap "_cleanup_qt; exit \$status" 0 1 2 3 15
which pmdumptext >/dev/null 2>&1 || _notrun "pmdumptext not installed"
_filter()
{
$PCP_AWK_PROG '
BEGIN { state = 0 }
$1 == "General" { print; print "...:"; state = 1; next }
$1 == "Reporting" { print; print "...:"; state = 1; next }
state == 1 && NF == 0 { state = 0 }
state == 1 { next }
{ print }' \
| sed "s/^[A-Za-z]* [A-Za-z]* [ 0-3][0-9] [ 0-2][0-9]:[0-5][0-9]:[0-5][0-9]/VERY_VERY_LONG_TIME/" \
| sed "s/^[ 0-2][0-9]:[0-5][0-9]:[0-5][0-9]/SHRTTIME/"
}
# real QA test starts here
cat << end-of-file > $tmp.log_conf
log mandatory on 1 second {
sample.hordes.one
sample.double
}
end-of-file
pmlogger -c $tmp.log_conf -s 5s $tmp.log
cat << end-of-file > $tmp.conf
sample.hordes.one["3"]
sample.double.ten
sample.double.hundred
sample.double.million
sample.double.ten 0.5
sample.double.hundred -0.0033
sample.double.million 0.000056
end-of-file
pmdumplog -a $tmp.log >>$seq_full
for i in '' '-i' '-i -w 10'
do
for f in '' '-M' '-F' '-G' '-f %H:%M:%S'
do
echo
echo "pmdumptext $i $f -umN"
# +999nsec is to compensate for pmdumptext working in usec precision
# and truncating the start time from nsec to usec, +999nsec ensures
# we are *just* past the first record in the archive
#
pmdumptext -S +999nsec $i $f -d' ' -umN -t 1 -s 3 -c $tmp.conf -a $tmp.log 2>&1 \
| tee -a $seq_full \
| _filter
done
done
# success, all done
status=0
exit
|