qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 279
blobe121ccc291ec9df201e9e85278f18489397bf34c
1 #! /bin/sh
2 # PCP QA Test No. 279
3 # Check recovery actions when procedures in pmdaproc.sh fail to
4 # restart/start PMCD
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard filters
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 status=1 # failure is the default!
18 killer=`pwd`/src/killparent
19 LOCALHOST=`hostname`
20 _needclean=true
22 rm -f $seq.full
24 _interrupt()
26 status=1
29 _cleanup()
31 if $_needclean
32 then
33 echo
34 echo "Restoring real \$PCP_PMCDCONF_PATH ..."
35 _restore_config $PCP_PMCDCONF_PATH
36 $sudo rm -f $PCP_PMCDCONF_PATH.prev
37 _restore_loggers
38 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
39 _wait_for_pmcd
40 _wait_for_pmlogger
41 _needclean=false
43 $sudo rm -f $tmp.*
44 exit $status
47 _filter()
49 $PCP_AWK_PROG '
50 BEGIN { skip = 0 }
51 /Save current/ { print ""; skip = 0 }
52 /Sorry, failed/ { print ""; skip = 0 }
53 skip == 0 { print }
54 /Here is the PMCD logfile/ { print "[logfile deleted]"; skip = 1; next }' \
55 | sed \
56 -e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;g" \
57 | _filter_pcp_start \
58 | _filter_pmcd_log
61 if [ -d $PCP_LOG_DIR/pmlogger ]
62 then
63 LOGGING_DIR=$PCP_LOG_DIR/pmlogger
64 else
65 LOGGING_DIR=$PCP_LOG_DIR
68 _save_config $PCP_PMCDCONF_PATH
69 _disable_loggers
70 pmafm $LOGGING_DIR/$LOCALHOST/Latest remove >$tmp.cmd 2>&1 \
71 && $sudo sh $tmp.cmd
73 trap "_cleanup" 0
74 trap "_interrupt; _cleanup" 1 2 3 15
76 # real QA test starts here
78 # get to a known starting state, esp for pmcd.log
80 if [ $PCP_PLATFORM = irix ]
81 then
82 cat <<End-of-File >$tmp.conf
83 # temporary pmcd.conf for qa/$seq
84 irix 1 dso irix_init libirixpmda.so
85 pmcd 2 dso pmcd_init pmda_pmcd.so
86 proc 3 dso proc_init pmda_proc.so
87 End-of-File
88 elif [ $PCP_PLATFORM = linux ]
89 then
90 cat <<End-of-File >$tmp.conf
91 # temporary pmcd.conf for qa/$seq
92 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
93 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
94 End-of-File
95 elif [ $PCP_PLATFORM = darwin ]
96 then
97 cat <<End-of-File >$tmp.conf
98 # temporary pmcd.conf for qa/$seq
99 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
100 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
101 End-of-File
102 elif [ $PCP_PLATFORM = solaris ]
103 then
104 cat <<End-of-File >$tmp.conf
105 # temporary pmcd.conf for qa/$seq
106 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
107 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
108 End-of-File
109 else
110 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
111 exit 1
113 echo "=== initial pmcd.conf ===" >>$seq.full
114 cat $tmp.conf >>$seq.full
115 echo "=== ===" >>$seq.full
116 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
117 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
118 _wait_for_pmcd
120 cat <<End-of-File >$tmp.cmd
121 rm -f $PCP_PMCDCONF_PATH.prev
122 . $PCP_SHARE_DIR/lib/pmdaproc.sh
123 __can_wait=6
124 forced_restart=false
125 __pmda_add "bogus 111 pipe binary $killer"
126 End-of-File
128 echo
129 echo "__pmda_add test: expect this to fail and revert to the status quo ..."
130 echo "__pmda_add test: expect this to fail and revert to the status quo ..." >>$seq.full
131 echo
133 $sudo sh $tmp.cmd 2>&1 \
134 | tee $tmp.out \
135 | _filter
136 cat $tmp.out >>$seq.full
138 echo "=== pmcd.conf after bogus install ===" >>$seq.full
139 cat $PCP_PMCDCONF_PATH >>$seq.full
140 echo "=== ===" >>$seq.full
142 echo "\$PCP_PMCDCONF_PATH should be put back the way it was ... diffs ..."
143 diff $PCP_PMCDCONF_PATH $tmp.conf
145 echo
146 cat <<End-of-File >$tmp.cmd
147 rm -f $PCP_PMCDCONF_PATH.prev
148 . $PCP_SHARE_DIR/lib/pmdaproc.sh
149 __can_wait=6
150 __pmda_cull fungus 222
151 End-of-File
153 echo "bogus 111 pipe binary $killer" >>$tmp.conf
154 echo "fungus 222 pipe binary $killer" >>$tmp.conf
155 echo "=== next pmcd.conf ===" >>$seq.full
156 cat $tmp.conf >>$seq.full
157 echo "=== ===" >>$seq.full
158 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
160 echo
161 echo "__pmda_cull test: expect this to fail and restoration to fail ..."
162 echo "__pmda_cull test: expect this to fail and restoration to fail ..." >>$seq.full
163 echo
165 $sudo sh $tmp.cmd 2>&1 \
166 | tee $tmp.out \
167 | _filter
168 cat $tmp.out >>$seq.full
170 echo "=== pmcd.conf after fungus remove ===" >>$seq.full
171 cat $PCP_PMCDCONF_PATH >>$seq.full
172 echo "=== ===" >>$seq.full
174 # success, all done
175 status=0
177 exit