blob: dd03160a6ab5a8d23320fa5e7c8712c37ab73fea (
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
|
#!/bin/sh
# PCP QA Test No. 247
#
# Derived metrics - exercise pmDesc processing during bind
#
# Copyright (c) 2009 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
if grep -q 'pmRegisterDerived' $PCP_DIR/usr/include/pcp/pmapi.h
then
:
else
echo "No derived metric support" >$seq.notrun
echo "$seq: [not run] `cat $seq.notrun`"
exit 0
fi
unset PCP_DERIVED_CONFIG
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
cat $tmp.out >>$seq.full
sed <$tmp.out \
-e "s;$tmp;TMP;"
}
# real QA test starts here
pminfo -d sample.pdu sample.recv_pdu sample.xmit_pdu sample.byte_ctr sample.kbyte_ctr sample.long.hundred sample.bin
echo
echo "No semantic errors here ..."
cat <<End-of-File >$tmp.config
myname.a = sample.kbyte_ctr
myname.b = sample.recv_pdu + sample.xmit_pdu
myname.c = 123
myname.d = 123 + sample.long.hundred
myname.e = sample.pdu / sample.long.hundred
myname.f = 1024 * sample.byte_ctr
myname.g = sample.bin + 100 - sample.bin - 100
myname.h = sample.seconds + sample.milliseconds / 1000
End-of-File
pminfo -Dderive -d -c $tmp.config myname >$tmp.out 2>&1
_filter
echo
echo "Semantic errors ..."
cat <<End-of-File >$tmp.config
# no-such-metric
myname.a = no.such.metric
# illegal metric
myname.b = sample.bad.unknown
# bad semantics - counters and *
myname.c = disk.dev.read * disk.dev.write
# bad semantics - counter and non-counter
myname.d = sample.byte_ctr + sample.long.hundred
# bad semantics - non-counter and counter
myname.e = sample.long.hundred - 100 / sample.byte_ctr
# bad semantics - non-counters ... not possible at the moment
# bad semantics - non-arithmetic metrics
myname.f = 3 + sample.lights
myname.g = sample.sysinfo - 42
# pmUnits checks and metric semantic checks
myname.h = disk.dev.total + sample.long.hundred
myname.i = sample.long.hundred - disk.dev.total
myname.j = sample.mirage * sample.step_counter
myname.k = sample.step_counter / sample.mirage_longlong
# indom checks
myname.l = sample.bin + sample.darkness
# from here on down, test cases driven by gcov analysis ...
myname.gcov.a = 42 + sample.bad.unknown
myname.gcov.b = (disk.all.total + disk.dev.total) + 42
myname.gcov.c = 42 - (disk.all.total + disk.dev.total)
myname.gcov.d = (sample.bin + sample.darkness)+42
End-of-File
#debug# pminfo -D derive,appl0,appl1 -d -c $tmp.config myname >$tmp.out 2>&1
pminfo -D derive -d -c $tmp.config myname >$tmp.out 2>&1
_filter
# success, all done
exit
|