qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 499
blob95fd615d5b584362a19b778a764d391175c0860b
1 #!/bin/sh
2 # PCP QA Test No. 499
3 # pmlogrewrite - -q option
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 -rf $tmp.*; exit \$status" 0 1 2 3 15
22 _filter()
24 tee -a $seq.full \
25 | sed \
26 -e "s;$tmp;TMP;g" \
27 -e "s;/$$\.;/PID.;g" \
28 -e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
29 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
32 _cmp()
34 ok=true
35 for ext in 0 index meta
37 if [ ! -f "$1.$ext" ]
38 then
39 echo "Arrgh ... $1.$ext missing" | _filter
40 ok=false
42 if [ ! -f "$2.$ext" ]
43 then
44 echo "Warning: $2.$ext missing" | _filter
45 ok=false
47 done
48 $ok || return
49 pmdumplog -z -a $1 | tee -a $seq.full >$tmp.in
50 pmdumplog -z -a $2 | tee -a $seq.full >$tmp.out
51 diff -u $tmp.in $tmp.out | _filter
54 mkdir $tmp.conf.dir
55 i=0
57 # real QA test starts here
59 echo "=== metric not in archive ==="
60 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
61 metric kernel.all.load { pmid -> 1.2.3 }
62 End-of-File
63 i=`expr $i + 1`
64 rm -f $tmp.new.*
65 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
66 | _filter \
67 | LC_COLLATE=POSIX sort
68 _cmp archives/rewrite $tmp.new
70 echo
71 echo "=== + indom not in archive ==="
72 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
73 indom 1.2 { inst 0 -> 1 }
74 End-of-File
75 i=`expr $i + 1`
76 rm -f $tmp.new.*
77 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
78 | _filter \
79 | LC_COLLATE=POSIX sort
80 _cmp archives/rewrite $tmp.new
82 echo
83 echo "=== + empty global clause ==="
84 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
85 global { }
86 End-of-File
87 i=`expr $i + 1`
88 rm -f $tmp.new.*
89 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
90 | _filter \
91 | LC_COLLATE=POSIX sort
92 _cmp archives/rewrite $tmp.new
94 echo
95 echo "=== + no-change global hostname clause ==="
96 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
97 global { hostname -> bozo-laptop }
98 End-of-File
99 i=`expr $i + 1`
100 rm -f $tmp.new.*
101 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
102 | _filter \
103 | LC_COLLATE=POSIX sort
104 _cmp archives/rewrite $tmp.new
106 echo
107 echo "=== + no-change global time clause ==="
108 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
109 global { time -> 00:00:00.000000 }
110 End-of-File
111 i=`expr $i + 1`
112 rm -f $tmp.new.*
113 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
114 | _filter \
115 | LC_COLLATE=POSIX sort
116 _cmp archives/rewrite $tmp.new
118 echo
119 echo "=== + no-change global timezone clause ==="
120 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
121 global { tz -> "EST-10" }
122 End-of-File
123 i=`expr $i + 1`
124 rm -f $tmp.new.*
125 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
126 | _filter \
127 | LC_COLLATE=POSIX sort
128 _cmp archives/rewrite $tmp.new
130 echo
131 echo "=== + no-change indom clause ==="
132 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
133 indom 29.2 {
134 # no change ones
135 indom -> 29.2
136 iname "bin-300" -> "bin-300"
137 inst 800 -> 800
138 # no match ones
139 iname "bin-999" -> "bin-998"
140 inst 123 -> 456
142 End-of-File
143 i=`expr $i + 1`
144 rm -f $tmp.new.*
145 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
146 | _filter \
147 | LC_COLLATE=POSIX sort
148 _cmp archives/rewrite $tmp.new
150 echo
151 echo "=== + no-change metric clause ==="
152 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
153 metric sample.ulonglong.hundred {
154 indom -> NULL
155 name -> sample.ulonglong.hundred
156 pmid -> 29.0.100
157 sem -> instant
158 type -> u64
159 units -> 0,0,0,0,0,0
161 End-of-File
162 i=`expr $i + 1`
163 rm -f $tmp.new.*
164 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
165 | _filter \
166 | LC_COLLATE=POSIX sort
167 _cmp archives/rewrite $tmp.new
169 echo
170 echo "=== + change pmid clause ==="
171 cat <<'End-of-File' >$tmp.conf.dir/conf.$i
172 metric sample.longlong.bin_ctr { pmid -> 1.2.3 }
173 End-of-File
174 i=`expr $i + 1`
175 rm -f $tmp.new.*
176 pmlogrewrite -qsvw -c $tmp.conf.dir archives/rewrite $tmp.new 2>&1 \
177 | _filter \
178 | LC_COLLATE=POSIX sort
179 _cmp archives/rewrite $tmp.new
181 # success, all done
182 exit