pmrep: fix archive end time reporting
[pcp.git] / qa / 445
blob043eceff36110201c52a7e483fb63d5be1d41b7a
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
68 freebsd)
69 TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
70 cat >> $tmp.conf << EOF
71 # temporary pmcd.conf for qa/$seq
72 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
73 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
74 trace 10 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
75 trace 99 pipe binary $PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
76 EOF
80 echo "Unknown platfrom $PCP_PLATFORM"
81 exit 1
83 esac
85 # real QA test starts here
86 $sudo rm -f ${TRACELOG}? $seq.full
87 _save_config $PCP_PMCDCONF_PATH
88 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
89 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
90 _wait_for_pmcd
91 sleep 15
93 for log in ${TRACELOG}?
95 fgrep "Address already in use" <$log >/dev/null 2>&1
96 status=$?
97 if [ $status -eq 0 ]
98 then
99 # filter the log ...
100 sed <$log \
101 -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/'\
102 -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' \
103 -e "s/$host/HOST/g" \
104 -e 's/\([0-9][0-9]*\)/PID/'
105 break
107 done
109 if [ $status -ne 0 ]
110 then
111 echo "--- No match on 'Address already in use' in trace logs ---"
112 echo "--- trace log #1 ---"
113 cat ${TRACELOG}1
114 echo "--- trace log #2 ---"
115 cat ${TRACELOG}2
116 echo "--- End of trace logs ---"
119 exit