/var/lib/pcp/testsuite/344 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 | #!/bin/sh
# PCP QA Test No. 344
#
# exercise __pmLocalPMDA functionality
#
# Copyright (c) 2010 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
grep __pmLocalPMDA $PCP_DIR/usr/include/pcp/impl.h >/dev/null || \
_notrun "No libpcp support for __pmLocalPMDA"
rm -f $seq.out
if [ $PCP_VER -lt 3600 ]
then
ln $seq.out.1 $seq.out || exit 1
elif [ $PCP_VER -lt 3611 ]
then
ln $seq.out.2 $seq.out || exit 1
else
ln $seq.out.3 $seq.out || exit 1
fi
status=0 # success is the default!
host=`hostname`
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
cat <<End-of-File >$tmp.pmns
root {
qa
sample
tmpsample
}
qa {
pid 400:0:1
colour 400:0:5
bin 400:0:6
string
}
qa.string {
write_me 400:0:29
}
sample {
colour 30:0:5
bin 30:0:6
string
}
sample.string {
write_me 30:0:29
}
tmpsample {
colour 130:0:5
bin 130:0:6
string
}
tmpsample.string {
write_me 130:0:29
}
End-of-File
_filter()
{
tee -a $seq.full \
| sed \
-e "/^pmWhichContext/d" \
-e "/^pmNewContext/d" \
-e "/^Dump /d" \
-e "/^Context\[/d" \
-e "/^Local Context PMDA Table/d" \
-e "s;$tmp;TMP;g" \
-e "s/host: @/host: HOST/g" \
-e "s/host: $host/host: HOST/g" \
-e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \
-e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;" \
-e "s/\.$DSO_SUFFIX/.\$DSO_SUFFIX/g" \
-e '/^0*x*[0-9a-f][0-9a-f]* /d' \
-e '/^\[[0-9][0-9]*]/d' \
-e '/^__pmLocalPMDA(/d'
}
# -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \
# -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;g" \
# real QA test starts here
pminfo -fL -n $tmp.pmns -K clear -K add,400,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init qa.colour
echo
pminfo -fL -n $tmp.pmns -K clear -K add,400,$PCP_VAR_DIR/pmdas/sample/pmda_sample,sample_init qa.pid >$tmp.out &
expect=$!
wait
got=`sed -n -e '/value/s/.*value //p' $tmp.out`
if [ "$got" != "$expect" ]
then
echo "Error: expecting pid $expect, got $got from"
cat $tmp.out
else
echo "PID check passes"
fi
echo
echo "=== expect no sample metrics ==="
pminfo -fmL -n $tmp.pmns -K clear -K add,400,sample/pmda_sample.$DSO_SUFFIX,sample_init qa.colour sample.colour
echo
echo "=== sample metrics this time ==="
# need to copy DSO so running sample_init() only once per DSO
cp $PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX $tmp.$DSO_SUFFIX
export PMDA_LOCAL_SAMPLE=yes
$sudo pminfo -fmL -n $tmp.pmns -K add,400,$tmp.$DSO_SUFFIX,sample_init qa.colour sample.colour
echo
echo "=== -K spec parsing in pminfo ==="
for spec in \
clear clear, clear,400 clear,400, clear,400,$tmp.$DSO_SUFFIX clear,400,$tmp.$DSO_SUFFIX, \
clear,400,$tmp.$DSO_SUFFIX,sample_init clear,,$tmp.$DSO_SUFFIX,sample_init clear,,,sample_init \
clear,,$tmp.$DSO_SUFFIX,sample_init clear,400,,sample_init \
add add, add,400 add,400, add,400,$tmp.$DSO_SUFFIX add,400,$tmp.$DSO_SUFFIX, \
add,400,$tmp.$DSO_SUFFIX,sample_init \
del del, del,30 del,30, del,,sample/pmda_sample.$DSO_SUFFIX \
del,30,sample/pmda_sample.$DSO_SUFFIX, \
del,30,sample/pmda_sample.$DSO_SUFFIX,sample_init \
del,, del,,, del,,,sample_init
do
echo "+++ -K $spec +++" | _filter
$sudo pminfo -Dcontext -fmL -n $tmp.pmns -K $spec \
sample.string.write_me qa.string.write_me 2>&1 \
| _filter
done
echo
echo "=== some __pmLocalPMDA() exercises ==="
pminfo -Dcontext -fmL -n $tmp.pmns -K clear \
-K add,30,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \
-K add,400,$tmp.$DSO_SUFFIX,sample_init \
-K del,30,0,0 \
-K clear \
-K add,30,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \
-K del,0,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,0 \
-K add,130,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \
-K add,400,$tmp.$DSO_SUFFIX,sample_init \
tmpsample.bin 2>&1 \
| _filter
echo
echo "=== other tools than know about -K ..."
pmval -s 3 -t 0.1 -K clear -K add,30,$PCP_PMDAS_DIR/sample/pmda_sample.$DSO_SUFFIX,sample_init '@:sampledso.bin["bin-100","bin-900"]' | _filter
echo
pmprobe -K clear -K add,30,$PCP_PMDAS_DIR/sample/pmda_sample.$DSO_SUFFIX,sample_init -I sampledso.bin
# success, all done
exit
|