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
|
#!/bin/sh
# PCP QA Test No. 1462
# pmlogrewrite - indom <spec> { iname replace /re/ -> "replacement" }
#
# non-valgrind variant, see qa/1464 for the valgrind variant
#
# Copyright (c) 2023 Ken McDonell. All Rights Reserved.
#
if [ $# -eq 0 ]
then
seq=`basename $0`
echo "QA output created by $seq"
else
# use $seq from caller, unless not set
[ -n "$seq" ] || seq=`basename $0`
echo "QA output created by `basename $0` $*"
fi
# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check
do_valgrind=false
if [ "$1" = "--valgrind" ]
then
_check_valgrind
do_valgrind=true
elif [ "$PCPQA_VALGRIND" = "no" ]
then
:
elif which valgrind >/dev/null 2>&1
then
[ $PCPQA_VALGRIND = both ] || \
_notrun "valgrind variant qa/1464 will be run"
fi
_cleanup()
{
cd $here
$sudo rm -rf $tmp $tmp.*
}
status=0 # success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15
_filter()
{
sed \
-e "s@$tmp@TMP@g" \
# end
}
# real QA test starts here
# tmparch/sample-proc_v3 contains
# sample.proc.time
# Data Type: 64-bit unsigned int InDom: 29.12 0x740000c
# Semantics: counter Units: millisec
# and instances like ...
#
# 1 or "0001 init"
# 2 or "0002 /etc/bozo"
# 3 or "0003 /usr/bin/bobo"
# 4 or "0004 /usr/local/jester"
# 5 or "0005 /usr/opt/bin/loko"
# 8 or "0008 /usr/local/yobo"
# 9 or "0009 /usr/opt/bin/jojo"
# 10 or "0010 /etc/koko"
# 14 or "0014 /etc/jester"
# 15 or "0015 /usr/bin/loko"
# 16 or "0016 /usr/local/pierrot"
# 18 or "0018 /etc/yobo"
# 19 or "0019 /usr/bin/jojo"
# 20 or "0020 /usr/local/koko"
#
pmdumplog -i tmparch/sample-proc_v3 >$tmp.old
# 'indom 29.12 { iname "0018 /etc/yobo" -> "0018 /etc/YOBO" }' \
cat <<'End-of-File' | while read spec
indom 29.12 { iname replace /yobo/ -> "YOBO" }
indom 29.12 { iname replace "([0-9]+) .*/(.*)" -> "\\1 \\2" }
End-of-File
do
echo
printf "%s\n" "--- $spec ---"
cat <<End-of-File >$tmp.config
$spec
End-of-File
rm -f $tmp.0 $tmp.index $tmp.meta
if $do_valgrind
then
_run_valgrind pmlogrewrite -v -c $tmp.config tmparch/sample-proc_v3 $tmp
else
pmlogrewrite -v -c $tmp.config tmparch/sample-proc_v3 $tmp 2>&1
fi \
| _filter
pmdumplog -i $tmp >$tmp.new
diff $tmp.old $tmp.new
pminfo -a $tmp -f sample.proc.time \
| sed -e 's/value [0-9][0-9]*/value NN/'
done
# success, all done
exit
|