summaryrefslogtreecommitdiff
path: root/qa/296
blob: e01b1f076840caf51c96062abe3fc3916aa2933b (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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#! /bin/sh
# PCP QA Test No. 296
# daemon pmdas not exiting after unconfiguring them?
#
# 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

status=0	# success is the default!
signal=$PCP_BINADM_DIR/pmsignal
LOCALHOST=`hostname`
_needclean=true

_interrupt()
{
    status=1
}

_cleanup()
{
    if $_needclean
    then
	echo
	echo 'Restoring real pmcd.conf ...'
	[ -f $tmp.pmcd.conf.save ] && \
	    $sudo mv $tmp.pmcd.conf.save $PCP_PMCDCONF_PATH
	$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
	_wait_for_pmcd
	_wait_for_pmlogger
	_needclean=false
    fi
    rm -f $tmp.*
    exit $status
}

cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf.save

trap "_cleanup" 0
trap "_interrupt; _cleanup" 1 2 3 15

# real QA test starts here

case $PCP_PLATFORM in
linux|solaris)
    cat <<End-of-File >$tmp.minconf
# temporary pmcd.conf for qa/$seq
#
# Name	Id	IPC	IPC Params 	File/Cmd
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
End-of-File
    ;;

irix)
    cat <<End-of-File >$tmp.minconf
# temporary pmcd.conf for qa/$seq
#
# Name	Id	IPC	IPC Params 	File/Cmd
pmcd	2	dso	pmcd_init	pmda_pmcd.so
End-of-File
    ;;

darwin)
    cat <<End-of-File >$tmp.minconf
# temporary pmcd.conf for qa/$seq
#
# Name	Id	IPC	IPC Params 	File/Cmd
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
End-of-File
    ;;

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

echo "start 11 daemon instances of the sample PMDA"
cp $tmp.minconf $tmp.out
cat <<End-of-File >>$tmp.out
sample	9	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 9
sample	19	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 19
sample	29	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 29
sample	39	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 39
sample	49	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 49
sample	59	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 59
sample	69	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 69
sample	79	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 79
sample	89	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 89
sample	99	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 99
sample	109	pipe	binary		$PCP_PMDAS_DIR/sample/pmdasample -d 109
End-of-File
$sudo cp $tmp.out $PCP_PMCDCONF_PATH
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd

ps $PCP_PS_ALL_FLAGS >$tmp.out
num=`grep pmdasample $tmp.out | wc -l | sed -e 's/ //g'`
if [ $num -ne 11 ]
then
    echo "Error: number of sample PMDAs? expect 11 got $num"
    echo "=== ps $PCP_PS_ALL_FLAGS ==="
    cat $tmp.out
    echo "=== pmcd.log ==="
    cat $PCP_PMCDLOG_PATH
    status=1
    exit
else
    echo "OK, 11 started"
fi

echo
echo "unconfigure them all"
$sudo cp $tmp.minconf $PCP_PMCDCONF_PATH
$sudo $signal -a -s HUP pmcd
sleep 5
_wait_for_pmcd

ps $PCP_PS_ALL_FLAGS >$tmp.out
cp $tmp.out $seq.full
num=`grep pmdasample $tmp.out | wc -l | sed -e 's/ //g'`
if [ $num -ne 0 ]
then
    echo "Error: number of sample PMDAs? expect 11 got $num"
    echo "=== ps $PCP_PS_ALL_FLAGS ==="
    cat $tmp.out
    echo "=== pmcd.log ==="
    cat $PCP_PMCDLOG_PATH
    status=1
else
    echo "OK, 0 remain"
fi

# all done
exit