/var/lib/pcp/testsuite/486 is in pcp-testsuite 4.0.1-1.
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 | #!/bin/sh
# PCP QA Test No. 486
# pmlogrewrite - simple rewriting cases
#
# Copyright (c) 2011 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
which pmlogrewrite >/dev/null 2>&1 || _notrun "pmlogrewrite not installed"
status=0 # success is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s;$tmp;TMP;g" \
-e "s/^\([+-][+-][+-] TMP\...t*\).*/\1/"
}
# 1.80.15 (disk.dev.bytes):
# inst [339 or "dks9d1"] value 179031
_f1_old()
{
$PCP_AWK_PROG '
$2 == "(disk.dev.bytes):" { xlate=1; print; next }
xlate == 1 && NF == 6 { $6 = int(($6 + 512)/1024) }
{ print }
xlate == 1 && NF != 6 { xlate = 0 }'
}
_f1_new()
{
$PCP_AWK_PROG '
$2 == "(disk.dev.bytes):" { xlate=1; print; next }
xlate == 1 && NF == 6 { $6 = $6 }
{ print }
xlate == 1 && NF != 6 { xlate = 0 }'
}
_cmp()
{
if [ ! -f "$1.0" ]
then
echo "Arrgh ... $1.0 missing" | _filter
return
fi
if [ ! -f "$2.0" ]
then
echo "Arrgh ... $2.0 missing" | _filter
return
fi
pmdumplog -z -dilmst $1 | tee -a $seq.full >$tmp.in
pmdumplog -z -dilmst $2 | tee -a $seq.full >$tmp.out
echo "pmdumplog diffs ..."
diff -u $tmp.in $tmp.out | _filter
[ -z "$filter_new" -a -z "$filter_old" ] && return
if [ ! -z "$filter_old" ]
then
$filter_old <$tmp.in >$tmp.tmp
echo >>$seq.full
echo "--- after $filter_old ---" >>$seq.full
cat $tmp.tmp >>$seq.full
mv $tmp.tmp $tmp.in
fi
if [ ! -z "$filter_new" ]
then
$filter_new <$tmp.out >$tmp.tmp
echo >>$seq.full
echo "--- after $filter_new ---" >>$seq.full
cat $tmp.tmp >>$seq.full
mv $tmp.tmp $tmp.out
fi
echo
echo "FILTERED pmdumplog diffs ..."
diff -u $tmp.in $tmp.out | _filter
}
# real QA test starts here
sed -e '/^#/d' <<End-of-File | while read arch_args spec
# archive[|arg1[|arg2[|...]]] spec
# rewrite pmDesc and pmid in pmResults
archives/mirage metric sample.bin { pmid->42.42.42 }
# name is 3 bytes shorter
archives/mirage metric sample.bin { name -> sam.bin }
# name is 10 bytes longer
archives/mirage metric sample.bin { name -> x23456789.sample.bin }
# inst renumbering
archives/mirage indom 29.2 { inst 300 -> 42 }
archives/mirage indom 29.2 { inst 300 -> 400 }
archives/mirage indom 29.2 { iname "bin-700" -> "bin-900" }
archives/mirage indom 29.2 { iname "bin-700" -> "bin-900 and some" }
archives/mirage indom 29.2 { iname "bin-300" -> "bin-100" inst 300 -> 100 }
archives/src-rattle indom 1.5 { iname "1 minute" -> "5" }
archives/src-rattle indom 1.5 { iname "5 minute" -> "15 doo dah" }
archives/src-rattle indom 1.5 { iname "5" -> "5 hours" }
# all metric semantics
archives/mirage metric 29.*.* { sem->DISCRETE } metric pmcd.pmlogger.port { sem->COUNTER }
# scale conversion
archives/src-snort-disks metric disk.dev.bytes { units->1,0,0,MBYTE,0,0 }
archives/src-snort-disks|-s metric disk.dev.bytes { units->1,0,0,MBYTE,0,0 }
archives/src-snort-disks metric disk.dev.bytes { units->1,-1,0,Kbyte,Sec,0 }
archives/src-snort-disks|-ws metric disk.dev.bytes { units->1,-1,0,kbyte,sec,0 }
archives/sample_expr metric sample.scale_step.time_up_secs { units->0,1,0,0,MSEC,0 }
# type conversion
# 32 ->
archives/mirage metric sample.drift { type -> U32 }
archives/mirage metric sample.drift { type -> 64 }
# double ->
archives/sample_expr metric sample.scale_step.time_up_secs { type -> FLOAT }
archives/sample_expr metric sample.scale_step.time_up_secs { type -> U32 }
# indom changes
archives/src-rattle metric pmcd.pmlogger.archive { indom -> 2.99 } indom 2.1 { indom -> 2.99 }
archives/src-rattle metric hinv.ndisk { indom -> 1.5 }
archives/src-rattle metric hinv.ndisk { indom -> 1.5 output inst 5 }
archives/ok-foo metric sample.colour { indom -> NULL }
archives/ok-foo metric sample.colour { indom -> NULL output first }
archives/ok-foo metric sample.colour { indom -> NULL output inst 1 }
archives/ok-foo metric sample.colour { indom -> NULL output last }
archives/ok-foo metric sample.colour { indom -> NULL output min }
archives/ok-foo metric sample.colour { indom -> NULL output max }
archives/ok-foo metric sample.colour { indom -> NULL output sum }
archives/ok-foo metric sample.colour { indom -> NULL output avg }
archives/sample_expr metric sample.mirage_longlong {indom->NULL}
archives/sample_expr metric sample.mirage_longlong {indom->NULL output last}
End-of-File
do
echo | tee -a $seq.full
echo "$spec" >$tmp.config
echo "=== `cat $tmp.config` ===" | tee -a $seq.full
rm -f $tmp.new.*
arch=`echo "$arch_args" | sed -e 's/|.*//'`
args=`echo "$arch_args" | sed -n -e '/|/s/.*|//p'`
pmlogrewrite -w -c $tmp.config $args $arch $tmp.new 2>&1 | _filter
filter_old=''
filter_new=''
case "$arch_args"
in
'archives/src-snort-disks|-s')
filter_old=_f1_old
filter_new=_f1_new
;;
esac
_cmp $arch $tmp.new
done
# success, all done
exit
|