Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 296
blobb2b39f5f93859b4f5bee4a50d0d1d7364f7c8dbd
1 #! /bin/sh
2 # PCP QA Test No. 296
3 # daemon pmdas not exiting after unconfiguring them?
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 status=0 # success is the default!
17 signal=$PCP_BINADM_DIR/pmsignal
18 LOCALHOST=`hostname`
19 _needclean=true
21 _interrupt()
23 status=1
26 _cleanup()
28 if $_needclean
29 then
30 echo
31 echo 'Restoring real pmcd.conf ...'
32 _restore_config $PCP_PMCDCONF_PATH
33 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
34 _wait_for_pmcd
35 _wait_for_pmlogger
36 _needclean=false
38 rm -f $tmp.*
39 exit $status
42 _save_config $PCP_PMCDCONF_PATH
44 trap "_cleanup" 0
45 trap "_interrupt; _cleanup" 1 2 3 15
47 # real QA test starts here
49 case $PCP_PLATFORM in
50 linux|solaris|freebsd)
51 cat <<End-of-File >$tmp.minconf
52 # temporary pmcd.conf for qa/$seq
54 # Name Id IPC IPC Params File/Cmd
55 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
56 End-of-File
59 darwin)
60 cat <<End-of-File >$tmp.minconf
61 # temporary pmcd.conf for qa/$seq
63 # Name Id IPC IPC Params File/Cmd
64 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
65 End-of-File
69 echo "Unknown PCP_PLATFORM $PCP_PLATFORM"
70 exit 1
72 esac
74 echo "start 11 daemon instances of the sample PMDA"
75 cp $tmp.minconf $tmp.out
76 cat <<End-of-File >>$tmp.out
77 sample 9 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 9
78 sample 19 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 19
79 sample 29 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 29
80 sample 39 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 39
81 sample 49 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 49
82 sample 59 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 59
83 sample 69 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 69
84 sample 79 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 79
85 sample 89 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 89
86 sample 99 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 99
87 sample 109 pipe binary $PCP_PMDAS_DIR/sample/pmdasample -d 109
88 End-of-File
89 $sudo cp $tmp.out $PCP_PMCDCONF_PATH
90 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
91 _wait_for_pmcd
93 ps $PCP_PS_ALL_FLAGS >$tmp.out
94 num=`grep pmdasample $tmp.out | wc -l | sed -e 's/ //g'`
95 if [ $num -ne 11 ]
96 then
97 echo "Error: number of sample PMDAs? expect 11 got $num"
98 echo "=== ps $PCP_PS_ALL_FLAGS ==="
99 cat $tmp.out
100 echo "=== pmcd.log ==="
101 cat $PCP_PMCDLOG_PATH
102 status=1
103 exit
104 else
105 echo "OK, 11 started"
108 echo
109 echo "unconfigure them all"
110 $sudo cp $tmp.minconf $PCP_PMCDCONF_PATH
111 $sudo $signal -a -s HUP pmcd
112 sleep 5
113 _wait_for_pmcd
115 ps $PCP_PS_ALL_FLAGS >$tmp.out
116 cp $tmp.out $seq.full
117 num=`grep pmdasample $tmp.out | wc -l | sed -e 's/ //g'`
118 if [ $num -ne 0 ]
119 then
120 echo "Error: number of sample PMDAs? expect 11 got $num"
121 echo "=== ps $PCP_PS_ALL_FLAGS ==="
122 cat $tmp.out
123 echo "=== pmcd.log ==="
124 cat $PCP_PMCDLOG_PATH
125 status=1
126 else
127 echo "OK, 0 remain"
130 # all done
131 exit