3 # check pmlogrewrite config parser - global and indom clauses
5 # Copyright (c) 2011 Ken McDonell. All Rights Reserved.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
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
28 # real QA test starts here
29 cat <<End-of-File >$tmp.conf
31 hostname -> whizz-bang.engr.sgi.com
38 iname "15 minute" -> "forever"
43 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
45 for t
in +3 +3.5 +3.
+03 4 4.000005 4.
04 -5 -5.005
-5.
-05 \
46 +1:00.123456 +2:00 3:00.
04:00 -5:12.345 -6:30 \
47 +23:59:59 -0:0:1 +12:34:56.789012
50 echo "=== global time -> $t ==="
51 echo "global { time -> $t }" >$tmp.conf
53 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
56 for h
in abc node123.localdomain foo-bar
123 123.456 123.456foobar \
57 100foo
100.foo
10.0.foo
60 echo "=== global hostname -> $h ==="
61 echo "global { hostname -> $h }" >$tmp.conf
63 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
66 for t
in 60 123:45 123:0:61.678901
69 echo "=== global time -> $t (expect warning) ==="
70 echo "global { time -> $t }" >$tmp.conf
72 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
76 echo "=== global dup hostname clause (expect error) ==="
77 cat <<End-of-File >$tmp.conf
79 hostname -> whizz-bang.engr.sgi.com
86 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
89 echo "=== global dup tz clause (expect error) ==="
90 cat <<End-of-File >$tmp.conf
92 hostname -> whizz-bang.engr.sgi.com
99 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
102 echo "=== global dup time clause (expect error) ==="
103 cat <<End-of-File >$tmp.conf
105 hostname -> whizz-bang.engr.sgi.com
112 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
115 echo "=== indom dup indom clause (expect error) ==="
116 cat <<End-of-File >$tmp.conf
124 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
127 echo "=== indom dup name clause (expect error) ==="
128 cat <<End-of-File >$tmp.conf
131 iname "1 minute" -> "foo"
132 iname "1 minute" -> "bar"
136 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
139 echo "=== indom dup inst clause (expect error) ==="
140 cat <<End-of-File >$tmp.conf
147 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
149 # indom ... { indom ... } checks
151 # 4194304 is 2^22, 512 is 2^9 ... exceed serial and domain fields of a pmInDom
152 # 513.4194310 => 1.5 if field range checking not done!
153 for i
in 1.5 '' 1.6 1.2.3 foo
1.4194304 512.1 513.4194310 1.
*
156 echo "=== indom $i { } ==="
157 echo "indom $i { }" >$tmp.conf
159 pmlogrewrite
-w -C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
161 echo "=== indom 1.5 { indom -> $i } ==="
162 echo "indom 1.5 { indom -> $i }" >$tmp.conf
164 pmlogrewrite
-w -C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
167 # indom ... { iname | inst ... } exercises
169 for i
in 'iname "15" -> "15 mid range"' 'inst 1 -> 3' \
170 'inst 5 -> delete' 'iname "5" -> delete' \
171 'inst 1 -> 3 iname "1" -> "3 minute"' \
172 'iname "15" ->' 'iname "15" -' 'iname "15"'
175 echo "=== indom 1.5 { $i } ==="
176 echo "indom 1.5 { $i }" >$tmp.conf
178 pmlogrewrite
-w -C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
181 # indom ... { iname | inst ... } checks
183 for i
in 'iname "15" -> "16" iname "5" -> "6" iname "15" -> delete' \
184 'iname "5" -> "5 minute"' 'inst 1 -> 1' \
185 'iname "15" -> delete iname "5" -> "6" iname "15" -> "deleted"' \
186 'inst 5 -> 6 inst 1 -> 2 inst 5 -> delete' \
187 'inst 5 -> delete inst 1 -> 2 inst 5 -> 123'\
188 'iname "15" -> "16" inst 15 -> delete' \
189 'inst 15 -> delete iname "15" -> "16"' \
190 'inst 15 -> 16 iname "15" -> delete' \
191 'iname "15" -> delete inst 15 -> 16'
194 echo "=== indom 1.5 { $i } (expect error) ==="
195 echo "indom 1.5 { $i }" >$tmp.conf
197 pmlogrewrite
-w -C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
200 # instance iname upto space checks
201 for i
in "5 minutes" 1 5 15 "1 does not matter" "15 eek"
204 echo "=== indom 1.5 { iname \"$i\" -> \"yippee\" } ==="
205 echo "indom 1.5 { iname \"$i\" -> \"yippee\" }" >$tmp.conf
207 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
209 for i
in 19856 "19856 does not matter" 19857
212 echo "=== indom 2.1 { iname \"$i\" -> \"19856 bozo\" } ==="
213 echo "indom 2.1 { iname \"$i\" -> \"19856 bozo\" }" >$tmp.conf
215 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
219 echo "=== context sensitive lexical scanning ... expect pass ==="
220 cat <<End-of-File >$tmp.conf
226 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
227 cat <<End-of-File >$tmp.conf
233 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
234 cat <<End-of-File >$tmp.conf
240 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
241 cat <<End-of-File >$tmp.conf
247 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
248 cat <<End-of-File >$tmp.conf
254 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
255 cat <<End-of-File >$tmp.conf
263 echo "=== context sensitive lexical scanning ... expect fail ==="
264 cat <<End-of-File >$tmp.conf
270 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter
271 cat <<End-of-File >$tmp.conf
277 pmlogrewrite
-C -c $tmp.conf archives
/src-rattle
$tmp.new
2>&1 | _filter