Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 1011
blob81f1c54a396e7beffaee2ecf524882175c264c92
1 #!/bin/sh
2 # PCP QA Test No. 1011
3 # Compare pmdumptext output to pmval
5 seq=`basename $0`
6 echo "QA output created by $seq"
8 status=1 # failure is the default!
9 . ./common.qt
10 trap "_cleanup_qt; exit \$status" 0 1 2 3 15
12 which pmdumptext >/dev/null 2>&1 || _notrun "pmdumptext not installed"
14 date=`pmdumplog -l archives/gap | grep commencing |
15 sed -e 's/ commencing //' -e 's/\.[0-9]*//'`
17 _diff_filter()
19 # do nothing, we want to see all of the text if there are differences
21 cat
22 # old stuff ...
24 # sed \
25 # -e "s/$date/DATE/g" \
26 # -e "s/^[<>] [0-2][0-9]:[0-5][0-9]:[0-5][0-9]/TIME/"
29 # Note: pmdumptext and pmval can disagree about the timezone when
30 # processing an archive, in the presence of timestamps in the
31 # archive coming from a period of daylight savings, and it not
32 # currently being a period of daylight savings, or vice versa.
33 # This sometimes produces a difference of 1 hour in the reported
34 # time between the tools, hence the HH: filtering here and in
35 # _pmdumptext_filter.
36 # Given the way timezones work for Linux in particular, this
37 # difference cannot be fixed, as the two applications use different
38 # ways of interacting with the PCP timezones support.
40 _pmval_filter()
42 $PCP_AWK_PROG '{if (NF > 0) print $0}' |
43 sed \
44 -e 's/No values available/?/' \
45 -e '/^[a-z]*:/d' \
46 -e 's/.[0-9][0-9][0-9][ ]*/ /' \
47 -e 's/\.0*//' \
48 -e 's/^[012][0-9]:/HH:/' \
49 -e '/bin-/d' \
50 -e 's/[ ]*$//' \
51 -e 's/ [ ]*/ /g'
54 _pmdumptext_filter()
56 sed \
57 -e 's/^[012][0-9]:/HH:/' \
58 -e 's/? ? ? ? ? ? ? ? ?/?/'
61 # real QA test starts here
62 rm -f $seq.full
64 for metric in \
65 pmcd.pdu_in.total \
66 pmcd.pdu_in.fetch \
67 pmcd.numagents \
68 sample.bin
70 echo Raw $metric
71 echo Raw $metric >>$seq.full
72 pmval -t 1 -r -a archives/gap $metric 2>&1 | _pmval_filter > $tmp.pmval
73 pmdumptext -G -w 16 -t 1 -r -a archives/gap -d" " -f "%H:%M:%S" $metric 2>&1 | _pmdumptext_filter > $tmp.dump
74 diff $tmp.pmval $tmp.dump | _diff_filter
75 echo "--- pmval ---" >>$seq.full
76 cat $tmp.pmval >>$seq.full
77 echo "--- pmdumptext ---" >>$seq.full
78 cat $tmp.dump >>$seq.full
80 echo Rate $metric
81 echo Rate $metric >>$seq.full
82 pmval -t 1 -a archives/gap $metric 2>&1 | _pmval_filter > $tmp.pmval
83 pmdumptext -G -w 16 -t 1 -a archives/gap -d" " -f "%H:%M:%S" $metric 2>&1 | _pmdumptext_filter > $tmp.dump
84 diff $tmp.pmval $tmp.dump | _diff_filter
85 echo "--- pmval ---" >>$seq.full
86 cat $tmp.pmval >>$seq.full
87 echo "--- pmdumptext ---" >>$seq.full
88 cat $tmp.dump >>$seq.full
90 done
92 # success, all done
93 status=0
94 exit