blob: edb95df9d3a239fdf6cdf5ff155c03c072351f03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
#!/bin/sh
# PCP QA Test No. 495
# pmlogrewrite metric rule, indom clause - exercise all options
#
# Copyright (c) 2011 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s;$tmp;TMP;g" \
-e '/[-+ ]\[[0-9][0-9]* bytes]/d' \
-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}
_cmp()
{
if [ ! -f "$1.0" ]
then
echo "Arrgh ... $1.0 missing" | _filter
return
fi
if [ ! -f "$2.0" ]
then
echo "Arrgh ... $2.0 missing" | _filter
return
fi
pmdumplog -z -a $1 | tee -a $seq.full >$tmp.in
pmdumplog -z -a $2 | tee -a $seq.full >$tmp.out
diff -u $tmp.in $tmp.out | _filter
}
# real QA test starts here
echo "non-null -> non-null cases"
rm -f $tmp.old.*
pmlogextract -s 3 src/mirage-1 $tmp.old
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] metric spec ...
$tmp.old metric sample.mirage { indom -> 29.8 }
$tmp.old metric sample.mirage { indom -> 29.8 output inst 4 }
$tmp.old metric sample.mirage { indom -> 29.8 output iname "m-04" }
$tmp.old metric sample.mirage { indom -> 29.8 output first }
$tmp.old metric sample.mirage { indom -> 29.8 output last }
$tmp.old metric sample.mirage { indom -> 29.8 output min }
$tmp.old metric sample.mirage { indom -> 29.8 output max }
$tmp.old metric sample.mirage { indom -> 29.8 output sum }
$tmp.old metric sample.mirage { indom -> 29.8 output avg }
# warning cases
$tmp.old metric sample.mirage { indom -> 29.8 output inst 12345 }
$tmp.old metric sample.mirage { indom -> 29.8 output iname "m-12345" }
$tmp.old metric sample.mirage { indom -> 29.8 output inst 11 }
$tmp.old metric sample.mirage { indom -> 29.8 output inst 2 }
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
_cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done
echo
echo "non-null -> null cases"
rm -f $tmp.old.*
pmlogextract -s 3 src/ok-foo $tmp.old
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] metric spec ...
$tmp.old metric sample.colour { indom -> NULL }
$tmp.old metric sample.colour { indom -> NULL output inst 1 }
$tmp.old metric sample.colour { indom -> NULL output iname "green with extra text for no value" }
$tmp.old metric sample.colour { indom -> NULL output first }
$tmp.old metric sample.colour { indom -> NULL output last }
$tmp.old metric sample.colour { indom -> NULL output min }
$tmp.old metric sample.colour { indom -> NULL output max }
$tmp.old metric sample.colour { indom -> NULL output sum }
$tmp.old metric sample.colour { indom -> NULL output avg }
# warning cases
$tmp.old metric sample.colour { indom -> NULL output inst 12345 }
$tmp.old metric sample.colour { indom -> NULL output iname "purple" }
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
_cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done
echo
echo "null -> non-null cases"
rm -f $tmp.old.*
pmlogextract -s 3 src/ok-foo $tmp.old
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] metric spec ...
$tmp.old metric sample.seconds { indom -> 29.2 }
$tmp.old metric sample.seconds { indom -> 29.2 output inst 100 }
$tmp.old metric sample.seconds { indom -> 29.2 output iname "bin-300" }
$tmp.old metric sample.seconds { indom -> 29.2 output first }
$tmp.old metric sample.seconds { indom -> 29.2 output last }
$tmp.old metric sample.seconds { indom -> 29.2 output min }
$tmp.old metric sample.seconds { indom -> 29.2 output max }
$tmp.old metric sample.seconds { indom -> 29.2 output sum }
$tmp.old metric sample.seconds { indom -> 29.2 output avg }
# warning cases
$tmp.old metric sample.seconds { indom -> 29.2 output inst 12345 }
$tmp.old metric sample.seconds { indom -> 29.2 output iname "purple" }
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
_cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done
echo
echo "spaces in inames cases"
rm -f $tmp.old.*
pmlogextract -s 3 src/moomba.pmkstat $tmp.old
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] metric spec ...
# non-null -> null (so input side selection)
$tmp.old metric irix.kernel.all.load { indom -> NULL }
$tmp.old metric irix.kernel.all.load { indom -> NULL output inst 5 }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "1" }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "1 minute" }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "1 xxx" }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "15" }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "15 " }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "15 min but no one looks at this" }
$tmp.old metric irix.kernel.all.load { indom -> NULL output iname "159" }
# null -> non-null (so output side selection)
$tmp.old metric irix.disk.all.read { indom -> 1.5 }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output inst 5 }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "1" }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "1 minute" }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "1 xxx" }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "15" }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "15 " }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "15 min but no one looks at this" }
$tmp.old metric irix.disk.all.read { indom -> 1.5 output iname "159" }
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
pmlogrewrite -ws -c $tmp.config `echo $arch_args | sed -e 's/|/ /g'` $tmp.new 2>&1 | _filter
_cmp `echo $arch_args | sed -e 's/|.*//'` $tmp.new
done
# success, all done
exit
|