/var/lib/pcp/testsuite/246 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 | #!/bin/sh
# PCP QA Test No. 246
#
# Exercise derived metric memory allocation and freeing around the
# creating and destroying of contexts.
#
# Copyright (c) 2009 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
if grep -q 'pmRegisterDerived' $PCP_DIR/usr/include/pcp/pmapi.h
then
:
else
echo "No derived metric support" >$seq.notrun
echo "$seq: [not run] `cat $seq.notrun`"
exit 0
fi
unset PCP_DERIVED_CONFIG
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
# Note
# addresses from malloc are obviously dependent on the implementation
# but if there is no memory leaks, we expect the SAME addresses to be
# allocated over and over ... we're arbitrarily picking a pool of
# up to the first 40 unique addresses we encounter (see the variable
# PICK in the awk below) and this works for glibc 2.10.1 ... this
# number may need to be increased for other malloc implementations
#
_filter()
{
echo "--- stdout ---" >>$seq.full
cat $tmp.out >>$seq.full
echo "--- stderr ---" >>$seq.full
cat $tmp.err >>$seq.full
# __dmclosecontext(->ctx 8) called dm->0x9216d58 3 metrics
cat $tmp.err \
| sed \
-e 's/(->ctx [0-9][0-9]*)//' \
-e 's/->/ /' \
| awk >$tmp.sed '
BEGIN { n = 0; PICK = 40 }
$1 == "__dmclosecontext" { if (map[$4] != "") next
if (n >= PICK) next
print "s/" $4 "/<addr>/"
map[$4] = 1
n++
}
{ next }'
echo "=== sed ===" >>$seq.full
cat $tmp.sed >>$seq.full
sed <$tmp.err \
-e '/bind metric\[[12]] myname.[bc]/d' \
-e '/bind metric\[0] myname.a/{
s/bind metric... //
s/$/ .../
}' \
-e '/__dmopencontext/s/__dmopencontext:/open/' \
-e '/__dmclosecontext/s/__dmclosecontext(->ctx [0-9][0-9]*) called dm->/close /' \
-e "s;$tmp;TMP;" \
| sed -f $tmp.sed
cat $tmp.out
}
# real QA test starts here
cat <<End-of-File >$tmp.config
myname.a = sample.long.one + sample.long.ten + sample.long.hundred + sample.long.million + sample.longlong.one + sample.longlong.ten + sample.longlong.hundred + sample.longlong.million
myname.b = sample.long.one + sample.long.ten + sample.long.hundred + sample.long.million - sample.longlong.one - sample.longlong.ten - sample.longlong.hundred - sample.longlong.million
myname.c= sample.long.one * sample.longlong.one + sample.long.ten * sample.longlong.ten + sample.long.hundred * sample.longlong.hundred + sample.long.million * sample.longlong.million
End-of-File
src/grind_ctx -D derive -c $tmp.config -s 100 >$tmp.out 2>$tmp.err
_filter
# success, all done
exit
|