File: 445

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (147 lines) | stat: -rwxr-xr-x 4,444 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#! /bin/sh
# PCP QA Test No. 445
# check bug #580005 - trace PMDA doesn't exit if address in use
#
# Copyright (c) 2015 Red Hat.
# Copyright (c) 1995-2002 Silicon Graphics, Inc.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard filters
. ./common.product
. ./common.filter
. ./common.check

[ -f $PCP_PMDAS_DIR/trace/pmdatrace ] || _notrun "trace pmda not installed"

host=`hostname`

_cleanup()
{
    _restore_config $PCP_PMCDCONF_PATH
    _service pmcd restart 2>&1 | _filter_pcp_restart
    _wait_for_pmcd
    _service pmlogger restart 2>&1 | _filter_pcp_restart
    _wait_for_pmlogger
    $sudo rm -f $tmp.*
}

status=1	# failure is the default!
logging=0
trap "_cleanup; exit \$status" 0 1 2 3 15

case "$PCP_PLATFORM" in

linux)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
linux   60      dso     linux_init      $PCP_PMDAS_DIR/linux/pmda_linux.so
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

darwin)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
darwin  78      dso     darwin_init     $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

solaris)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
solaris	75	dso	solaris_init	$PCP_PMDAS_DIR/solaris/pmda_solaris.so
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

freebsd)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
freebsd	85	dso	freebsd_init	$PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

netbsd)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
netbsd	116	dso	netbsd_init	$PCP_PMDAS_DIR/netbsd/pmda_netbsd.so
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

openbsd)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
openbsd	139	dso	openbsd_init	$PCP_PMDAS_DIR/openbsd/pmda_openbsd.so
trace	10	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 10 -l ${TRACELOG}1
trace	99	pipe	binary 		$PCP_PMDAS_DIR/trace/pmdatrace -d 99 -l ${TRACELOG}2
EOF
    ;;

*)
    echo "Unknown platfrom $PCP_PLATFORM"
    exit 1
    ;;
esac

# real QA test starts here
$sudo rm -f ${TRACELOG}?
_save_config $PCP_PMCDCONF_PATH
$sudo cp $tmp.conf $PCP_PMCDCONF_PATH
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmcd || _exit 1
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| _filter_pcp_restart
_wait_for_pmlogger || _exit 1
sleep 15

for log in ${TRACELOG}?
do
    grep -F "Address already in use" <$log >/dev/null 2>&1
    status=$?
    if [ $status -eq 0 ]
    then
	# filter the log ...
	sed <$log \
	    -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/'\
	    -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' \
	    -e "s/$host/HOST/g" \
	    -e 's/\([0-9][0-9]*\)/PID/'
	break
    fi
done

if [ $status -ne 0 ]
then
    echo "--- No match on 'Address already in use' in trace logs ---"
    echo "--- trace log #1 ---"
    cat ${TRACELOG}1
    echo "--- trace log #2 ---"
    cat ${TRACELOG}2
    echo "--- End of trace logs ---"
fi

exit