qa: revert some change to expected 244 outputs (from pmda-restart)
[pcp.git] / qa / 270
blob0098cb9cf40704e5f9790aaf1545604f43778aaa
1 #! /bin/sh
2 # PCP QA Test No. 270
3 # Test `pmlogextract':
4 # 1. one input file, one output file, no parameters - work
5 # 2. one input file, one output file, -S, -T and -z parameters - work
6 # (-S and -T are within the archive)
7 # 3. one input file, one output file, -S and -z parameters - work
8 # (-S is out of range)
9 # 4. one input file, one output file, -T and -z parameters - work
10 # (-T is out of range)
11 # 5. one input file, one output file, -t parameter - work
12 # 6. one input file, one output file, -c parameter - work
13 # 7. one input file, one output file, -c, -S, -T & -z parameter - work
14 # 8. one input file, one output file, -S, -T, -w & -z parameter - work
16 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
19 seq=`basename $0`
20 echo "QA output created by $seq"
22 # get standard filters
23 . ./common.product
24 . ./common.filter
26 status=1 # failure is the default!
27 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
29 _check_output()
31 [ $# != 1 ] && return
32 prog=$1
34 if [ -f $tmp.err ]
35 then
36 if [ -s $tmp.err ]
37 then
38 echo "Warning: $prog reported the following errors:"
39 cat $tmp.err | sed -e 's/tmp\/[0-9]*/tmp\/PID/'
40 echo
42 else
43 echo "Warning: cannot find error file \"$tmp.err\"."
48 # real QA test starts here
49 echo "Test pmlogextract"
52 # step 1
53 rm -rf $tmp.arch*
54 echo
55 echo " --- step 1: no flags ---"
56 echo "(output depends on archives/mirage{0,index,meta})"
57 pmlogextract archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
58 _check_output pmlogextract
59 pmdumplog -L -z $tmp.arch | sed -e '/^PID/s/: [0-9]*/: PID/'
62 # step 2
63 rm -rf $tmp.arch*
64 echo
65 echo " --- step 2: test -S, -T and -z flags ---"
66 echo "(output depends on archives/mirage{0,index,meta})"
67 pmlogextract -S "@10:50:00" -T "@11:00:00" -z archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
68 _check_output pmlogextract
69 pmdumplog -L -z $tmp.arch | sed -e '/^PID/s/: [0-9]*/: PID/'
72 # step 3
73 rm -rf $tmp.arch*
74 echo
75 echo " --- step 3: test -S out of range ---"
76 echo "(output depends on archives/mirage{0,index,meta})"
77 pmlogextract -S "@10:00:00" -z archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
78 _check_output pmlogextract
79 pmdumplog -L -z $tmp.arch | sed -e '/^PID/s/: [0-9]*/: PID/'
82 # step 4
83 rm -rf $tmp.arch*
84 echo
85 echo " --- step 4: test -T out of range ---"
86 echo "(output depends on archives/mirage{0,index,meta})"
87 pmlogextract -T "@12:00:00" -z archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
88 _check_output pmlogextract
89 pmdumplog -L -z $tmp.arch | sed -e '/^PID/s/: [0-9]*/: PID/'
92 # this was never implemented correctly .. skip it
93 ## step 5
94 #rm -rf $tmp.arch*
95 #echo
96 #echo " --- step 5: test -t flag ---"
97 #echo "(output depends on archives/mirage{0,index,meta})"
98 ## update interval for "sample.drift" in archives/mirage is 1 minute
99 #pmlogextract -n src/root_irix -t "2min" archives/mirage $tmp.arch >$tmp.out 2>$tmp.err1
100 #cat $tmp.err1 \
101 # | sed -e '/^Description unavailable/d' \
102 # | sed -e '/^Reason:/d' \
103 # | sed -e '/^Warning \[/d' > $tmp.err
104 #_check_output pmlogextract
105 #pmdumplog -m -z $tmp.arch sample.drift | sed -e '/^$/d'
107 # step 6
108 rm -rf $tmp.arch*
109 rm -rf $tmp.config
110 echo
111 echo " --- step 6: test config file ---"
112 echo "(output depends on archives/mirage{0,index,meta})"
113 # archives/mirage contains "sample.bin", "sample.drift", & "sample.mirage"
114 cat >$tmp.config <<'End-of-file'
116 # pmlogextract config file
118 sample.bin ["bin-300" "bin-700" "bin-100"] # out of order
119 sample.drift
120 sample.mirage ["m-00" "m-13" "m-17" "m-24"] # in order
121 End-of-file
123 pmlogextract -c $tmp.config archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
124 _check_output pmlogextract
125 # dump descriptors
126 echo
127 echo "--- dump descriptors ---"
128 pmdumplog -d -z $tmp.arch | sed -e '/^$/d'
130 # dump instance domain
131 echo
132 echo "--- dump instance domain ---"
133 pmdumplog -i -z $tmp.arch | sed -e '/^$/d'
135 # dump values for sample.bin
136 echo
137 echo "--- dump values for sample.bin ---"
138 pmdumplog -m -z $tmp.arch sample.bin | sed -e '/^$/d'
140 # dump values for sample.drift
141 echo
142 echo "--- dump values for sample.drift ---"
143 pmdumplog -m -z $tmp.arch sample.drift | sed -e '/^$/d'
145 # dump values for sample.mirage
146 echo
147 echo "--- dump values for sample.mirage ---"
148 pmdumplog -m -z $tmp.arch sample.mirage | sed -e '/^$/d'
151 # step 7
152 rm -rf $tmp.arch*
153 rm -rf $tmp.config
154 echo
155 echo " --- step 7: test config file, plus -S, -T and -z flags ---"
156 echo "(output depends on archives/mirage{0,index,meta})"
157 # archives/mirage contains "sample.drift"
158 cat >$tmp.config <<'End-of-file'
160 # pmlogextract config file
162 sample.drift
163 End-of-file
165 pmlogextract -c $tmp.config -S "@10:50:00" -T "@11:00:00" -z archives/mirage $tmp.arch >$tmp.out 2>$tmp.err
166 _check_output pmlogextract
168 # dump values for sample.drift
169 echo "--- dump values for sample.drift ---"
170 pmdumplog -m -z archives/mirage sample.drift \
171 | sed -e '/^$/d' \
172 | $PCP_AWK_PROG -F":" '{ if ($1 == 10 && $2 >= 50) print $0; }' > $tmp.m
173 pmdumplog -m -z $tmp.arch sample.drift \
174 | sed -e '/^$/d' \
175 | grep -v "timezone set to local" > $tmp.a
176 diff $tmp.m $tmp.a
177 x=$?
178 if [ $x = 0 ]
179 then
180 echo "sample.drift the same ... good"
181 else
182 echo "sample.drift different ... BAD"
186 # step 8
187 rm -rf $tmp.arch*
188 rm -rf $tmp.config
189 echo
190 echo " --- step 8: test -w flag (with -S, -T and -z) ---"
191 echo "(output depends on archives/rattle{0,index,meta})"
192 # archives/rattle contains "irix.kernel.all.load"
194 pmlogextract -S "@00:00:00" -T "@12:00:00" -w -z archives/rattle $tmp.arch >$tmp.out 2>$tmp.err
195 _check_output pmlogextract
197 # dump values for irix.kernel.all.load
198 echo "--- dump values for irix.kernel.all.load ---"
199 pmdumplog -m -z archives/rattle irix.kernel.all.load \
200 | sed -e '/^$/d' \
201 | $PCP_AWK_PROG -F":" '{ if ($1 >= 0 && $1 < 12) print $0; }' > $tmp.m
202 pmdumplog -m -z $tmp.arch irix.kernel.all.load \
203 | sed -e '/^$/d' \
204 | grep -v "timezone set to local" > $tmp.a
205 diff $tmp.m $tmp.a
206 x=$?
207 if [ $x = 0 ]
208 then
209 echo "irix.kernel.all.load the same ... good"
210 else
211 echo "irix.kernel.all.load different ... BAD"
215 # success, all done
216 status=0
217 exit