File: 156

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 (124 lines) | stat: -rwxr-xr-x 2,754 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
#! /bin/sh
# PCP QA Test No. 156
# check out sample PMDA
# - see qa/1339 for the Internet socket connection cases
#
# 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

_filter()
{
    _filter_pmda_install \
    | _filter_compiler_babble \
    | sed \
	-e 's/ 1[34][0-9][0-9] values/ 1300+ values/' \
	-e 's/ 1[0-9] warnings/ 10+ warnings/' \
	-e 's/ [12][0-9][0-9] metrics/ 100+ metrics/' \
	-e "s;$tmp;TMP;" \
	-e "s/$port1/PORT1/" \
	-e "s/$port2/PORT2/" \
    # end
}

_check_pmda_gone()
{
    sleep 2
    pminfo -v $1 && echo "Error: pminfo -v found some \"$1\" metrics"
    # PMDA process may be a zombie because pmcd has not yet harvested
    # it ... in this case, name will appear as [pmda$1] or (pmda$1)
    # so skip these ones
    #
    $PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep "[^([][p]mda$1[^])]" >$tmp.tmp
    if [ -s $tmp.tmp ]
    then
	echo "Error: some \"$1\" PMDAs still present"
	cat $tmp.tmp
    fi
    rm -f $tmp.tmp
}

_snag_log()
{
    if [ -f "$PCP_LOG_DIR/pmcd/sample.log" ]
    then
	cat "$PCP_LOG_DIR/pmcd/sample.log" >>$seq_full
    else
	echo "$PCP_LOG_DIR/pmcd/sample.log: missing?"
    fi
}

status=1


# save pmcd.conf and restore it after the test
cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf

home=$PCP_PMDAS_DIR
iam=sample
if [ ! -d $home/$iam ]
then
    echo "Where is $home/$iam?"
    exit 1
fi
cd $home/$iam
unset ROOT MAKEFLAGS

# force dynamic.indom to be what we expect ...
#
echo "1 one" >$tmp.indom
echo "2 two" >>$tmp.indom
$sudo cp $tmp.indom dynamic.indom

# make sure sample agent is running again at the end, so other QA tests
# continue to work
#
trap "echo; echo 'Reinstall PMDA ...'; $sudo ./Install </dev/null >$tmp.out; _filter <$tmp.out; $sudo cp $tmp.pmcd.conf $PCP_PMCDCONF_PATH; $sudo rm -f $tmp.*; exit \$status" 0 1 2 3 15

# real QA test starts here

echo
echo "=== remove agent ==="
$sudo ./Remove >$tmp.out 2>&1
cat $tmp.out
_check_pmda_gone $iam

echo
echo "=== pipe agent ===" | tee -a $seq_full
echo pipe | $sudo ./Install -e >$tmp.out 2>&1
_filter <$tmp.out
pminfo -v sample || echo "... failed!"
_snag_log
echo pipe | $sudo ./Install -e >$tmp.out 2>&1
_filter <$tmp.out
pminfo -v sample || echo "... failed!"
_snag_log

echo | tee -a $seq_full
echo "=== socket Unix agent ===" | tee -a $seq_full
echo 'socket
Unix
'"$tmp.fifo" | $sudo ./Install -e >$tmp.out 2>&1
_filter <$tmp.out
pminfo -v sample || echo "... failed!"
_snag_log
echo 'socket
Unix
'"$tmp.fifo" | $sudo ./Install -e >$tmp.out 2>&1
_filter <$tmp.out
pminfo -v sample || echo "... failed!"
_snag_log

$sudo ./Remove >$tmp.out 2>&1
cat $tmp.out
_check_pmda_gone $iam

status=0
exit