summaryrefslogtreecommitdiff
path: root/qa/110
blob: 8a0cf7c829bdaaf4ed4c7e28db682d1460656785 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
#! /bin/sh
# PCP QA Test No. 110
# check out simple PMDA
#
# 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

signal=$PCP_BINADM_DIR/pmsignal
status=1

PMDA_LOG_PATH=`echo $PCP_PMCDLOG_PATH | sed -e 's/pmcd.log/simple.log/'`

_cleanup()
{
	[ -f $tmp.conf.bak ] && $sudo cp $tmp.conf.bak $home/$iam/$iam.conf
	if diff $tmp.pmcd.conf $PCP_PMCDCONF_PATH > /dev/null 2>&1
	then
	    :
	else

# do a default install which ensures the pmns and any views are installed

	    $sudo ./Install < /dev/null > /dev/null 2>&1

# PMDA may have been installed differently to default. As everything is
# installed we can use the old pmcd.conf file to restore state.

	    if diff $tmp.pmcd.conf $PCP_PMCDCONF_PATH > /dev/null 2>&1
	    then
		:
	    else
	    	[ -f $tmp.pmcd.conf ] && $sudo mv $tmp.pmcd.conf $PCP_PMCDCONF_PATH
		$sudo $signal -a -s HUP pmcd
	    fi
	fi
	$sudo rm -f $tmp.*
	exit $status
}

trap "_cleanup" 0 1 2 3 15

_failed()
{
    echo
    echo "... failed! ... here is the Install log ..."
    cat $tmp.out
    echo
    echo "... and the tail of the pmcd log ..."
    tail -20 $PCP_PMCDLOG_PATH
    echo
    echo "...and the PMDA log ..."
    cat $PMDA_LOG_PATH
}

_filter()
{
    _filter_pmda_install | \
    sed \
	-e 's/ or perl//' \
	-e 's/ or python//' \
	-e "s;$tmp;TMP;" \
	-e "s/$port1/PORT1/" \
	-e "s/$port2/PORT2/"
}

_full()
{
    echo "--- pmcd.conf ---" >>$here/$seq.full
    cat $PCP_PMCDCONF_PATH >>$here/$seq.full
    echo "--- pmcd.log ---" >>$here/$seq.full
    cat $PCP_PMCDLOG_PATH >>$here/$seq.full
    echo "--- simple.log ---" >>$here/$seq.full
    if [ -f $PMDA_LOG_PATH ]
    then
	cat $PMDA_LOG_PATH >>$here/$seq.full
    else
	echo "$PMDA_LOG_PATH: file not found" >>$here/$seq.full
    fi
    echo >>$here/$seq.full
}

rm -f $seq.full

# real QA test starts here
home=$PCP_PMDAS_DIR
iam=simple
if [ ! -d $home/$iam ]
then
    echo "Where is $home/$iam?"
    exit 1
fi
cd $home/$iam
unset ROOT MAKEFLAGS

# copy the pmcd config file to restore state later.
cp $PCP_PMCDCONF_PATH $tmp.pmcd.conf

if $sudo make clobber >$tmp.out 2>&1
then
    :
else
    cat $tmp.out
    echo "Arrgh, make clobber failed"
    exit
fi

# start from a known starting point
$sudo ./Remove >/dev/null 2>&1

echo
echo "=== pipe daemon agent ==="
echo "=== pipe daemon agent ===" >>$here/$seq.full
$sudo ./Remove >$tmp.out 2>&1
$sudo rm -f $PMDA_LOG_PATH
echo 'both
daemon
pipe' | $sudo ./Install -e >>$tmp.out 2>&1
_full

_filter <$tmp.out

if pminfo -v simple
then
    :
else
    _failed
fi

echo
echo "=== Unix socket daemon agent ==="
echo "=== Unix socket daemon agent ===" >>$here/$seq.full
$sudo ./Remove >$tmp.out 2>&1
echo 'both
daemon
socket
Unix
'"$tmp.fifo-1" | $sudo ./Install -e >>$tmp.out 2>&1
$sudo rm -f $PMDA_LOG_PATH
echo 'both
daemon
socket
Unix
'"$tmp.fifo-2" | $sudo ./Install -e >>$tmp.out 2>&1
_full

_filter <$tmp.out

if pminfo -v simple
then
    :
else
    _failed
fi

echo
echo "=== Internet socket daemon agent ==="
echo "=== Internet socket daemon agent ===" >>$here/$seq.full
$sudo ./Remove >$tmp.out 2>&1

# pick a tcp port that is not in use
#
port1=`_get_port tcp 5650 5699`
if [ -z "$port1" ]
then
    echo "Arrgh ... no free TCP port in the range 5650 ... 5699"
    exit 1
fi

echo 'both
daemon
socket
Internet
'$port1 | $sudo ./Install -e >>$tmp.out 2>&1

# use next port this time
port2=`expr $port1 + 1`

$sudo rm -f $PMDA_LOG_PATH
echo 'both
daemon
socket
Internet
'$port2 | $sudo ./Install -e >>$tmp.out 2>&1
_full

_filter <$tmp.out

if pminfo -v simple
then
    :
else
    _failed
fi

echo
echo "=== dso agent ==="
echo "=== dso agent ===" >>$here/$seq.full
$sudo ./Remove >$tmp.out 2>&1
echo 'both
dso' | $sudo ./Install -e >>$tmp.out 2>&1
$sudo rm -f $PMDA_LOG_PATH
echo 'both
dso' | $sudo ./Install -e >>$tmp.out 2>&1
_full

_filter <$tmp.out

if pminfo -v simple
then
    :
else
    _failed
fi

$sudo ./Remove >$tmp.out 2>&1
_filter <$tmp.out

status=0
exit