summaryrefslogtreecommitdiff
path: root/qa/445
blob: f94a5d32eb60312d91bba5159df7a9f7bd65b4dc (plain)
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
#! /bin/sh
# PCP QA Test No. 445
# check bug #580005 - trace PMDA doesn't exit if address in use
#
# 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

host=`hostname`

_cleanup()
{
    if [ -f $tmp.bak ]
    then
	$sudo cp $tmp.bak $PCP_PMCDCONF_PATH
	$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
	_wait_for_pmcd
    fi
    $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
irix)
    TRACELOG=$PCP_LOG_DIR/trace.log
    cat >> $tmp.conf << EOF
# temporary pmcd.conf for qa/$seq
irix	1	dso	irix_init	libirixpmda.so
pmcd    2       dso     pmcd_init       pmda_pmcd.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
    ;;

linux)
    TRACELOG=$PCP_LOG_DIR/pmcd/trace.log
    cat >> $tmp.conf << EOF
# temporary pmcd.conf for qa/$seq
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
# temporary pmcd.conf for qa/$seq
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
# temporary pmcd.conf for qa/$seq
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
    ;;

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

# real QA test starts here
$sudo rm -f $tmp.bak ${TRACELOG}? $seq.full
$sudo cp $PCP_PMCDCONF_PATH $tmp.bak
$sudo cp $tmp.conf $PCP_PMCDCONF_PATH
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
sleep 15

for log in ${TRACELOG}?
do
    fgrep "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