qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 490
blob00917ca27f96e64c4d78b60297cc5788d019e9d0
1 #!/bin/sh
2 # PCP QA Test No. 490
3 # check for mem leaks in pmlogrewrite
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
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 which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"
17 _check_valgrind
19 status=0 # success is the default!
20 $sudo rm -rf $tmp.* $seq.full
21 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
23 _filter()
25 sed \
26 -e "s;$tmp;TMP;g" \
27 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
30 _cmp()
32 if [ ! -f "$1.0" ]
33 then
34 echo "Arrgh ... $1.0 missing" | _filter
35 return
37 if [ ! -f "$2.0" ]
38 then
39 echo "Arrgh ... $2.0 missing" | _filter
40 return
42 pmdumplog -z -a $1 | tee -a $seq.full | sed -e '/\[[0-9][0-9]* bytes]/d' >$tmp.in
43 pmdumplog -z -a $2 | tee -a $seq.full | sed -e '/\[[0-9][0-9]* bytes]/d' >$tmp.out
44 if [ -n "$oldfilter" ]
45 then
46 $oldfilter <$tmp.in >$tmp.tmp
47 mv $tmp.tmp $tmp.in
49 if [ -n "$newfilter" ]
50 then
51 $newfilter <$tmp.out >$tmp.tmp
52 mv $tmp.tmp $tmp.out
54 echo "pmdumplog diffs ..."
55 diff -u $tmp.in $tmp.out | _filter
58 # find sample.mirage values and rescale like pmlogrewrite is expected to
60 # 10:47:07.419 29.0.37 (sample.mirage):
61 # inst [0 or "m-00"] value 27
62 # inst [12 or "m-12"] value 1226
63 # inst [13 or "m-13"] value 1325
64 # inst [15 or "m-15"] value 1524
65 # inst [16 or "m-16"] value 1623
66 # 29.0.7 (sample.drift): value 88
67 _scale()
69 $PCP_AWK_PROG '
70 /\(sample.mirage\):/ { xlate=1; print; next }
71 xlate == 1 && $1 != "inst" { xlate = 0 }
72 xlate == 1 && $1 == "inst" { $6 = int((3600*$6 + 512)/1024) }
73 { print }'
76 # same as _scale, w/out scale conversion ... copy awk whitespace rewriting
77 _noscale()
79 $PCP_AWK_PROG '
80 /\(sample.mirage\):/ { xlate=1; print; next }
81 xlate == 1 && $1 != "inst" { xlate = 0 }
82 xlate == 1 && $1 == "inst" { $6 = $6+0 }
83 { print }'
86 # real QA test starts here
88 cat <<End-of-File >$tmp.conf
89 global {
90 hostname -> whizz-bang.engr.sgi.com
91 TZ -> "GMT+10"
92 Time -> +30
94 indom 1.5 {
95 indom -> 42.10
96 iname "15 minute" -> "forever"
97 iname "1 minute" -> "1 minute is not very long unlike this string"
98 inst 15 -> 9999
100 metric 1.*.* { pmid -> 42.*.* }
101 metric irix.kernel.all.load { name->load type->double }
102 metric hinv.ncpu { name->hinv.number_of_cpus type->U64 }
103 End-of-File
104 rm -f $tmp.new.*
105 cat $tmp.conf >>$seq.full
106 _run_valgrind pmlogrewrite -c $tmp.conf archives/src-rattle $tmp.new 2>$tmp.err | _filter
107 cat $tmp.err >>$seq.full
108 _cmp archives/src-rattle $tmp.new
110 cat <<End-of-File >$tmp.conf
111 metric sample.mirage_longlong { type->U32 indom->NULL }
112 metric sample.scale_step.time_up_secs { type->FLOAT units->0,1,0,0,MSEC,0 }
113 End-of-File
114 rm -f $tmp.new.*
115 cat $tmp.conf >>$seq.full
116 _run_valgrind pmlogrewrite -c $tmp.conf archives/sample_expr $tmp.new 2>$tmp.err | _filter
117 cat $tmp.err >>$seq.full
118 _cmp archives/sample_expr $tmp.new
120 cat <<End-of-File >$tmp.conf
121 metric sample.bin { name -> x23456789.sample.bin type -> 64 }
122 metric sample.mirage { type -> FLOAT units -> 1,-1,0,MBYTE,HOUR,0 }
123 metric sample.drift { delete }
124 indom 29.2 {
125 iname "bin-100" -> delete
126 iname "bin-400" -> delete
127 iname "bin-500" -> delete
128 iname "bin-600" -> delete
129 inst 900 -> delete }
130 indom 29.3 { iname "m-00" -> delete inst 33 -> delete }
131 End-of-File
132 rm -f $tmp.new.*
133 cat $tmp.conf >>$seq.full
134 _run_valgrind pmlogrewrite -s -c $tmp.conf archives/mirage $tmp.new 2>$tmp.err | _filter
135 cat $tmp.err >>$seq.full
136 oldfilter=_scale
137 newfilter=_noscale
138 _cmp archives/mirage $tmp.new
140 echo
141 echo "=== correctness checked in QA 493 ... only care about valgrind here ==="
142 cat <<End-of-File >$tmp.conf
143 metric sample.ulong.bin_ctr {
144 indom -> NULL output MIN
145 type -> DOUBLE
146 units -> 1,0,0,BYTE,0,0
148 metric sample.ulonglong.bin_ctr {
149 indom -> NULL output MAX
150 type -> 32
151 units -> 1,0,0,BYTE,0,0
153 metric sampledso.double.bin_ctr {
154 indom -> NULL output AVG
155 type -> FLOAT
157 metric sample.float.bin_ctr {
158 indom -> NULL output SUM
159 type -> U64
161 metric sample.longlong.bin_ctr {
162 indom -> NULL output FIRST
163 type -> 64
164 units -> 1,-1,0,KBYTE,SEC,0
166 indom 29.2 { inst 200 -> DELETE }
167 indom 30.2 { inst 800 -> DELETE }
168 End-of-File
169 rm -f $tmp.new.*
170 cat $tmp.conf >>$seq.full
171 _run_valgrind pmlogrewrite -s -c $tmp.conf archives/mirage $tmp.new 2>$tmp.err | _filter
172 cat $tmp.err >>$seq.full
174 # success, all done
175 exit