qa: update 660 to generate index.html, fixing pcp-testsuite runs
[pcp.git] / qa / 115
blobc7fedb373e71dc5cbdf2750112ea50d984be3aa7
1 #! /bin/sh
2 # PCP QA Test No. 115
3 # exercises pmie_check functionality
5 # Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 [ -f /etc/gentoo-release ] && _notrun "Gentoo is lacking chkconfig support"
17 if [ -z "$PCP_PMIECONTROL_PATH" ]
18 then
19 echo "Error: botched installation - PCP_PMIECONTROL_PATH not defined"
20 exit 1
23 _cleanup()
25 if $needclean
26 then
27 _restore_config $PCP_PMIECONTROL_PATH
28 _restore_config $PCP_PMCDCONF_PATH
30 $sudo rm -f $tmp.*
33 status=1 # failure is the default!
34 $sudo rm -f $tmp.* $seq.full
35 signal=$PCP_BINADM_DIR/pmsignal
36 needclean=false
37 trap "_cleanup; exit \$status" 0 1 2 3 15
39 lhost=`hostname | sed -e 's/\..*//'`
40 host=`_get_fqdn`
41 remote=`./getpmcdhosts -n 1 -L 2>$tmp.out`
42 rhost=`echo $remote | sed -e 's/\..*//'`
43 [ -z "$remote" ] && _notrun `cat $tmp.out`
45 # Now that we have pmmgr in the mix, there is more than one pmie
46 # potentially running, so lines like this
47 # ... try /var/lib/pcp/tmp/pmie/25453: different logfile, skip
48 # /var/log/pcp/pmmgr/bozo/pmie.log differs to /tmp/SEQ-PID.log1
49 # are now expected, and not a problem.
51 _filter()
53 sed \
54 -e "s/$seq-$$/SEQ-PID/g" \
55 -e "s;$PCP_BIN_DIR/pmie;\$PCP_BIN_DIR/pmie;" \
56 -e 's/$/ /' \
57 -e 's/\([ "]\)'"$remote"'\([ "]\)/\1REMOTEHOST\2/g' \
58 -e 's/\([ "]\)'"$rhost"'\([ "]\)/\1REMOTEHOST\2/g' \
59 -e 's/\([ "]\)'"$host"'\([ "]\)/\1LOCALHOST\2/g' \
60 -e 's/\([ "]\)local:\([ "]\)/\1LOCALHOST\2/g' \
61 -e "s;/private/tmp;/tmp;g" \
62 -e '/ try .* different logfile, skip/d' \
63 -e '/\/pmmgr\/.* differs to /d' \
64 -e 's/ $//'
67 _count_pmies()
69 count=0
70 if [ -d $PCP_TMP_DIR/pmie ]
71 then cd $PCP_TMP_DIR/pmie
72 else return 0
75 ls -l >>$here/$seq.full
76 plist=`ls -1`
77 echo "plist=$plist" >>$here/$seq.full
78 cd $here
80 for process in $plist
82 ps -p $process >/dev/null 2>&1
83 if [ $? = 1 ]
84 then
85 echo "urk, $PCP_TMP_DIR/pmie/$process has no running pmie instance"
86 else
87 count=`expr $count + 1`
88 ps -f -p $process >>$here/$seq.full
89 if `which pstree >/dev/null 2>&1`
90 then
91 pstree $process >>$here/$seq.full
94 done
96 return $count
99 # create a basic pmcd config file
100 cat >$tmp.pmcd.conf << EOF
101 # from QA $seq
102 irix 1 dso irix_init libirixpmda.so
103 pmcd 2 dso pmcd_init pmda_pmcd.so
104 proc 3 dso proc_init pmda_proc.so
107 # create a pmie config file
108 cat >$tmp.conf << EOF
109 foo = sample.long.one;
110 doo = sample.long.ten;
113 # create pmie control files
114 cat >$tmp.control << EOF
115 \$version=1.0
116 $remote n $tmp.log1 -c $tmp.conf
117 $remote n $tmp.log2 -c $tmp.conf
118 LOCALHOSTNAME n $tmp.log0 $tmp.conf
121 # real QA test starts here
122 _save_config $PCP_PMIECONTROL_PATH
123 _save_config $PCP_PMCDCONF_PATH
124 needclean=true
125 $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH
127 $sudo $signal -a -s TERM pmie >/dev/null 2>&1
128 sleep 1
129 _change_config pmcd on
130 _change_config pmie off
131 $sudo rm -f $PCP_TMP_DIR/pmie/*
133 _count_pmies
134 echo "pmie count at start of QA testing: $?"
135 echo
137 echo === check default install operation ===
138 $sudo $PCP_RC_DIR/pmie restart 2>&1 | _filter_pmie_start
139 _count_pmies
140 # chkconfig no longer controls start-ability, expect non-zero
141 echo "pmie count after chkconfig pmie off: $?"
142 echo
144 echo === check for missing control file ===
145 _change_config pmie off
146 $sudo rm -f $PCP_PMIECONTROL_PATH
147 _change_config pmie on
148 $sudo $PCP_RC_DIR/pmie restart 2>&1 | _filter_pmie_start
149 _count_pmies
150 echo "pmie count after attempt without control file: $?"
151 echo
153 echo === check pmie_check and custom config ===
154 pmie_check -V -V -N -c $tmp.control -l $tmp.log
155 cat $tmp.log | _filter
156 # don't bother counting pmie processes, as -N is used above!
158 echo
160 $sudo $PCP_RC_DIR/pmie stop 2>&1 \
161 | _filter_pmie_start \
162 | sed -e '/pmie: PMIE not running/d'
163 _change_config pmie off
165 status=0
166 exit