zsh completions: minor tweaks
[pcp.git] / qa / 129
blob3fb63fab4639b3857842c452e75fdaf199ac6b49
1 #! /bin/sh
2 # PCP QA Test No. 129
3 # pmlogreduce rate conversion
5 # Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
6 #
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 status=0 # success is the default!
17 $sudo rm -rf $tmp.*
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 rm -f $seq.full
22 _filter()
24 sed \
25 -e '/^ *$/d' \
26 -e 's/ */ /g' \
27 -e 's/ $//' \
28 -e '/End of PCP archive log/d' \
29 | $PCP_AWK_PROG '
30 BEGIN { skip = 1 }
31 $1 == "interval:" { skip = 0; next }
32 skip == 0 { print }'
35 _fix_e_fmt()
37 sed \
38 -e 's/\([0-9]\)E/\1 E /' \
39 | $PCP_AWK_PROG '
40 { printf "%s",$1
41 for (i = 2; i <= NF; i++) {
42 if ($(i+1) == "E") {
43 b = $(i+2)
44 s = 1.0
45 while (b < 0) {
46 s /= 10
47 b++
49 while (b > 0) {
50 s *= 10
51 b--
53 $i *= s
54 printf " %s",$i
55 i += 2
57 else
58 printf " %s",$i
60 print ""
64 _do()
66 $PCP_ECHO_PROG $PCP_ECHO_N "$1""$PCP_ECHO_C"
67 echo >>$seq.full
68 echo "=== $1 orig ===" >>$seq.full
69 pmval -z -O 1m -A 15m -t 15m -a archives/kenj-pc-1 $1 2>$tmp.orig.err \
70 | tee -a $seq.full \
71 | _fix_e_fmt \
72 | _filter >$tmp.orig
73 echo "--- stderr ---" >>$seq.full
74 cat $tmp.orig.err >>$seq.full
75 echo "--- filtered ---" >>$seq.full
76 cat $tmp.orig >>$seq.full
78 echo "=== $1 reduce ===" >>$seq.full
79 pmval -z -O 15m -A 15m -t 15m -a $tmp $1 2>$tmp.reduce.err \
80 | tee -a $seq.full \
81 | _fix_e_fmt \
82 | _filter >$tmp.reduce
83 echo "--- stderr ---" >>$seq.full
84 cat $tmp.reduce.err >>$seq.full
85 echo "--- filtered ---" >>$seq.full
86 cat $tmp.reduce >>$seq.full
88 join -a 1 -a 2 -e "?" $tmp.orig $tmp.reduce >$tmp.join
90 # cat $tmp.join
92 $PCP_AWK_PROG <$tmp.join >$tmp.chk '
93 NF != 3 { if (NR > 1) print
94 next
96 $2 == "?" { print; next }
97 $3 == "?" { print; next }
98 { if (0.99*$2 <= $3 && $3 <= 1.01*$2) next }
99 { print }'
101 if [ -s $tmp.chk ]
102 then
103 $PCP_ECHO_PROG " mismatches ..."
104 echo "--- chk ---" >>$seq.full
105 cat $tmp.chk >>$seq.full
106 cat $tmp.orig.err
107 cat $tmp.reduce.err
108 diff -u $tmp.orig $tmp.reduce
109 else
110 $PCP_ECHO_PROG " OK"
114 # real QA test starts here
115 pmlogreduce -A 15m -t 15m -D appl0,appl1,appl2 archives/kenj-pc-1 $tmp 2>>$seq.full
117 for m in \
118 disk.all.total kernel.all.cpu.idle \
119 disk.dev.total kernel.percpu.cpu.user
121 _do $m
122 done