/var/lib/pcp/testsuite/457 is in pcp-testsuite 3.8.12ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #! /bin/sh
# PCP QA Test No. 457
# checks basic pmdalogger functionality
#
# Copyright (c) 2011 Aconex. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
. ./localconfig
[ -d $PCP_PMDAS_DIR/logger ] || _notrun "No pmdalogger installed"
[ $PCP_VER -ge 3610 ] || _notrun "Installed pmdalogger is too old"
_cleanup()
{
if $_needclean
then
_restore_pmda_install logger
if $install_on_cleanup
then
( cd $PCP_PMDAS_DIR/logger; $sudo ./Install <$tmp.input >/dev/null 2>&1 )
else
( cd $PCP_PMDAS_DIR/logger; $sudo ./Remove </dev/null >/dev/null 2>&1 )
fi
_needclean=false
fi
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
exit $status
}
_testdata()
{
# generate data in a single write, for pmda determinism
echo \
"TeSt DaTa ... TeSt DaTa ...
TeSt2 DaTa2 ... TeSt2 DaTa2"
}
_filter()
{
sed \
-e "s,$tmp,TMPFILE,g" \
-e "s,$PCP_VAR_DIR,PCP_VAR_DIR,g" \
-e 's/[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]/TIMESTAMP/g'
}
_filter_dir()
{
# size is filesystem and blocksize dependent
_filter | sed '/^logger\.perfile\.dir\.size$/ {
N
s:[0-9][0-9]*:SIZE:
}'
}
$sudo rm -fr $tmp.dir
$sudo rm -f $tmp.*
# setup pmdalogger configuration file
echo "
# from PCP QA $seq
reg n $tmp.reg
fifo n $tmp.fifo
none n $tmp.none
empty n $tmp.empty
dir n $tmp.dir
pipe n $tmp.pipe|
" >$tmp.conf
# and PMDA Install script
cat >$tmp.input <<End-of-File
b
1
End-of-File
install_on_cleanup=false
pminfo logger >/dev/null 2>&1 && install_on_cleanup=true
status=1 # failure is the default!
_needclean=true
trap "_cleanup" 0 1 2 3 15
# real QA test starts here
_prepare_pmda_install logger
# prepare test case files (see below)
_testdata > $tmp.reg
mkdir $tmp.dir
mkfifo $tmp.fifo
touch $tmp.empty
$PCP_ECHO_PROG $PCP_ECHO_N "#!/bin/sh
echo \$\$ > $tmp.pipe.pid
trap \"echo child\" USR1
read book
""$PCP_ECHO_C" > $tmp.pipe # i.e. print something when sigusr1 delivered
chmod 755 $tmp.pipe
[ -d $PCP_VAR_DIR/config/logger ] || $sudo mkdir -p $PCP_VAR_DIR/config/logger
$sudo cp $tmp.conf $PCP_VAR_DIR/config/logger/logger.conf
# install PMDA accepting the defaults (esp config file)
$sudo ./Remove < /dev/null >/dev/null 2>&1
$sudo ./Install < /dev/null >$tmp.out 2>&1
cat $tmp.out | _filter_pmda_install | _filter
echo
echo "=== 1. simple working case ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Checking initial data:""$PCP_ECHO_C"
pminfo -f logger.perfile.reg | _filter
_testdata >> $tmp.reg
$PCP_ECHO_PROG $PCP_ECHO_N "Checking appended data:""$PCP_ECHO_C"
pminfo -f logger.perfile.reg | _filter
echo
echo "=== 2. named pipe (fifo) ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Check initial pipe""$PCP_ECHO_C"
pminfo -f logger.perfile.fifo | _filter
$PCP_ECHO_PROG $PCP_ECHO_N "Checking new pipe data""$PCP_ECHO_C"
_testdata >> $tmp.fifo
pminfo -f logger.perfile.fifo | _filter
$PCP_ECHO_PROG $PCP_ECHO_N "Unlink the fifo""$PCP_ECHO_C"
rm -f $tmp.fifo
pminfo -f logger.perfile.fifo | _filter
echo
echo "=== 3. log file rotation ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Checking removed file""$PCP_ECHO_C"
rm -f $tmp.reg
sleep 3 # pmda interval timer is 2 seconds
pminfo -f logger.perfile.reg | _filter
$PCP_ECHO_PROG $PCP_ECHO_N "Checking new log file""$PCP_ECHO_C"
_testdata >> $tmp.reg
sleep 3 # pmda interval timer is 2 seconds
pminfo -f logger.perfile.reg | _filter
echo
echo "=== 4. non-existant file ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Check a missing file""$PCP_ECHO_C"
pminfo -f logger.perfile.none | _filter
_testdata >> $tmp.none
sleep 3 # pmda interval timer is 2 seconds
$PCP_ECHO_PROG $PCP_ECHO_N "Checking new log file""$PCP_ECHO_C"
pminfo -f logger.perfile.none | _filter
echo
echo "=== 5. empty file ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Check an empty file""$PCP_ECHO_C"
pminfo -f logger.perfile.empty | _filter
_testdata >> $tmp.empty
sleep 3 # pmda interval timer is 2 seconds
$PCP_ECHO_PROG $PCP_ECHO_N "Checking new log file""$PCP_ECHO_C"
pminfo -f logger.perfile.empty | _filter
echo
echo "=== 6. directory ==="
$PCP_ECHO_PROG $PCP_ECHO_N "Check a directory""$PCP_ECHO_C"
pminfo -f logger.perfile.dir | _filter_dir
echo
echo "=== 7. command pipe ==="
[ -f $tmp.pipe.pid ] || _fail "PID file from command pipe not found"
pid=`cat $tmp.pipe.pid`
$PCP_ECHO_PROG $PCP_ECHO_N "Check a piped command""$PCP_ECHO_C"
pminfo -f logger.perfile.pipe | _filter
$PCP_ECHO_PROG $PCP_ECHO_N "Signal the command""$PCP_ECHO_C"
pmsignal -s USR1 $pid >/dev/null 2>&1
sleep 3 # some time for it to be delivered
pminfo -f logger.perfile.pipe | _filter
status=0
exit
|