Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 572
blob6fda9c32472f6e37bfa37813823cdb5b4891d60c
1 #! /bin/sh
2 # PCP QA Test No. 572
3 # pmcd agent table relocation and libpcp_pmda botch for PMDA_INTERFACE_3.
4 # linux PMDA returns no values after weblog Install was the original
5 # observation.
7 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 # get standard environment, filters and checks
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 [ -d $PCP_PMDAS_DIR/sample ] || _notrun "sample PMDA directory is not installed"
19 [ -d $PCP_PMDAS_DIR/simple ] || _notrun "simple PMDA directory is not installed"
20 [ -d $PCP_PMDAS_DIR/trivial ] || _notrun "trivial PMDA directory is not installed"
22 pmcdconf=$PCP_PMCDCONF_PATH
23 rootconf=$PCP_VAR_DIR/pmns/root
24 needclean=false
26 unset ROOT TOOLROOT MAKEFLAGS
28 _cleanup()
30 if $needclean
31 then
32 [ -f $tmp.pmcd.bak ] && $sudo cp $tmp.pmcd.bak $pmcdconf
33 [ -f $tmp.root.bak ] && $sudo cp $tmp.root.bak $rootconf
34 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
35 $sudo rm -f $tmp.*
36 needclean=false
40 _filter_make()
42 sed \
43 -e '/In function .vpmprintf./d' \
44 -e '/warning: the use of .tempnam./d' \
45 -e '/make: Nothing to be done/d'
48 status=1 # failure is the default!
49 trap "_cleanup; exit \$status" 0 1 2 3 15
51 # create a basic pmcd config file
52 if [ $PCP_PLATFORM = linux -o $PCP_PLATFORM = solaris -o $PCP_PLATFORM = freebsd ]
53 then
54 cat >$tmp.pmcd.conf << EOF
55 # from QA $seq
56 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
57 EOF
58 elif [ $PCP_PLATFORM = darwin ]
59 then
60 cat >$tmp.pmcd.conf << EOF
61 # from QA $seq
62 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
63 EOF
64 else
65 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
66 exit 1
69 # create my pmns
70 cat <<End-of-File >$tmp.pmns
71 root {
72 pmcd
73 sample
74 trivial
75 simple
77 pmcd {
78 numagents 2:0:2
80 sample {
81 string
83 sample.string {
84 write_me 29:0:32
86 trivial {
87 time 250:0:0
89 simple {
90 numfetch 253:0:0
92 End-of-File
94 # real QA test starts here
95 cp $pmcdconf $tmp.pmcd.bak
96 cp $rootconf $tmp.root.bak
98 needclean=true
99 $sudo cp $tmp.pmcd.conf $pmcdconf
100 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
102 for pmda in '' sample trivial simple
104 echo
105 if [ ! -z "$pmda" ]
106 then
107 echo "=== $pmda PMDA ==="
108 cd $PCP_PMDAS_DIR/$pmda
109 $sudo ./Install </dev/null >/dev/null 2> $tmp.stderr
110 # strip blank lines from stderr
111 # strip cc warning messages (assumed to be 4 non-blanks long)
112 cat $tmp.stderr | _filter_make | \
113 $PCP_AWK_PROG '
114 /^ *$/ {
115 next
117 /^cc-.*cc: WARNING/ {
118 getline ; getline ; getline ; getline
119 next
122 print
126 pmstore -n $tmp.pmns sample.string.write_me "$pmda"
127 pminfo -n $tmp.pmns -f \
128 pmcd.numagents \
129 sample.string.write_me \
130 trivial.time \
131 simple.numfetch \
132 | $PCP_AWK_PROG '
133 mask == 1 { if ($1 == "value") $2 = "NUMBER"
134 mask = 0
136 { print }
137 /pmcd.numagents/ && "'"$pmda"'" == "" { mask = 1 }
138 /trivial.time$/ { mask = 1 }'
140 done
142 status=0
143 exit