3 # Test PMCD's ability to detect and cleanup agents it didn't create when they
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard filters
17 which netstat
>/dev
/null
2>&1 || _notrun
"netstat not installed"
22 ln $seq.out.ipv6
$seq.out ||
exit 1
24 ln $seq.out.nonipv6
$seq.out ||
exit 1
27 trap "rm -f $tmp.*; exit" 0 1 2 3 15
29 # real QA test starts here
31 signal
=$PCP_BINADM_DIR/pmsignal
38 _filter_pmcd_log
<$log \
45 -e '/^sample/s/.*/sample agent.../' \
46 -e 's/fd=[0-9][0-9]*/fd=<n>/g' \
47 -e 's/^ ok [0-9]*/ ok <n>/g' \
48 -e '/^test/s/ *[0-9][0-9]* *[0-9][0-9]* ... bin/ <n> <n> <n> bin/' \
49 -e '/Resource busy/d' \
50 -e 's/0x[^ ]*\([^ ][^ ][^ ]\)/ADDR...\1/' \
51 -e '/client connection from/,/^$/d' \
53 -e '/Info: spindle_stats_init/d' \
54 -e '/UNIX_DOMAIN_SOCKET/d' \
61 -e 's/^\(Log for pmda[^ ]* on\) .*/\1 HOST .../' \
62 -e 's/^\(Log finished\) .*/\1 .../'
71 if [ -d $PCP_LOG_DIR/pmlogger
]
73 LOGGING_DIR
=$PCP_LOG_DIR/pmlogger
75 LOGGING_DIR
=$PCP_LOG_DIR
80 _restore_config
$PCP_PMCDCONF_PATH
81 pmafm
$LOGGING_DIR/$LOCALHOST/Latest remove
>$tmp.cmd
2>&1 \
83 echo "Restarting pmcd"
84 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
90 trap interrupt
1 2 3 15
94 if [ $PCP_PLATFORM = linux
]
96 cat >$tmp.config
<<End-of-file
97 # pmcd.conf generated by QA $seq
98 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
99 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
100 test $domain socket inet 2222
102 elif [ $PCP_PLATFORM = darwin
]
104 cat >$tmp.config
<<End-of-file
105 # pmcd.conf generated by QA $seq
106 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
107 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
108 test $domain socket inet 2222
110 elif [ $PCP_PLATFORM = solaris
]
112 cat >>$tmp.config
<<End-of-File
113 # pmcd.conf generated by QA $seq
114 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
115 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
116 test $domain socket inet 2222
118 elif [ $PCP_PLATFORM = freebsd
]
120 cat >>$tmp.config
<<End-of-File
121 # pmcd.conf generated by QA $seq
122 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
123 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
124 test $domain socket inet 2222
127 echo "Error - need pmcd.conf setup for $PCP_PLATFORM"
131 # netstat -an formats
134 # tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN
137 # tcp4 0 0 *.2222 *.* LISTEN
140 # *.2222 *.* 0 0 128000 0 LISTEN
143 $sudo $signal -a pmgadgets pmchart pmview pmie
>/dev
/null
2>&1
144 src
/pmdashutdown
-i 2222 -d $domain -l $tmp.pmdalog
&
146 echo "pmdashutdown pid: $pid" >$seq.full
149 echo "port 2222 should be listening"
154 -e 's/127\.0\.0\.1/*/g' \
155 -e 's/0\.0\.0\.0/*/g' \
157 -e 's/.*\(\*.2222\).*\(LISTEN\).*/... \1 ... \2/'
160 _save_config
$PCP_PMCDCONF_PATH
161 $sudo cp $tmp.config
$PCP_PMCDCONF_PATH
162 pmafm
$LOGGING_DIR/$LOCALHOST/Latest remove
>$tmp.cmd
2>&1 \
164 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
167 # cat $config | sed -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;"
170 # wait for pmdashutdown to finish
175 echo "wait for pmdashutdown to finish ... cycle $t" >>$seq.full
176 if ps
$PCP_PS_ALL_FLAGS |
tee -a $seq.full | cut
-f1 |
grep $pid >/dev
/null
2>&1
185 cat $tmp.pmdalog
>>$seq.full
187 echo "pmda log (should have terminated):"
188 _filter_pmda_log
<$tmp.pmdalog
191 $sudo $signal -a -s HUP pmcd
193 # wait for PMCD to finish writing log (or 5 seconds)
196 if egrep '^Cleanup "test" agent' $log >/dev
/null
2>&1