qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 487
blobeb81c02f5a466e67cd79aea747d414458542c46f
1 #!/bin/sh
2 # PCP QA Test No. 487
3 # pmlogrewrite - error 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/" \
27 -e '/pmResult dump/s/from .* numpmid/... numpmid/'
30 _cmp()
32 pmdumplog -z -a $1 | tee -a $seq.full >$tmp.in
33 pmdumplog -z -a $2 | tee -a $seq.full >$tmp.out
34 echo "pmdumplog diffs ..."
35 diff -u $tmp.in $tmp.out | _filter
38 _cmp2()
40 if [ ! -f $1.0 ]
41 then
42 echo "Arrgh ... cannot find $1.0"
43 return
45 if [ ! -f $2.0 ]
46 then
47 echo "Arrgh ... cannot find $2.0"
48 return
50 pmval -z -U $1 $3 2>$tmp.err | tee -a $seq.full | sed -e 's/ */ /g' >$tmp.in
51 cat $tmp.err >>$seq.full
52 cat $tmp.err >>$tmp.in
53 pmval -z -U $2 $3 2>$tmp.err | tee -a $seq.full | sed -e 's/ */ /g' >$tmp.out
54 cat $tmp.err >>$seq.full
55 cat $tmp.err >>$tmp.out
56 echo "pmval diffs ..."
57 diff -u $tmp.in $tmp.out | _filter
60 # real QA test starts here
61 sed -e '/^#/d' <<End-of-File | while read arch_args spec
62 # archive[|arg1[|arg2[|...]]] spec
63 # double ->
64 archives/sample_expr metric sample.scale_step.time_up_secs { type -> string }
65 archives/sample_expr metric pmcd.pmlogger.host { type -> U32 }
66 archives/kenj-pc-2 metric sample.wrap.longlong { type -> U32 }
67 archives/kenj-pc-2 metric sample.wrap.ulonglong { type -> 64 }
68 End-of-File
70 echo | tee -a $seq.full
71 echo "$spec" >$tmp.config
72 echo "=== `cat $tmp.config` ===" | tee -a $seq.full
73 rm -f $tmp.new.*
74 pmlogrewrite -w -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
75 if [ -f $tmp.new.0 ]
76 then
77 _cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
79 done
81 echo
82 echo "=== overflow in type conversion - step 1 (no errors) ==="
83 echo "metric sample.drift { units->1,0,-1,MBYTE,0,0 type->U64 }" >$tmp.config
84 rm -f $tmp.tmp.*
85 pmlogrewrite -w -c $tmp.config archives/mirage $tmp.tmp 2>&1 | _filter
86 _cmp2 archives/mirage $tmp.tmp sample.drift
87 echo "=== overflow in type conversion - step 2 (expect error) ==="
88 echo "metric sample.drift { units->1,0,-1,BYTE,0,1 type->32 }" >$tmp.config
89 rm -f $tmp.new.*
90 pmlogrewrite -Dvalue -dsw -c $tmp.config $tmp.tmp $tmp.new 2>&1 | _filter
91 _cmp2 $tmp.tmp $tmp.new sample.drift
93 # success, all done
94 exit