qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 486
blobf8abc7d8ed24c957ef5d66a202e1a4abb07fc691
1 #!/bin/sh
2 # PCP QA Test No. 486
3 # pmlogrewrite - simple rewriting cases
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"
18 status=0 # success is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22 _filter()
24 sed \
25 -e "s;$tmp;TMP;g" \
26 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
29 # 1.80.15 (disk.dev.bytes):
30 # inst [339 or "dks9d1"] value 179031
31 _f1_old()
33 $PCP_AWK_PROG '
34 $2 == "(disk.dev.bytes):" { xlate=1; print; next }
35 xlate == 1 && NF == 6 { $6 = int(($6 + 512)/1024) }
36 { print }
37 xlate == 1 && NF != 6 { xlate = 0 }'
39 _f1_new()
41 $PCP_AWK_PROG '
42 $2 == "(disk.dev.bytes):" { xlate=1; print; next }
43 xlate == 1 && NF == 6 { $6 = $6 }
44 { print }
45 xlate == 1 && NF != 6 { xlate = 0 }'
48 _cmp()
50 if [ ! -f "$1.0" ]
51 then
52 echo "Arrgh ... $1.0 missing" | _filter
53 return
55 if [ ! -f "$2.0" ]
56 then
57 echo "Arrgh ... $2.0 missing" | _filter
58 return
60 pmdumplog -z -a $1 | tee -a $seq.full >$tmp.in
61 pmdumplog -z -a $2 | tee -a $seq.full >$tmp.out
62 echo "pmdumplog diffs ..."
63 diff -u $tmp.in $tmp.out | _filter
64 [ -z "$filter_new" -a -z "$filter_old" ] && return
65 if [ ! -z "$filter_old" ]
66 then
67 $filter_old <$tmp.in >$tmp.tmp
68 echo >>$seq.full
69 echo "--- after $filter_old ---" >>$seq.full
70 cat $tmp.tmp >>$seq.full
71 mv $tmp.tmp $tmp.in
73 if [ ! -z "$filter_new" ]
74 then
75 $filter_new <$tmp.out >$tmp.tmp
76 echo >>$seq.full
77 echo "--- after $filter_new ---" >>$seq.full
78 cat $tmp.tmp >>$seq.full
79 mv $tmp.tmp $tmp.out
81 echo
82 echo "FILTERED pmdumplog diffs ..."
83 diff -u $tmp.in $tmp.out | _filter
86 # real QA test starts here
87 sed -e '/^#/d' <<End-of-File | while read arch_args spec
88 # archive[|arg1[|arg2[|...]]] spec
89 # rewrite pmDesc and pmid in pmResults
90 archives/mirage metric sample.bin { pmid->42.42.42 }
91 # name is 3 bytes shorter
92 archives/mirage metric sample.bin { name -> sam.bin }
93 # name is 10 bytes longer
94 archives/mirage metric sample.bin { name -> x23456789.sample.bin }
95 # inst renumbering
96 archives/mirage indom 29.2 { inst 300 -> 42 }
97 archives/mirage indom 29.2 { inst 300 -> 400 }
98 archives/mirage indom 29.2 { iname "bin-700" -> "bin-900" }
99 archives/mirage indom 29.2 { iname "bin-700" -> "bin-900 and some" }
100 archives/mirage indom 29.2 { iname "bin-300" -> "bin-100" inst 300 -> 100 }
101 archives/src-rattle indom 1.5 { iname "1 minute" -> "5" }
102 archives/src-rattle indom 1.5 { iname "5 minute" -> "15 doo dah" }
103 archives/src-rattle indom 1.5 { iname "5" -> "5 hours" }
104 # all metric semantics
105 archives/mirage metric 29.*.* { sem->DISCRETE } metric pmcd.pmlogger.port { sem->COUNTER }
106 # scale conversion
107 archives/src-snort-disks metric disk.dev.bytes { units->1,0,0,MBYTE,0,0 }
108 archives/src-snort-disks|-s metric disk.dev.bytes { units->1,0,0,MBYTE,0,0 }
109 archives/src-snort-disks metric disk.dev.bytes { units->1,-1,0,Kbyte,Sec,0 }
110 archives/src-snort-disks|-ws metric disk.dev.bytes { units->1,-1,0,kbyte,sec,0 }
111 archives/sample_expr metric sample.scale_step.time_up_secs { units->0,1,0,0,MSEC,0 }
112 # type conversion
113 # 32 ->
114 archives/mirage metric sample.drift { type -> U32 }
115 archives/mirage metric sample.drift { type -> 64 }
116 # double ->
117 archives/sample_expr metric sample.scale_step.time_up_secs { type -> FLOAT }
118 archives/sample_expr metric sample.scale_step.time_up_secs { type -> U32 }
119 # indom changes
120 archives/src-rattle metric pmcd.pmlogger.archive { indom -> 2.99 } indom 2.1 { indom -> 2.99 }
121 archives/src-rattle metric hinv.ndisk { indom -> 1.5 }
122 archives/src-rattle metric hinv.ndisk { indom -> 1.5 output inst 5 }
123 archives/ok-foo metric sample.colour { indom -> NULL }
124 archives/ok-foo metric sample.colour { indom -> NULL output first }
125 archives/ok-foo metric sample.colour { indom -> NULL output inst 1 }
126 archives/ok-foo metric sample.colour { indom -> NULL output last }
127 archives/ok-foo metric sample.colour { indom -> NULL output min }
128 archives/ok-foo metric sample.colour { indom -> NULL output max }
129 archives/ok-foo metric sample.colour { indom -> NULL output sum }
130 archives/ok-foo metric sample.colour { indom -> NULL output avg }
131 archives/sample_expr metric sample.mirage_longlong {indom->NULL}
132 archives/sample_expr metric sample.mirage_longlong {indom->NULL output last}
133 End-of-File
135 echo | tee -a $seq.full
136 echo "$spec" >$tmp.config
137 echo "=== `cat $tmp.config` ===" | tee -a $seq.full
138 rm -f $tmp.new.*
139 arch=`echo "$arch_args" | sed -e 's/|.*//'`
140 args=`echo "$arch_args" | sed -n -e '/|/s/.*|//p'`
141 pmlogrewrite -w -c $tmp.config $args $arch $tmp.new 2>&1 | _filter
142 filter_old=''
143 filter_new=''
144 case "$arch_args"
146 'archives/src-snort-disks|-s')
147 filter_old=_f1_old
148 filter_new=_f1_new
150 esac
151 _cmp $arch $tmp.new
152 done
154 # success, all done
155 exit