File: 247

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 (101 lines) | stat: -rwxr-xr-x 2,976 bytes parent folder | download
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
#!/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_INC_DIR/pmapi.h
then
    :
else
    echo "No derived metric support" >$seq.notrun
    echo "$seq: [not run] `cat $seq.notrun`"
    exit 0
fi

# For this test, don't load any global derived metric configs by default. 
# So the PCP_DERIVED_CONFIG environment variable is set to an empty string.
export 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
# i&j - resolved mismatch on indom / no-indom
myname.i = sample.bin + sample.double.hundred
myname.j = sample.double.hundred + sample.bin
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
myname.k2 = sample.mirage_longlong * sample.step_counter
# 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