summaryrefslogtreecommitdiff
path: root/qa/1011
blob: 27cc02d3bed882958439822f14e9a23a08509bb9 (plain)
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
#!/bin/sh
# PCP QA Test No. 1011
# Compare pmdumptext output to pmval
#
seq=`basename $0`
echo "QA output created by $seq"
. ./common.qt

which pmdumptext >/dev/null 2>&1 || _notrun "pmdumptext not installed"

status=1	# failure is the default!
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

date=`pmdumplog -l archives/gap | grep commencing |
	sed -e 's/  commencing //' -e 's/\.[0-9]*//'`

_diff_filter()
{
    # do nothing, we want to see all of the text if there are differences
    #
    cat
    # old stuff ...
    #
    # sed \
    # -e "s/$date/DATE/g" \
    # -e "s/^[<>] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]/TIME/"
}

# Note: pmdumptext and pmval can disagree about the timezone when
#       processing an archive, in the presence of timestamps in the
#       archive coming from a period of daylight savings, and it not
#       currently being a period of daylight savings, or vice versa.
#       This sometimes produces a difference of 1 hour in the reported
#       time between the tools, hence the HH: filtering here and in
#       _pmdumptext_filter.
#       Given the way timezones work for Linux in particular, this
#       difference cannot be fixed, as the two applications use different
#       ways of interacting with the PCP timezones support.
#
_pmval_filter()
{
    $PCP_AWK_PROG '{if (NF > 0) print $0}' |
    sed \
    -e 's/No values available/?/' \
    -e '/^[a-z]*:/d' \
    -e 's/.[0-9][0-9][0-9][ 	]*/ /' \
    -e 's/\.0*//' \
    -e 's/^[012][0-9]:/HH:/' \
    -e '/bin-/d' \
    -e 's/[ ]*$//' \
    -e 's/  [ ]*/ /g'
}

_pmdumptext_filter()
{
    sed \
    -e 's/^[012][0-9]:/HH:/' \
    -e 's/? ? ? ? ? ? ? ? ?/?/'
}

# real QA test starts here
rm -f $seq.full

for metric in \
    pmcd.pdu_in.total \
    pmcd.pdu_in.fetch \
    pmcd.numagents \
    sample.bin
do
    echo Raw $metric
    echo Raw $metric >>$seq.full
    pmval -t 1 -r -a archives/gap $metric 2>&1 | _pmval_filter > $tmp.pmval
    pmdumptext -G -w 16 -t 1 -r -a archives/gap -d" " -f "%H:%M:%S" $metric 2>&1 | _pmdumptext_filter > $tmp.dump
    diff $tmp.pmval $tmp.dump | _diff_filter
    echo "--- pmval ---" >>$seq.full
    cat $tmp.pmval >>$seq.full
    echo "--- pmdumptext ---" >>$seq.full
    cat $tmp.dump >>$seq.full

    echo Rate $metric
    echo Rate $metric >>$seq.full
    pmval -t 1 -a archives/gap $metric 2>&1 | _pmval_filter > $tmp.pmval
    pmdumptext -G -w 16 -t 1 -a archives/gap -d" " -f "%H:%M:%S" $metric 2>&1 | _pmdumptext_filter > $tmp.dump 
    diff $tmp.pmval $tmp.dump | _diff_filter
    echo "--- pmval ---" >>$seq.full
    cat $tmp.pmval >>$seq.full
    echo "--- pmdumptext ---" >>$seq.full
    cat $tmp.dump >>$seq.full

done

# success, all done
status=0
exit