Drop unused condition check
[pcp.git] / qa / 365
blob5f2910d58dbac3ae920fb930966c19e790c9575d
1 #!/bin/sh
2 # PCP QA Test No. 365
3 # Errors in pmcd.conf [acccess] that should not prevent pmcd starting
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.check
14 . ./common.filter
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 _cleanup()
26 if $done_clean
27 then
29 else
30 if [ -f $tmp.pmcd.conf ]
31 then
32 $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH
33 rm -f $tmp.pmcd.conf
35 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
36 _wait_for_pmcd
37 _wait_for_pmlogger
38 done_clean=true
40 rm -f $tmp.*
43 status=1
44 done_clean=false
45 $sudo rm -rf $tmp.* $seq.full
46 trap "_cleanup; exit \$status" 0 1 2 3 15
48 qahost=`hostname`
49 eval `./getpmcdhosts -L -n 2 2>$tmp.out | sed -e 's/^/other1=/' -e 's/ / other2=/'`
50 echo "other1=$other1" >$seq.full
51 echo "other2=$other2" >>$seq.full
52 echo "qahost=$qahost" >>$seq.full
53 [ -z "$other1" ] && _notrun "Cannot find first remote host running pmcd"
54 [ -z "$other2" ] && _notrun "Cannot find second remote host running pmcd"
56 # real QA test starts here
57 home=$PCP_PMDAS_DIR
59 # copy the pmcd config file to restore state later.
60 cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf
62 if [ $PCP_PLATFORM = linux ]
63 then
64 cat <<End-of-File >$tmp.tmp
65 # from qa/$seq
67 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
68 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
70 End-of-File
71 elif [ $PCP_PLATFORM = darwin ]
72 then
73 cat <<End-of-File >$tmp.tmp
74 # from qa/$seq
76 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
77 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
79 End-of-File
80 elif [ $PCP_PLATFORM = solaris ]
81 then
82 cat <<End-of-File >$tmp.tmp
83 # from qa/$seq
85 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
86 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
88 End-of-File
89 else
90 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
91 exit 1
94 cat <<End-of-File >>$tmp.tmp
96 [access]
97 allow no.such.host.pcp.io : all;
98 allow nohost.engr.sgi.com, $qahost : all;
99 allow $other1, no.such.host.pcp.io, localhost : fetch;
100 allow localhost, $other2, nohost.melbourne.sgi.com : store;
101 allow "local:" , "unix:" : all;
102 End-of-File
104 echo >> $tmp.tmp
105 echo "# from qa/$seq" >> $tmp.tmp
107 $sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
108 echo >>$seq.full
109 echo "=== pmcd.conf ===" >>$seq.full
110 cat $PCP_PMCDCONF_PATH >>$seq.full
112 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
113 _wait_for_pmcd
115 cat $PCP_PMCDLOG_PATH >>$seq.full
116 echo >>$seq.full
117 echo "=== pmcd.log ===" >>$seq.full
118 _filter_pmcd_log <$PCP_PMCDLOG_PATH \
119 | sed \
120 -e '/^linux/{
121 s/ [12] dso/1-or-2 dso/
122 s/lib=\/usr\//lib=\/usr-or-var\//
123 s/lib=\/var\//lib=\/usr-or-var\//
124 }' \
125 -e 's/__pmGetAddrInfo/gethostbyname/g' \
126 -e 's/__pmGetHostByName/gethostbyname/g' \
127 -e '/gethostbyname(/s/ Unknown host/ No address associated with name/' \
128 -e '/gethostbyname(/s/ Host name lookup failure/ No address associated with name/' \
129 -e '/gethostbyname(/s/ Resolver Error 0 (no error)/ No address associated with name/' \
130 -e "/$qahost\$/"'{
131 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / LOCALIP /
132 s/ */ /g
133 }' \
134 -e "/$other1\$/"'{
135 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP1 /
136 s/ */ /g
137 }' \
138 -e "/$other2\$/"'{
139 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP2 /
140 s/ */ /g
141 }' \
142 -e "s/$qahost\$/LOCALHOST/g" \
143 -e "s/$other1\$/OTHERHOST1/g" \
144 -e "s/$other2\$/OTHERHOST2/g" \
145 -e '/UNIX_DOMAIN_SOCKET/d' \
146 -e '/1 unix:$/d' \
147 -e '/error sending Conn ACK PDU/d' \
148 -e "s/[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/<hexnum>/" \
149 | $PCP_AWK_PROG '
150 $8 ~ /^[A-Z]+HOST[12]*$/ && $5 ~ /^[0-9a-f]/ {
151 sub(/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/,"<ipaddr>",$5)
152 sub(/^[0-9a-f:][0-9a-f:]*%[0-9a-z]+$/,"<ipaddr>",$5)
153 sub(/^[0-9a-f:][0-9a-f:]*$/,"<ipaddr>",$5)
155 { print }'
157 echo "check pmcd is up and we can get local access" >> $seq.full
158 pmprobe hinv.ncpu >>$seq.full 2>&1 || echo "ACCESS DENIED"
160 status=0
161 exit