pmrep: fix archive end time reporting
[pcp.git] / qa / 798
blobc8ab58dad3f8078f5d5914615a538965d7aa44c8
1 #! /bin/sh
2 # PCP QA Test No. 798
3 # Exercise dbpmda use with the Perl implementation of nfsclient
5 # Copyright (c) 2013 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard filters
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 [ -d $PCP_PMDAS_DIR/nfsclient ] || _notrun "nfsclient PMDA directory is not installed"
18 status=1
19 perl -e "use PCP::PMDA" >/dev/null 2>&1
20 [ $? -eq 0 ] || _notrun "perl PCP::PMDA module not installed"
22 _cleanup()
24 $sudo rm -f $here/nfsclient.log
25 rm -f $tmp.*
28 trap "_cleanup; exit \$status" 0 1 2 3 15
30 _filter()
32 sed \
33 -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
34 -e "s;$script;pmdanfsclient.pl;" \
35 | _filter_dumpresult
38 _filter_pmda_log()
40 sed \
41 -e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
42 -e 's/^\(Log finished\) .*/\1 .../' \
43 -e '/^$/d' \
44 #end
47 _filter_indom()
49 # for indom 62.0 the order of the instances (and hence internal
50 # instance number depends on the version of perl and the phase
51 # of the moon ...
52 # pmInDom: 62.0
53 # [ 0] inst: 0 name: "/mnt/nfsv4"
54 # [ 1] inst: 1 name: "/mnt/nfs41"
55 # [ 2] inst: 2 name: "/ifs"
56 # [ 3] inst: 3 name: "/ifsfoo"
57 # dbpmda>
59 rm -f $tmp.1 $tmp.2 $tmp.3
60 $PCP_AWK_PROG '
61 BEGIN { part = 1 }
62 part == 2 && $1 == "dbpmda>" { part = 3 }
63 { outname = "'$tmp'." part; print >outname }
64 part == 1 && $1 == "pmInDom:" && $2 == "62.0" { part = 2 }'
66 [ -f $tmp.1 ] && cat $tmp.1
67 [ -f $tmp.2 ] && LC_COLLATE=posix sort --key 6 $tmp.2 \
68 | $PCP_AWK_PROG '
69 NR == 1 { printf "[ X] inst: X name: %s\n",$6 }
70 NR > 1 { printf "[X+%d] inst: X+%d name: %s\n", NR-1, NR-1, $6 }'
71 [ -f $tmp.3 ] && cat $tmp.3
74 # real QA test starts here
75 domain=62
76 script=pmdanfsclient.pl
77 cd "$PCP_PMDAS_DIR/nfsclient"
79 # create a root namespace file for dbpmda to use
80 PCP_PERL_PMNS=root /usr/bin/env perl $script > $tmp.root
82 # create a set of commands for dbpmda
83 cat >$tmp.cmds <<End-of-File
84 open pipe /usr/bin/env perl $script
85 getdesc on
86 desc nfsclient.export
87 desc nfsclient.mountpoint
88 desc nfsclient.options.string
89 desc nfsclient.options.proto
90 desc nfsclient.options.vers
91 fetch nfsclient.export
92 fetch nfsclient.mountpoint
93 fetch nfsclient.options.string
94 fetch nfsclient.options.proto
95 fetch nfsclient.options.vers
96 fetch nfsclient.options.vers
97 instance $domain.0
98 End-of-File
100 # iterate over our pre-canned mountstats files
101 test="$here/nfsclient"
102 for file in $test/*.qa
104 export NFSCLIENT_MOUNTSTATS_PATH="$file"
105 echo === Test case: `basename $file`
106 $sudo rm -f nfsclient.log
107 $sudo TERM=ansi sh -c ". /etc/pcp.env; dbpmda -n $tmp.root -ie" < $tmp.cmds 2>&1 | _filter | _filter_indom
108 _filter_pmda_log < nfsclient.log
109 done
111 status=0