Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 587
blob70bbd2fac8859a56249ba65990ad975432a82bc0
1 #! /bin/sh
2 # PCP QA Test No. 587
3 # pmcd long line handling error
4 # #754795 - pmcd botches handling of long lines in pmcd.conf
6 # Copyright (c) 1995-2002 Silicon Graphics, Inc. All Rights Reserved.
9 seq=`basename $0`
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
13 . ./common.product
14 . ./common.filter
15 . ./common.check
17 [ -d $PCP_PMDAS_DIR/trivial ] || _notrun "trivial PMDA directory is not installed"
19 rm -f $seq.out
20 case $PCP_PLATFORM
22 linux|darwin|solaris|freebsd)
23 ln $seq.$PCP_PLATFORM $seq.out || exit 1
26 _notrun "Need qualified output for $PCP_PLATFORM"
28 esac
30 signal=$PCP_BINADM_DIR/pmsignal
31 status=1 # failure is the default!
33 install_on_cleanup=false
34 pminfo trivial >/dev/null 2>&1 && install_on_cleanup=true
36 trap "_cleanup; exit \$status" 0 1 2 3 15
38 _cleanup()
40 ( cd $PCP_PMDAS_DIR/trivial ; $sudo $PCP_MAKE_PROG >/dev/null 2>&1 )
41 if $install_on_cleanup
42 then
43 ( cd $PCP_PMDAS_DIR/trivial; $sudo ./Install </dev/null >/dev/null 2>&1 )
44 else
45 ( cd $PCP_PMDAS_DIR/trivial; $sudo ./Remove >/dev/null 2>&1 )
47 if [ -f $PCP_PMCDCONF_PATH.$seq ]
48 then
49 echo
50 _restore_config $PCP_PMCDCONF_PATH
51 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
52 _wait_for_pmcd
53 else
54 $sudo $signal -a -s HUP pmcd
56 rm -f $tmp.*
57 if [ -d $PCP_LOG_DIR/pmcd ]
58 then
59 $sudo rm -f $PCP_LOG_DIR/pmcd/this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-*-bytes*
60 else
61 $sudo rm -f $PCP_LOG_DIR/this-is-not-a-filename-but-is-arbitrary-filler-to-make-the-lines-longer-than-*-bytes*
65 # default case
66 PMCDLOG=$PCP_LOG_DIR/pmcd/pmcd.log
68 case "$PCP_PLATFORM" in
70 linux)
71 cat >> $tmp.conf << EOF
72 # temporary pmcd.conf for qa/$seq
73 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
74 linux 60 dso linux_init $PCP_PMDAS_DIR/linux/pmda_linux.so
75 EOF
78 darwin)
79 cat >> $tmp.conf << EOF
80 # temporary pmcd.conf for qa/$seq
81 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.dylib
82 darwin 78 dso darwin_init $PCP_PMDAS_DIR/darwin/pmda_darwin.dylib
83 EOF
86 solaris)
87 cat >> $tmp.conf << EOF
88 # temporary pmcd.conf for qa/$seq
89 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
90 solaris 75 dso solaris_init $PCP_PMDAS_DIR/solaris/pmda_solaris.so
91 EOF
94 freebsd)
95 cat >> $tmp.conf << EOF
96 # temporary pmcd.conf for qa/$seq
97 pmcd 2 dso pmcd_init $PCP_PMDAS_DIR/pmcd/pmda_pmcd.so
98 freebsd 85 dso freebsd_init $PCP_PMDAS_DIR/freebsd/pmda_freebsd.so
99 EOF
103 echo "Arrgh ... need pmcd.conf for $PCP_PLATFORM"
104 exit 1
105 esac
107 _save_config $PCP_PMCDCONF_PATH
108 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
109 $sudo $PCP_RC_DIR/pcp restart | _filter_pcp_start
110 _wait_for_pmcd
112 unset ROOT MAKEFLAGS
113 cd $PCP_PMDAS_DIR/trivial
114 $sudo ./Install </dev/null >/dev/null
115 cd $here
117 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
119 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
121 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
123 cp $tmp.conf $tmp.conf+trivial
124 grep '^trivial' $PCP_PMCDCONF_PATH >>$tmp.conf+trivial
126 # real QA test starts here
127 for i in 1 2 3 4 5 6
129 echo
130 echo "=== Cycle $i ==="
131 echo "add trivial PMDA ..."
132 $sudo cp $tmp.conf+trivial $PCP_PMCDCONF_PATH
133 $sudo touch $PCP_PMCDCONF_PATH
134 $sudo $signal -a -s HUP pmcd
135 sleep 1
136 _wait_for_pmcd
137 pminfo -f pmcd.agent.type
138 echo "cull trivial PMDA ..."
139 $sudo cp $tmp.conf $PCP_PMCDCONF_PATH
140 $sudo touch $PCP_PMCDCONF_PATH
141 $sudo $signal -a -s HUP pmcd
142 sleep 1
143 _wait_for_pmcd
144 pminfo -f pmcd.agent.type
145 done
147 grep ridiculous $PMCDLOG
149 # success, all done
150 status=0
151 exit