summaryrefslogtreecommitdiff
path: root/qa/509
blob: 1409f75828172a89a1a8e6e53342218df9bb0e63 (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
#!/bin/sh
# PCP QA Test No. 509
# Expose bug in pmcd/dbpmda handling of derived metrics and unknown
# metrics in same pmLookupName request.
#
# Copyright (c) 2012 Ken McDonell.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

status=0	# success is the default!
username=`id -u -n`
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15

cat <<End-of-File >$tmp.def
my.derived = sample.bin
End-of-File

_filter()
{
    sed \
	-e 's/0x[0-9a-f][0-9a-f]*/ADDR/g' \
	-e "s; -U $username;;" \
	-e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
	-e '/PMNS Checksums/s/=[0-9a-f][0-9a-f]*/=CHECKSUM/g' \
	-e '/Loaded Version 1 or 2/s/ent = [0-9][0-9]/ent = NN/' \
	-e '/pmResult dump/s/ [0-9][0-9]*:00:00/ HH:00:00/' \
    | $PCP_AWK_PROG '
BEGIN					{ state = 0; outf = "'$tmp.tmp'.0" }
state == "0" && $1 == "pmLoadNameSpace:"	{ state = 1; outf = "'$tmp.tmp'.1" }
state == "1" && $1 != "pmLoadNameSpace:"	{ state = 2; outf = "'$tmp.tmp'.2" }
					{ print >outf }'

    [ -f $tmp.tmp.0 ] && cat $tmp.tmp.0
    if [ -f $tmp.tmp.1 ]
    then
	grep ' 29' $tmp.tmp.1 \
	| LC_COLLATE=POSIX sort
    fi
    [ -f $tmp.tmp.2 ] && cat $tmp.tmp.2
}

# real QA test starts here
pminfo -D pmns -mf -c $tmp.def \
    sample.secret.foo.one my.derived foo.bar sample.secret.foo.two \
	>$tmp.out 2>$tmp.err
_filter <$tmp.out
_filter <$tmp.err

pipeargs="-d 29"
id pcp >/dev/null 2>&1 && pipeargs="$pipeargs -U $username"

export PCP_DERIVED_CONFIG=$tmp.def
cat <<End-of-File | dbpmda -D pmns -ie >$tmp.out 2>$tmp.err
open pipe $PCP_PMDAS_DIR/sample/pmdasample $pipeargs
fetch sample.secret.foo.one, my.derived, sample.secret.foo.two
End-of-File
_filter <$tmp.out
_filter <$tmp.err