File: 587

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 (188 lines) | stat: -rwxr-xr-x 7,345 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
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
#! /bin/sh
# PCP QA Test No. 587
# pmcd long line handling error
# #754795 - pmcd botches handling of long lines in pmcd.conf
#
# Copyright (c) 1995-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

[ -d $PCP_PMDAS_DIR/trivial ] || _notrun "trivial PMDA directory is not installed"

rm -f $seq.out
case $PCP_PLATFORM
in
    linux|darwin|solaris|freebsd|openbsd)
	ln $seq.$PCP_PLATFORM $seq.out || exit 1
	;;
    *)
	_notrun "Need qualified output for $PCP_PLATFORM"
	;;
esac

signal=$PCP_BINADM_DIR/pmsignal
status=1	# failure is the default!

install_on_cleanup=false
pminfo trivial >/dev/null 2>&1 && install_on_cleanup=true

trap "_cleanup; exit \$status" 0 1 2 3 15

_cleanup()
{
    ( cd $PCP_PMDAS_DIR/trivial ; $sudo $PCP_MAKE_PROG >/dev/null 2>&1 )
    if $install_on_cleanup
    then
	( cd $PCP_PMDAS_DIR/trivial; $sudo ./Install </dev/null >/dev/null 2>&1 )
    else
	( cd $PCP_PMDAS_DIR/trivial; $sudo ./Remove >/dev/null 2>&1 )
    fi
    if [ -f $PCP_PMCDCONF_PATH.$seq ]
    then
	echo
	_restore_config $PCP_PMCDCONF_PATH
	echo "=== cleanup restart pmcd" >>$seq_full
	_service pmcd restart 2>&1 | tee -a $seq_full \
	| _filter_pcp_restart \
	| _filter
	_wait_for_pmcd
	echo "=== cleanup restart pmlogger" >>$seq_full
	_service pmlogger restart 2>&1 | tee -a $seq_full \
	| _filter_pcp_restart \
	| _filter
	_wait_for_pmlogger
    else
	$sudo $signal -a -s HUP pmcd
    fi
    rm -f $tmp.*
    if [ -d $PCP_LOG_DIR/pmcd ]
    then
	$sudo rm -f $PCP_LOG_DIR/pmcd/this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-*-bytes*
    else
	$sudo rm -f $PCP_LOG_DIR/this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-*-bytes*
    fi
}

# verbosity from rc or service scripts is not always the same across
# platforms ... this is not relevant for this test
#
_filter()
{
    sed \
	-e '/^Waiting for pmcd to terminate/d' \
	-e '/^Starting pmcd/d' \
	-e '/^Starting pmlogger/d' \
    # end
}
# default case
PMCDLOG=$PCP_LOG_DIR/pmcd/pmcd.log

case "$PCP_PLATFORM" in

linux)
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
linux   60      dso     linux_init      $PCP_PMDAS_DIR/linux/pmda_linux.so
EOF
    ;;

darwin)
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd    2       dso     pmcd_init       $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
darwin  78      dso     darwin_init     $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
EOF
    ;;

solaris)
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
solaris	75	dso	solaris_init	$PCP_PMDAS_DIR/solaris/pmda_solaris.so
EOF
    ;;

openbsd)
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
openbsd	139	dso	openbsd_init	$PCP_PMDAS_DIR/openbsd/pmda_openbsd.so
EOF
    ;;

freebsd)
    cat >> $tmp.conf << EOF
# Installed by PCP QA test $seq on `date`
pmcd	2	dso	pmcd_init	$PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
freebsd	85	dso	freebsd_init	$PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
EOF
    ;;

*)
    echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
    exit 1
esac

_save_config $PCP_PMCDCONF_PATH
$sudo cp $tmp.conf $PCP_PMCDCONF_PATH
echo "=== initial restart pmcd" >>$seq_full
if ! _service pmcd restart 2>&1; then _exit 1; fi \
| tee -a $seq_full \
| _filter_pcp_restart \
| _filter
_wait_for_pmcd || _exit 1
echo "=== initial restart pmlogger" >>$seq_full
if ! _service pmlogger restart 2>&1; then _exit 1; fi \
| tee -a $seq_full \
| _filter_pcp_restart \
| _filter
_wait_for_pmlogger || _exit 1

unset ROOT MAKEFLAGS
cd $PCP_PMDAS_DIR/trivial
$sudo ./Install </dev/null >/dev/null
cd $here

echo 'bogus	249	pipe	binary 		'"$PCP_PMDAS_DIR/trivial/pmdatrivial"' -d 250 -l "this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-200-bytes-------------------------------------------------------------------"' >>$tmp.conf

echo 'fungus	248	pipe	binary 		'"$PCP_PMDAS_DIR/trivial/pmdatrivial"' -d 250 -l "this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-400-bytes-------------------------------------------------------------------fungus    248     pipe    binary          '"$PCP_PMDAS_DIR/trivial/pmdatrivial"' -d 250 -l this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-500-bytes-------------------------------------------------------------------0123456768901234567689012345676890123456768901234567689012345676890123456768901234567689"' >>$tmp.conf

echo 'humus	247	pipe	binary 		'"$PCP_PMDAS_DIR/trivial/pmdatrivial"' -d 250 -l "this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-2000-bytes------------------------------------------------------------------- 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"' >>$tmp.conf

cp $tmp.conf $tmp.conf+trivial
grep '^trivial' $PCP_PMCDCONF_PATH >>$tmp.conf+trivial

# real QA test starts here
for i in 1 2 3 4 5 6
do
    echo
    echo "=== Cycle $i ==="
    echo "add trivial PMDA ..."
    $sudo cp $tmp.conf+trivial $PCP_PMCDCONF_PATH
    $sudo touch $PCP_PMCDCONF_PATH
    $sudo $signal -a -s HUP pmcd
    sleep 1
    _wait_for_pmcd || _exit 1
    pminfo -f pmcd.agent.type
    echo "cull trivial PMDA ..."
    $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
    $sudo touch $PCP_PMCDCONF_PATH
    $sudo $signal -a -s HUP pmcd
    sleep 1
    _wait_for_pmcd || _exit 1
    pminfo -f pmcd.agent.type
done

grep ridiculous $PMCDLOG

# success, all done
status=0
exit