Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 243
blob59b64353ba18863b9dcdf6ca8aa18dec71004407
1 #! /bin/sh
2 # PCP QA Test No. 243
3 # Multiple PMCDs test
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 rm -f $seq.out
17 _get_libpcp_config
18 if $ipv6 ; then
19 ln $seq.out.ipv6 $seq.out || exit 1
20 else
21 ln $seq.out.nonipv6 $seq.out || exit 1
24 _filter_err()
26 _filter_pmcd_log \
27 | sed \
28 -e 's/ __pmBind: / bind: /g' \
29 -e 's/may already be running/is already running/g' \
30 -e '/Log for pmcd/,/INADDR_ANY/c\
31 ... boring stuff deleted' \
32 -e '/ok FD 44321 ipv6 INADDR_ANY/d' \
33 -e '/OpenRequestSocket.*unix.*bind: Address already in use/{
36 }' \
37 -e 's/ INADDR_ANY/ 0x0/g' \
38 #end
41 signal=$PCP_BINADM_DIR/pmsignal
42 _needclean=true
44 rm -rf $tmp
45 mkdir $tmp
46 chmod ugo+rwx $tmp
47 cd $tmp
49 cleanup()
51 cd $here
52 if $_needclean
53 then
54 _needclean=false
55 $signal -s TERM $my_pmcd_pid
56 pmsleep 1.5
57 unset PMCD_SOCKET
58 echo "Restart and ping pmcd ..."
59 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
60 _wait_for_pmcd
61 _wait_for_pmlogger
62 pmprobe pmcd.control.debug
64 rm -rf $tmp
67 status=1
68 trap "cleanup; exit \$status" 0 1 2 3 15
70 # real QA test starts here
71 $sudo $PCP_RC_DIR/pcp stop | _filter_pcp_stop
73 # Note: start pmcd with -f so that its PID stays the same (no daemon)
75 export PMCD_SOCKET=$tmp/pmcd.socket
76 $PCP_PMCD_PROG -f -x err1 &
77 my_pmcd_pid=$!
79 _wait_for_pmcd
81 echo "Checking for startup errors ..."
82 [ -f err1 ] && _filter_err <err1
84 # Try to start another pmcd. This should fail because the socket is already in
85 # use. Make sure that there are no changes to the log file
87 if [ -f pmcd.log ]
88 then
89 cp pmcd.log pmcd.log.$$
90 else
91 echo "No pmcd.log, pmcd failed to start!"
92 exit
95 echo
96 echo "Trying to start another PMCD over the top of the first one."
97 echo "Expect \"bind: Address already in use\"...:"
98 $PCP_PMCD_PROG -f -x err2 2>&1 | _filter_err &
99 pmsleep 2.5
101 echo "Checking for startup errors ..."
102 [ -f err2 ] && _filter_err <err2
104 echo "Checking that log hasn't changed ..."
105 diff pmcd.log pmcd.log.$$
107 status=$?