qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 503
blob0a89e34f9709f915e25bd51b395e8cf64fd00ad0
1 #!/bin/sh
2 # PCP QA Test No. 503
3 # Test pmlogrewrite use with pmlogger_daily
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 "$sudo rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 hostname=`hostname | sed -e 's/\..*//'`
24 _filter()
26 tee -a $seq.full \
27 | sed \
28 -e "s/for host $hostname/for host HOSTNAME/g" \
29 -e "s/for host localhost/for host HOSTNAME/g" \
30 -e "s/for host localhost\.localdomain/for host HOSTNAME/g" \
31 -e "s/for host local:/for host HOSTNAME/g" \
32 -e "s/for host \"localhost\"/for host \"HOSTNAME\"/g" \
33 -e "s/for host \"localhost\.localdomain\"/for host \"HOSTNAME\"/g" \
34 -e "s/for host \"local:\"/for host \"HOSTNAME\"/g" \
35 -e "s/for host \"$hostname\"/for host \"HOSTNAME\"/g" \
36 -e "s;$tmp;TMP;g" \
37 -e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/" \
38 -e '/^-rw-r--r--/s/-rw-r--r--.* 2011/-rw-r--r-- ... 2011/' \
39 -e `echo $PCP_LOG_DIR | sed -e 's/\//\\\\\//g'`'\/NOTICES/d'
42 _setup()
44 rm -f $tmp.arch/*
45 for x in 0 meta index
47 cp archives/rewrite.$x $tmp.arch/20111001.21.10.$x
48 cp archives/rewrite.$x $tmp.arch/20111001.22.10.$x
49 done
50 echo "global { time -> +1:00:00 }" >$tmp.conf.time
51 pmlogrewrite -c $tmp.conf.time -i $tmp.arch/20111001.22.10
54 _cmp()
56 ok=true
57 for ext in 0 index meta
59 if [ ! -f "$1.$ext" ]
60 then
61 echo "Arrgh ... $1.$ext missing" | _filter
62 ok=false
64 if [ ! -f "$2.$ext" ]
65 then
66 echo "Warning: $2.$ext missing" | _filter
67 ok=false
69 done
70 $ok || return
71 pmdumplog -z -a $1 \
72 | tee -a $seq.full \
73 | sed -e '/^\[[0-9][0-9]* bytes]/d' >$tmp.in
75 pmdumplog -z -a $2 \
76 | tee -a $seq.full \
77 | sed -e '/^\[[0-9][0-9]* bytes]/d' >$tmp.out
78 diff -u $tmp.in $tmp.out | _filter
81 # take explicit control of the umask
83 umask 022
85 mkdir $tmp.arch
87 # metrics in play from archives/rewrite archive
89 # sample.bin PMID: 29.0.6
90 # Data Type: 32-bit int InDom: 29.2 0x7400002
91 # Semantics: instant Units: none
92 # inst [100 or "bin-100"] value 100
93 # inst [200 or "bin-200"] value 200
94 # inst [300 or "bin-300"] value 300
95 # inst [400 or "bin-400"] value 400
96 # inst [500 or "bin-500"] value 500
97 # inst [600 or "bin-600"] value 600
98 # inst [700 or "bin-700"] value 700
99 # inst [800 or "bin-800"] value 800
100 # inst [900 or "bin-900"] value 900
102 # sampledso.double.hundred PMID: 30.0.27
103 # Data Type: double InDom: PM_INDOM_NULL 0xffffffff
104 # Semantics: instant Units: none
105 # value 100
107 # Log Label (Log Format Version 2)
108 # Performance metrics from host bozo-laptop
109 # commencing Sat Oct 1 21:10:11.751 2011
110 # ending Sat Oct 1 21:10:12.128 2011
111 # Archive timezone: EST-10
114 cat <<End-of-File >$tmp.control
115 \$version=1.1
116 LOCALHOSTNAME n n $tmp.arch -c $tmp.pmlogger
117 End-of-File
119 cat <<End-of-File >$tmp.pmlogger
120 log mandatory on once { sample.bin }
121 End-of-File
123 # real QA test starts here
124 echo "+++ should just work ... +++" | tee -a $seq.full
125 _setup
126 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
127 $sudo cat $tmp.log | _filter
128 mkdir $tmp.ok
129 mv $tmp.arch/20111001.* $tmp.ok
131 cat <<'End-of-File' | while read conf
132 global { hostname -> dreaming }
133 metric sampledso.double.hundred { type -> float }
134 End-of-File
136 echo "$conf" >$tmp.conf
137 echo | tee -a $seq.full
138 echo "!!! $conf !!!" | tee -a $seq.full
140 echo | tee -a $seq.full
141 echo "+++ expect mismatch +++" | tee -a $seq.full
142 _setup
143 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
144 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
145 $sudo cat $tmp.log | _filter
147 echo | tee -a $seq.full
148 echo "+++ expect fix via local config file +++" | tee -a $seq.full
149 _setup
150 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
151 cp $tmp.conf $tmp.arch/pmlogrewrite
152 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
153 $sudo cat $tmp.log | _filter
154 _cmp $tmp.ok/20111001 $tmp.arch/20111001
156 echo | tee -a $seq.full
157 echo "+++ expect fix via local symlink config file +++" | tee -a $seq.full
158 _setup
159 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
160 ln -s $tmp.conf $tmp.arch/pmlogrewrite
161 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
162 $sudo cat $tmp.log | _filter
163 _cmp $tmp.ok/20111001 $tmp.arch/20111001
165 echo | tee -a $seq.full
166 echo "+++ expect fix via global config dir +++" | tee -a $seq.full
167 _setup
168 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
169 $sudo mkdir -p $PCP_VAR_DIR/config/pmlogrewrite
170 $sudo cp $tmp.conf $PCP_VAR_DIR/config/pmlogrewrite/qa.$seq
171 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
172 $sudo cat $tmp.log | _filter
173 _cmp $tmp.ok/20111001 $tmp.arch/20111001
174 $sudo rm -f $PCP_VAR_DIR/config/pmlogrewrite/qa.$seq
176 echo | tee -a $seq.full
177 echo "+++ expect fix via symlink to global config dir +++" | tee -a $seq.full
178 _setup
179 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
180 $sudo mkdir -p $PCP_VAR_DIR/config/pmlogrewrite
181 $sudo cp $tmp.conf $PCP_VAR_DIR/config/pmlogrewrite/qa.$seq
182 ln -s $PCP_VAR_DIR/config/pmlogrewrite $tmp.arch/pmlogrewrite
183 $sudo $PCP_BINADM_DIR/pmlogger_daily -c $tmp.control -V -l $tmp.log
184 $sudo cat $tmp.log | _filter
185 _cmp $tmp.ok/20111001 $tmp.arch/20111001
186 $sudo rm -f $PCP_VAR_DIR/config/pmlogrewrite/qa.$seq
188 done
190 echo | tee -a $seq.full
191 echo "+++ expect fail when -r used and local config file present +++" | tee -a $seq.full
192 _setup
193 pmlogrewrite -c $tmp.conf -i $tmp.arch/20111001.22.10
194 cp $tmp.conf $tmp.arch/pmlogrewrite
195 $sudo $PCP_BINADM_DIR/pmlogger_daily -r -c $tmp.control -V -l $tmp.log
196 $sudo cat $tmp.log | _filter
198 # success, all done
199 exit