Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 365
blobf9d53f5657ae1154ebe99a211ff2f16a3cd1d147
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 elif [ $PCP_PLATFORM = freebsd ]
90 then
91 cat <<End-of-File >$tmp.tmp
92 # from qa/$seq
94 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
95 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
97 End-of-File
98 else
99 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
100 exit 1
103 cat <<End-of-File >>$tmp.tmp
105 [access]
106 allow no.such.host.pcp.io : all;
107 allow nohost.engr.sgi.com, $qahost : all;
108 allow $other1, no.such.host.pcp.io, localhost : fetch;
109 allow localhost, $other2, nohost.melbourne.sgi.com : store;
110 allow "local:" , "unix:" : all;
111 End-of-File
113 echo >> $tmp.tmp
114 echo "# from qa/$seq" >> $tmp.tmp
116 $sudo cp $tmp.tmp $PCP_PMCDCONF_PATH
117 echo >>$seq.full
118 echo "=== pmcd.conf ===" >>$seq.full
119 cat $PCP_PMCDCONF_PATH >>$seq.full
121 echo "=== pmcd restarting ===" >>$seq.full
122 $sudo $PCP_RC_DIR/pcp restart 2>>$seq.full | _filter_pcp_start
123 _wait_for_pmcd
124 echo "=== pmcd restarted ===" >>$seq.full
126 cat $PCP_PMCDLOG_PATH >>$seq.full
127 echo >>$seq.full
128 echo "=== pmcd.log ===" >>$seq.full
129 _filter_pmcd_log <$PCP_PMCDLOG_PATH \
130 | sed \
131 -e '/^linux/{
132 s/ [12] dso/1-or-2 dso/
133 s/lib=\/usr\//lib=\/usr-or-var\//
134 s/lib=\/var\//lib=\/usr-or-var\//
135 }' \
136 -e 's/__pmGetAddrInfo/gethostbyname/g' \
137 -e 's/__pmGetHostByName/gethostbyname/g' \
138 -e '/gethostbyname(/s/ Unknown host/ No address associated with name/' \
139 -e '/gethostbyname(/s/ Host name lookup failure/ No address associated with name/' \
140 -e '/gethostbyname(/s/ Resolver Error 0 (no error)/ No address associated with name/' \
141 -e "/$qahost\$/"'{
142 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / LOCALIP /
143 s/ */ /g
144 }' \
145 -e "/$other1\$/"'{
146 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP1 /
147 s/ */ /g
148 }' \
149 -e "/$other2\$/"'{
150 s/ [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]* / OTHERIP2 /
151 s/ */ /g
152 }' \
153 -e "s/$qahost\$/LOCALHOST/g" \
154 -e "s/$other1\$/OTHERHOST1/g" \
155 -e "s/$other2\$/OTHERHOST2/g" \
156 -e '/UNIX_DOMAIN_SOCKET/d' \
157 -e '/1 unix:$/d' \
158 -e '/error sending Conn ACK PDU/d' \
159 -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>/" \
160 | $PCP_AWK_PROG '
161 $8 ~ /^[A-Z]+HOST[12]*$/ && $5 ~ /^[0-9a-f]/ {
162 sub(/^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/,"<ipaddr>",$5)
163 sub(/^[0-9a-f:][0-9a-f:]*%[0-9a-z]+$/,"<ipaddr>",$5)
164 sub(/^[0-9a-f:][0-9a-f:]*$/,"<ipaddr>",$5)
166 { print }'
168 echo "check pmcd is up and we can get local access" >> $seq.full
169 pmprobe hinv.ncpu >>$seq.full 2>&1 || echo "ACCESS DENIED"
171 status=0
172 exit