summaryrefslogtreecommitdiff
path: root/qa/253
blob: 2ee251c660662c04ab8842ae28e10262735c09b3 (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
#!/bin/sh
# PCP QA Test No. 253
#
# Derived Metrics and archives
#
# 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()
{
    sed \
	-e '/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]/s/[^ ]*.*numpmid/TIMESTAMP ... numpmid/' \
    | $PCP_AWK_PROG '
/milliseconds/		{ want = 1 }
want == 1 && $1 == "value"	{ $2 = "<number>" }
NF == 0			{ want = 0 }
			{ print }'
}

# real QA test starts here

echo "No errors here ..."
cat <<End-of-File >$tmp.config
myname.const = 123456
myname.a = sample.bin / 50
myname.b = 3*sample.bin
myname.c = sample.bin + sample.bucket*2 - (sample.bin + 100) - sample.bucket
End-of-File
echo
cat $tmp.config

for args in myname.const myname.a myname "myname.a sample.milliseconds" \
	"sample.milliseconds myname.b" "sample.milliseconds myname.a myname.b sample.milliseconds myname.c"
do
    echo
    echo "=== $args ==="
    pminfo -c $tmp.config -a src/bigbin $args 2>&1 | _filter
    echo "=== -d $args ==="
    pminfo -c $tmp.config -a src/bigbin -d $args 2>&1 | _filter
    echo "=== -f $args ==="
    pminfo -c $tmp.config -a src/bigbin -f $args 2>&1 | _filter
done

# success, all done
exit