blob: 0677953a04faf1579499d722c4d6c3a4819b1890 (
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
|
#! /bin/sh
# PCP QA Test No. 283
# Move pmcd port to iana registered 44321, and the associated multiple
# port changes for ...
# pmcd via -p
# pmcd via PMCD_PORT
# clients via PMCD_PORT
#
# Copyright (c) 2005 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
. ./localconfig
rm -f $seq.out
if pmcd -x /dev/null -p x 2>&1 | grep '.-p requires a posi*tive numeric argument' >/dev/null
then
if test $PCP_EOE_VER -ge 2704
then
ln $seq.out.2 $seq.out
else
ln $seq.out.1 $seq.out
fi
else
echo "Need -p option support in pmcd" >$seq.notrun
echo "$seq: [not run] `cat $seq.notrun`"
exit 0
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
signal="$sudo $PCP_BINADM_DIR/pmsignal"
status=0 # success is the default!
$sudo rm -rf $tmp.*
_cleanup()
{
$sudo rm -f $tmp.*
[ -z "$pmcd_pid" ] || $signal -s KILL $pmcd_pid
unset PMCD_PORT
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
}
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed -n \
-e '/^sample/p' \
-e '/^__pmConnectPMCD(/{
s/(.*)/(HOST)/
s/fd=[0-9][0-9]*/fd=<n>/
p
}'
}
$sudo $PCP_RC_DIR/pcp stop >/dev/null 2>&1
# allow time to cleanup and close all sockets
sleep 3
rm -f $seq.full
# figure out which user we will run pmcd and its pmdas as
username=`id -u -n`
sudoopts="-u $username"
id pcp >/dev/null 2>&1 && sudoopts="-u pcp"
# real QA test starts here
for pmcd_o in 1 2 3
do
unset PMCD_PORT
pmcd_opt=''
case $pmcd_o
in
1) # default
;;
2) # PMCD_PORT is a list in the environment
PMCD_PORT="9876,44321,4321"
export PMCD_PORT
;;
3) # -p option to pmcd
pmcd_opt="-p 4321 -p 44321 -p 9876"
esac
echo
echo "=== PMCD_PORT=$PMCD_PORT pmcd_opt=$pmcd_opt ==="
echo "=== PMCD_PORT=$PMCD_PORT pmcd_opt=$pmcd_opt ===" >>$seq.full
cat >$tmp.sh <<END
#!/bin/sh
PATH=$PATH
$PCP_PMCD_PROG -f -l $tmp.log $pmcd_opt &
echo \$!
END
# Filter the stderr of this using a temp file
pmcd_pid=`$sudo $sudoopts sh $tmp.sh 2>$tmp.tmp`
cat $tmp.tmp 1>&2
sleep 1
for client_o in 1 2
do
unset PMCD_PORT
case $client_o
in
1) # default
;;
2) # PMCD_PORT is a list in the environment
PMCD_PORT="9876,4321,44321"
export PMCD_PORT
;;
esac
echo "--- PMCD_PORT=$PMCD_PORT ---"
echo "--- PMCD_PORT=$PMCD_PORT ---" >>$seq.full
pmprobe -v -h localhost -D context sample.long.one >$tmp.tmp 2>&1
cat $tmp.tmp >>$seq.full
_filter <$tmp.tmp
done
$signal -s TERM $pmcd_pid
pmcd_pid=''
wait
sleep 3
cat $tmp.log >>$seq.full
# _filter_pmcd_log <$tmp.log
done
# success, all done
exit
|