qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 509
blob1409f75828172a89a1a8e6e53342218df9bb0e63
1 #!/bin/sh
2 # PCP QA Test No. 509
3 # Expose bug in pmcd/dbpmda handling of derived metrics and unknown
4 # metrics in same pmLookupName request.
6 # Copyright (c) 2012 Ken McDonell. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard filters
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=0 # success is the default!
18 username=`id -u -n`
19 $sudo rm -rf $tmp.* $seq.full
20 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22 cat <<End-of-File >$tmp.def
23 my.derived = sample.bin
24 End-of-File
26 _filter()
28 sed \
29 -e 's/0x[0-9a-f][0-9a-f]*/ADDR/g' \
30 -e "s; -U $username;;" \
31 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
32 -e '/PMNS Checksums/s/=[0-9a-f][0-9a-f]*/=CHECKSUM/g' \
33 -e '/Loaded Version 1 or 2/s/ent = [0-9][0-9]/ent = NN/' \
34 -e '/pmResult dump/s/ [0-9][0-9]*:00:00/ HH:00:00/' \
35 | $PCP_AWK_PROG '
36 BEGIN { state = 0; outf = "'$tmp.tmp'.0" }
37 state == "0" && $1 == "pmLoadNameSpace:" { state = 1; outf = "'$tmp.tmp'.1" }
38 state == "1" && $1 != "pmLoadNameSpace:" { state = 2; outf = "'$tmp.tmp'.2" }
39 { print >outf }'
41 [ -f $tmp.tmp.0 ] && cat $tmp.tmp.0
42 if [ -f $tmp.tmp.1 ]
43 then
44 grep ' 29' $tmp.tmp.1 \
45 | LC_COLLATE=POSIX sort
47 [ -f $tmp.tmp.2 ] && cat $tmp.tmp.2
50 # real QA test starts here
51 pminfo -D pmns -mf -c $tmp.def \
52 sample.secret.foo.one my.derived foo.bar sample.secret.foo.two \
53 >$tmp.out 2>$tmp.err
54 _filter <$tmp.out
55 _filter <$tmp.err
57 pipeargs="-d 29"
58 id pcp >/dev/null 2>&1 && pipeargs="$pipeargs -U $username"
60 export PCP_DERIVED_CONFIG=$tmp.def
61 cat <<End-of-File | dbpmda -D pmns -ie >$tmp.out 2>$tmp.err
62 open pipe $PCP_PMDAS_DIR/sample/pmdasample $pipeargs
63 fetch sample.secret.foo.one, my.derived, sample.secret.foo.two
64 End-of-File
65 _filter <$tmp.out
66 _filter <$tmp.err