python api: fix syntax error in recent context changes
[pcp.git] / qa / 347
blobed8780da24a2ee7b3ab1f357d375f88f8e4a5edd
1 #! /bin/sh
2 # PCP QA Test No. 347
3 # Exercise the Install/Remove for the news PMDA
5 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
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/news ] || _notrun "news PMDA directory is not installed"
18 perl -e "use PCP::PMDA" >/dev/null 2>&1
19 test $? -eq 0 || _notrun "PCP::PMDA perl module is not installed"
21 status=1
22 done_clean=false
24 _cleanup()
26 if $done_clean
27 then
29 else
30 if [ -f $tmp.pmcd.conf ]
31 then
32 $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH
33 rm -f $tmp.pmcd.conf
35 rm -f $tmp.*
36 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
37 _wait_for_pmcd
38 _wait_for_pmlogger
39 if $install_on_cleanup
40 then
41 ( cd $PCP_PMDAS_DIR/news; $sudo ./Install </dev/null >/dev/null 2>&1 )
42 else
43 ( cd $PCP_PMDAS_DIR/news; $sudo ./Remove </dev/null >/dev/null 2>&1 )
45 done_clean=true
47 exit $status
50 install_on_cleanup=false
51 pminfo news >/dev/null 2>&1 && install_on_cleanup=true
53 trap "_cleanup" 0 1 2 3 15
55 _filter()
57 _filter_pmda_install | \
58 sed -e 's/^Install news as a daemon or perl agent? \[daemon] //'
61 _filter_info()
63 sed \
64 -e 's/value -[0-9][0-9]*\.[0-9]*/value NEGATIVE NUMBER/' \
65 -e 's/value -[0-9][0-9]*/value NEGATIVE NUMBER/' \
66 -e 's/value [0-9][0-9]*\.[0-9]*/value NUMBER/' \
67 -e 's/value [0-9][0-9]*/value NUMBER/'
70 # real QA test starts here
71 home=$PCP_PMDAS_DIR
72 iam=news
73 if [ ! -d $home/$iam ]
74 then
75 echo "Where is $home/$iam?"
76 exit 1
78 cd $home/$iam
79 unset ROOT MAKEFLAGS
81 # copy the pmcd config file to restore state later.
82 cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
84 # start from a known starting point
85 $sudo ./Remove >/dev/null 2>&1
87 # now that pmcd is also known to be alive, give the news PMDA
88 # a bit more breathing space to respond
90 pmstore pmcd.control.timeout 20 >/dev/null 2>&1
91 PMCD_REQUEST_TIMEOUT=25
92 export PMCD_REQUEST_TIMEOUT
94 echo
95 echo "=== default $iam agent installation ==="
96 $sudo ./Remove >$tmp.out 2>&1
98 $sudo ./Install </dev/null >>$tmp.out 2>&1
99 _filter <$tmp.out
101 if pminfo -v $iam
102 then
104 else
105 echo "... failed! ... here is the Install log ..."
106 cat $tmp.out
109 echo
110 echo "=== validate values ==="
111 pminfo -f `pminfo $iam | LC_COLLATE=POSIX sort` >$tmp.out
112 _filter_info <$tmp.out
114 if fgrep -s "No PMCD agent" $tmp.out >/dev/null 2>&1
115 then
116 echo
117 echo "Looks bad ..."
118 echo
119 echo "pmcd.log ..."
120 cat $PCP_PMCDLOG_PATH
121 echo
122 echo "news.log ..."
123 if [ -d $PCP_LOG_DIR/pmcd ]
124 then
125 cat $PCP_LOG_DIR/pmcd/news.log
126 else
127 cat $PCP_LOG_DIR/news.log
131 echo
132 echo "=== remove $iam agent ==="
133 $sudo ./Remove >$tmp.out 2>&1
134 _filter <$tmp.out
136 # be a good citizen
138 pmstore pmcd.control.timeout 5 >/dev/null 2>&1
140 status=0
141 exit