blob: d2065a1bbf7adeef991ce19c20a20900631caee1 (
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
|
#! /bin/sh
# PCP QA Test No. 119
# pmlogger_check failure produces way too many lines of output
# pv 877570
#
# Copyright (c) 2002 Silicon Graphics, Inc. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
# need fix for pv 877570
if [ $PCP_PLATFORM != irix -a $PCP_VER -ge 2300 ]
then
# fix is in pcp-2.3.0-11
:
elif [ $PCP_PLATFORM = irix -a $PCP_VER -ge 2400 ]
then
# PCP 2.4 or later
:
else
echo "need fix for pv #877570" >$seq.notrun
echo "$seq: [not run] `cat $seq.notrun`"
exit 0
fi
rm -f $seq.out
if grep ^TERSE= $PCP_BINADM_DIR/pmlogger_check >/dev/null
then
# new version with -T option
#
have_T=true
ln $seq.new.out $seq.out
else
# old version
#
have_T=false
ln $seq.old.out $seq.out
fi
$sudo rm -rf $tmp.*
status=1 # failure is the default!
_needclean=true
[ -z "$PCP_PMLOGGERCONTROL_PATH" ] && \
PCP_PMLOGGERCONTROL_PATH="$PCP_SYSCONF_DIR/pmlogger/control"
LOGGING_DIR=$PCP_LOG_DIR/pmlogger_qa
myhost=`hostname`
[ $PCP_VER -lt 3806 ] && myhost=`echo $myhost | sed -e 's/\..*//'`
trap "_cleanup" 0 1 2 3 15
_cleanup()
{
if $_needclean
then
[ -f $tmp.control ] && \
$sudo cp $tmp.control $PCP_PMLOGGERCONTROL_PATH
$sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
_wait_for_pmcd
_wait_for_pmlogger
_needclean=false
fi
$sudo rm -f $tmp.*
$sudo rm -rf $LOGGING_DIR/${myhost}-one
$sudo rm -rf $LOGGING_DIR/${myhost}-two
$sudo rm -rf $LOGGING_DIR/no.such.host
exit $status
}
_filter()
{
sed \
-e "s/$myhost/LOCALHOST/g" \
-e "/UID.*PID/d" \
-e "/USER.*PID/d" \
-e "s/.* pmlogger .*-c .*/<pmlogger process>/" \
-e "/Warning: creating directory/s/(.*\/\([^/][^/]*\))/(...\/\1)/" \
| _filter_pmlogger_log \
| $PCP_AWK_PROG '
/pmlogger_check: Error: archive file .* missing/ {
$5 = "FILE"
print
skip = 1
next
}
skip == 1 { next }
{ print }'
}
$sudo cp $PCP_PMLOGGERCONTROL_PATH $tmp.control
cat <<End-of-File >$tmp.tmp
# dummy file created by qa/$seq on `date`
# the goal here is to have just two pmlogger instances running and
# a third one that will never run ...
#
\$version=1.1
LOCALHOSTNAME y n $LOGGING_DIR/LOCALHOSTNAME-one -c /dev/null
LOCALHOSTNAME n n $LOGGING_DIR/LOCALHOSTNAME-two -c /dev/null -L
no.such.host n n $LOGGING_DIR/no.such.host -c /dev/null
End-of-File
$sudo cp $tmp.tmp $PCP_PMLOGGERCONTROL_PATH
# stop pmcd, create the archive directories, start pmcd ...
#
$sudo $PCP_RC_DIR/pcp stop >$tmp.out 2>&1
cat $tmp.out >$seq.full
$sudo mkdir -p $LOGGING_DIR/${myhost}-one >/dev/null 2>&1
$sudo mkdir -p $LOGGING_DIR/${myhost}-two >/dev/null 2>&1
$sudo mkdir -p $LOGGING_DIR/no.such.host >/dev/null 2>&1
id pcp >/dev/null 2>&1 && $sudo chown -R pcp:pcp $LOGGING_DIR
echo "+++ before pmcd start ..." >>$seq.full
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
echo "+++" >>$seq.full
$sudo $PCP_RC_DIR/pcp start >$tmp.out 2>&1
cat $tmp.out >>$seq.full
_wait_for_pmcd
echo "+++ after pmcd start ..." >>$seq.full
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
echo "+++" >>$seq.full
# avoid race with pmloggers not being started before pmlogger_check
# is run below
for i in 1 2 3 4 5
do
[ -f $LOGGING_DIR/${myhost}-one/pmlogger.log -a -f $LOGGING_DIR/${myhost}-two/pmlogger.log ] && break
sleep 1
done
if [ ! -f $LOGGING_DIR/${myhost}-one/pmlogger.log ]
then
echo "Failed to start pmlogger for ${myhost}-one"
echo "Logging directory contents ..."
ls -l $LOGGING_DIR/${myhost}-one
exit
fi
if [ ! -f $LOGGING_DIR/${myhost}-two/pmlogger.log ]
then
echo "Failed to start pmlogger for ${myhost}-two"
echo "Logging directory contents ..."
ls -l $LOGGING_DIR/${myhost}-two
exit
fi
# real QA test starts here
echo
echo "=== pmlogger_check ==="
echo "+++ before pmlogger_check ..." >>$seq.full
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
echo "+++" >>$seq.full
echo >>$seq.full
echo "=== pmlogger_check ===" >>$seq.full
$sudo $PCP_BINADM_DIR/pmlogger_check >$tmp.out 2>&1
echo "+++ after pmlogger_check ..." >>$seq.full
$PCP_PS_PROG $PCP_PS_ALL_FLAGS | grep '[p]mlogger' >>$seq.full
echo "+++" >>$seq.full
_filter <$tmp.out
cat $tmp.out >>$seq.full
if $have_T
then
echo
echo "=== pmlogger_check -T ==="
echo >>$seq.full
echo "=== pmlogger_check -T ===" >>$seq.full
$sudo $PCP_BINADM_DIR/pmlogger_check -T >$tmp.out 2>&1
_filter <$tmp.out
cat $tmp.out >>$seq.full
fi
# all OK
status=0
exit
|