Drop unused condition check
[pcp.git] / qa / 445
blob2b31a7250385cfabe3eb3285421f5b04b5f5e8d7
1 #! /bin/sh
2 # PCP QA Test No. 445
3 # check bug #580005 - trace PMDA doesn't exit if address in use
5 # Copyright (c) 2015 Red Hat.
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 [ -f $PCP_PMDAS_DIR/trace/pmdatrace ] || _notrun "trace pmda not installed"
19 host=`hostname`
21 _cleanup()
23 _restore_config $PCP_PMCDCONF_PATH
24 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
25 _wait_for_pmcd
26 $sudo rm -f $tmp.*
29 status=1 # failure is the default!
30 logging=0
31 trap "_cleanup; exit \$status" 0 1 2 3 15
33 case "$PCP_PLATFORM" in
35 linux)
36 TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
37 cat >> $tmp.conf << EOF
38 # temporary pmcd.conf for qa/$seq
39 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
40 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
41 trace 10 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
42 trace 99 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
43 EOF
46 darwin)
47 TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
48 cat >> $tmp.conf << EOF
49 # temporary pmcd.conf for qa/$seq
50 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
51 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
52 trace 10 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
53 trace 99 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
54 EOF
57 solaris)
58 TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
59 cat >> $tmp.conf << EOF
60 # temporary pmcd.conf for qa/$seq
61 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
62 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
63 trace 10 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
64 trace 99 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
65 EOF
69 echo "Unknown platfrom $PCP_PLATFORM"
70 exit 1
72 esac
74 # real QA test starts here
75 $sudo rm -f ${TRACELOG}? $seq.full
76 _save_config $PCP_PMCDCONF_PATH
77 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
78 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
79 _wait_for_pmcd
80 sleep 15
82 for log in ${TRACELOG}?
84 fgrep "Address already in use" <$log >/dev/null 2>&1
85 status=$?
86 if [ $status -eq 0 ]
87 then
88 # filter the log ...
89 sed <$log \
90 -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'\
91 -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/TIMESTAMP/g' \
92 -e "s/$host/HOST/g" \
93 -e 's/\([0-9][0-9]*\)/PID/'
94 break
96 done
98 if [ $status -ne 0 ]
99 then
100 echo "--- No match on 'Address already in use' in trace logs ---"
101 echo "--- trace log #1 ---"
102 cat ${TRACELOG}1
103 echo "--- trace log #2 ---"
104 cat ${TRACELOG}2
105 echo "--- End of trace logs ---"
108 exit