Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 389
blob774fefb558e5083379af0a8400bfbf8d39b0e187
1 #! /bin/sh
2 # PCP QA Test No. 389
3 # Exercise pmlogger behaviour when it loses pmcd connection
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 signal=$PCP_BINADM_DIR/pmsignal
17 host=`hostname`
18 status=1 # failure is the default!
20 _filter()
22 sed -e '/myFetch: End of File: PMCD exited/d' \
23 -e '/pmlogger: Error: IPC protocol failure/d'
26 trap "$sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15
27 $sudo rm -f $tmp.* $seq.full
29 # real QA test starts here
30 echo "=== empty config and _no_ -L, should exit immediately ===" | tee -a $here/$seq.full
31 $sudo rm -f $tmp.*
32 pmlogger -c /dev/null -l $tmp.log $tmp &
33 sleep 2
34 echo "expect no pmlogger process ..."
35 ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == "'$!'" { print }'
36 _filter_pmlogger_log <$tmp.log | sed -e "s/$host/HOST/"
38 echo | tee -a $here/$seq.full
39 echo "=== empty config and -L, no reconnect and no exit ===" | tee -a $here/$seq.full
40 $sudo rm -f $tmp.*
41 _start_up_pmlogger -L -c /dev/null -l $tmp.log $tmp
42 _wait_for_pmlogger $pid $tmp.log 5
43 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
44 _wait_for_pmcd
45 echo "expect pmlogger process ..."
46 ps $PCP_PS_ALL_FLAGS | $PCP_AWK_PROG '$2 == "'$pid'" { print "OK"}'
47 _filter_pmlogger_log <$tmp.log | sed -e "s/$host/HOST/"
48 $sudo $signal -s TERM $pid
50 echo | tee -a $here/$seq.full
51 echo "=== non-empty config, reconnect when pmcd restarted ===" | tee -a $here/$seq.full
52 $sudo rm -f $tmp.*
53 echo "log mandatory on 1 sec pmcd.version" >$tmp.config
54 _start_up_pmlogger -c $tmp.config -l $tmp.log $tmp
55 _wait_for_pmlogger $pid $tmp.log 5
56 echo "pid=$pid" >>$here/$seq.full
57 ps $PCP_PS_ALL_FLAGS | grep pmlogger >>$here/$seq.full
58 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
59 _wait_for_pmcd
60 echo "expect pmlogger process ..." | tee -a $here/$seq.full
61 ps $PCP_PS_ALL_FLAGS \
62 | grep pmlogger \
63 | tee -a $here/$seq.full \
64 | $PCP_AWK_PROG '$2 == "'$pid'" { print "OK"}'
65 _filter_pmlogger_log <$tmp.log | _filter | sed -e "s/$host/HOST/"
66 $sudo $signal -s TERM $pid
67 sleep 1
68 echo "pmlogger log file ..." >>$here/$seq.full
69 cat $tmp.log >>$here/$seq.full
70 echo "expect one mark record ..."
71 pmdumplog -M $tmp | grep '<mark>' | wc -l
73 # success, all done
74 status=0
75 exit