File: 483

package info (click to toggle)
pcp 4.3.2%2Breally4.3.1-0.1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 175,188 kB
  • sloc: ansic: 261,305; sh: 123,606; xml: 107,279; cpp: 72,127; perl: 18,283; python: 15,453; yacc: 8,249; lex: 2,585; makefile: 1,957; fortran: 60; java: 52
file content (227 lines) | stat: -rwxr-xr-x 6,457 bytes parent folder | download | duplicates (5)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#!/bin/sh
# PCP QA Test No. 483
# check pmlogrewrite config parser - metric clauses
#
# 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"
}

# real QA test starts here
cat <<End-of-File >$tmp.conf
global {
    hostname -> whizz-bang.engr.sgi.com
    tz -> "GMT+10"
    time -> 10
}

indom 1.5 {
    indom -> 1.10
    iname "15 minute" -> "forever"
    inst 15 -> 9999
}

metric hinv.ndisk {
    pmid -> 1.2.3
}

metric 1.18.3 {
    pmid -> 4.5.6
}
End-of-File
rm -f $tmp.new.*
pmlogrewrite -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter

for m in 1.18.3 '1.18.*' '1.*.*' hinv.ndisk 42.42.42 foo.bar \
    'hinv.ndisk { type->64 } metric no.such.metric' \
    'no.such.metric { type->64 } metric no.such.other.metric { type->64 } metric 1.18.3'
do
    echo
    echo "=== metric $m { type->U32 } ==="
    echo "metric $m { type->U32 }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

for m in '60.*.*'
do
    echo
    echo "=== metric $m { type->U32 } ==="
    echo "metric $m { type->U32 }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/ac15 $tmp.new 2>&1 | _filter
done

# pmid exercises
for p in 42.42.42 1.18.2 2.3.2 foo '1.*.*' '2.*.*'
do
    echo
    echo "=== metric hinv.ncpu { pmid -> $p } ==="
    echo "metric hinv.ncpu { pmid -> $p }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# name exercises
for n in foo.bar.mumble.fratz "blah blah blah" 'hinv.*' hinv.ndisk hinv.ncpu
do
    echo
    echo "=== metric hinv.ndisk { name -> $n } ==="
    echo "metric hinv.ndisk { name -> $n }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# type exercises
for t in 32 U32 64 u64 Float double STRING 123 foo.bar \
    'U32 type -> float' 'U64 type -> DOUBLE'
do
    echo
    echo "=== metric hinv.ncpu { type -> $t } ==="
    echo "metric hinv.ncpu { type -> $t }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# indom exercises
for i in 2.1 1.3 '42.*' foo 1.5 '1.*' '5.6 indom -> 7.8' \
    NULL 'NULL output first' 'NULL output last' 'NULL output inst 5' \
    'NULL output min' 'NULL output max' 'NULL output avg' \
    '2.1 output inst 123' \
    '42.42 } indom 1.5 { indom -> 33.33 '
do
    echo
    echo "=== metric irix.kernel.all.load { indom -> $i } ==="
    echo "metric irix.kernel.all.load { indom -> $i }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done
echo
echo "=== metric pmcd.pmlogger.port { indom -> 60.* } ==="
echo "metric pmcd.pmlogger.port { indom -> 60.* }" >$tmp.conf
rm -f $tmp.new.*
pmlogrewrite -w -C -c $tmp.conf archives/20041125 $tmp.new 2>&1 | _filter
echo
echo "=== metric hinv.ndisk { indom -> 1.5 } ==="
echo "metric hinv.ndisk { indom -> 1.5 }" >$tmp.conf
rm -f $tmp.new.*
pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
echo
echo "=== metric hinv.ndisk { indom -> 1.5 output inst 15 } ==="
echo "metric hinv.ndisk { indom -> 1.5 output inst 15 }" >$tmp.conf
rm -f $tmp.new.*
pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter

# sem exercises
for s in Discrete COUNTER INSTANT instanty NULL 'COUNTER sem -> INSTANT'
do
    echo
    echo "=== metric 2.3.2 { sem -> $s } ==="
    echo "metric 2.3.2 { sem -> $s }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# units exercises
for u in '1,0,0,BYTE,0,0' '0,1,0,0,SEC,0' '0,0,1,0,0,ONE' \
	'1,-1,0,EBYTE,HOUR,0' '1,-1,0,PBYTE,MIN,0' '1,-1,0,TBYTE,SEC,0' \
	'1,-1,0,GBYTE,MSEC,0' '1,-1,0,MBYTE,USEC,0' '1,-1,0,KBYTE,NSEC,0' \
	'1,0,-1,KBYTE,0,ONE' '0,-1,1,0,MSEC,2' \
	'1,0,0,BYTE,0,0 units -> 0,1,0,0,SEC,0' \
	'0,0,0,0,0,0'
do
    echo
    echo "=== metric hinv.ncpu { units -> $u } ==="
    echo "metric hinv.ncpu { units -> $u }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done
for u in '1,0,0,BYTE,0,0' '1,0,0,BYTE,0,0 RESCALE'  \
	'1,-1,0,KBYTE,SEC,0' '1,-1,0,KBYTE,SEC,0 rescale'
do
    echo
    echo "=== metric sampledso.long.bin_ctr { units -> $u } ==="
    echo "metric sampledso.long.bin_ctr { units -> $u }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -wC -c $tmp.conf archives/rewrite $tmp.new 2>&1 | _filter
    rm -f $tmp.new.*
    pmlogrewrite -swC -c $tmp.conf archives/rewrite $tmp.new 2>&1 | _filter
done

# delete exercises
for m in hinv.ncpu 2.3.2 '2.3.*' '1.*.*'
do
    echo
    echo "=== metric $m { delete } ==="
    echo "metric $m { delete }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# conflicting metric specs
for o in 'delete pmid->1.2.3' 'pmid->1.2.3 delete' \
	'delete name -> foo.bar' 'name -> foo.bar delete' \
	'delete type -> U64' 'type -> U64 delete' \
	'delete indom -> NULL' 'indom -> NULL delete' \
	'delete sem -> INSTANT' 'sem -> INSTANT delete' \
	'delete sem -> COUNTER' 'sem -> COUNTER delete'
do
    echo
    echo "=== metric 1.18.3 { $o } ==="
    echo "metric 1.18.3 { $o }" >$tmp.conf
    rm -f $tmp.new.*
    pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
done

# multi-clause examples
cat <<End-of-File >$tmp.conf
indom 1.* {
    indom -> 42.*
}
metric 1.*.* {
    pmid -> 42.*.*
}
metric 1.18.3 {
    name -> foo.bar
    type -> 64
    indom -> 42.5
    sem -> DISCRETE
    units -> 0,0,0,0,0,0
}
End-of-File
rm -f $tmp.new.*
pmlogrewrite -w -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter

# metric walk and star exercises
for m in 1.*.*  1.18.* 2.3.2
do
    for x in 7.*.* 8.9.* 10.11.12
    do
	echo
	echo "=== metric $m { pmid -> $x } ==="
	echo "metric $m { pmid -> $x }" >$tmp.conf
	rm -f $tmp.new.*
	pmlogrewrite -C -c $tmp.conf archives/src-rattle $tmp.new 2>&1 | _filter
    done
done

# success, all done
exit