/var/lib/pcp/testsuite/514 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 178 179 180 181 182 183 184 185 | #!/bin/sh
# PCP QA Test No. 514
#
# pmie - lots of expressions, checking pmie -d output and %v binding
# - see also QA 520
#
# Copyright (c) 2012 Ken McDonell. All Rights Reserved.
#
seq=`basename $0`
echo "QA output created by $seq"
# get standard filters
. ./common.product
. ./common.filter
. ./common.check
rm -f $seq.out
if [ $PCP_VER -lt 3702 ]
then
ln $seq.out.1 $seq.out || exit 1
else
ln $seq.out.2 $seq.out || exit 1
fi
status=1 # failure is the default!
$sudo rm -rf $tmp.* $seq.full
trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
LOCALHOST=`hostname`
case $PCP_PLATFORM
in
irix|linux|solaris)
# same syslog options for Irix, Linux and OpenSolaris
SYSLOG_OPT='"-p daemon.info"'
;;
darwin)
SYSLOG_OPT=''
;;
*)
echo "Arrgh ... need syslog option for $PCP_PLATFORM"
exit 1
;;
esac
SYSLOG=''
for f in /var/adm/SYSLOG /var/log/daemon.log /var/log/messages /var/log/syslog /var/log/system.log
do
if [ -f $f ]
then
SYSLOG=$f
break
fi
done
if [ -z "$SYSLOG" ]
then
echo "Arrgh! Cannot find your syslog file"
exit 1
fi
_filter()
{
sed \
-e "s/\([:@ ]\)$LOCALHOST/\1LOCALHOST/g" \
-e "s/\([:@ ]\)local:/\1LOCALHOST/g" \
-e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]/DATE/' \
-e 's/DATE [12][0-9][0-9][0-9]/DATE/' \
-e '/evaluator exiting/s/pmie([0-9][0-9]*)/pmie(PID)/' \
-e '/Performance Co-Pilot Inference Engine/s/Version .*/Version .../' \
-e 's/\[red] 1[0-9][0-9]/[red] >=100/' \
-e 's/\[green] 2[0-9][0-9]/[green] >=200/' \
-e 's/\[blue] 3[0-9][0-9]/[blue] >=300/'
}
_filter2()
{
$PCP_AWK_PROG '
$1 == "pmie:" { print; next }
/failed: / { print; next }
$1 == "initMetric:" { skip=1 }
skip == 1 { if ($1 == "Rule:") skip = 0 }
skip == 1 { next }
{ print }' >$tmp.tmp
tr ' =' '\012' <$tmp.tmp \
| grep '0x' \
| $PCP_AWK_PROG >$tmp.sed '
BEGIN { n = 0 }
{ if (seen[$1] == 1) next
printf "s/%s/ADDR%03d/\n",$1,n
n++
seen[$1] = 1
}'
sed -f $tmp.sed <$tmp.tmp
}
cat <<End-of-File >$tmp.pmie
some_inst sample.part_bin > 500 -> print "some > 500:" " [%i] %v";
all_inst sample.part_bin > 0 -> shell "echo 'all > 0:'" " [%i] %v";
some_sample hinv.ncpu @0..2 == hinv.ncpu -> syslog 10sec $SYSLOG_OPT "PCP QA $seq - please ignore: some sample ncpu equal" " [%i] %v";
( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "arith %v";
// true && true
sample.long.one != 2 && ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean1 %v";
// false && true
sample.long.one <= 0 && ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean2 %v";
// true && false
sample.long.one < 9 && ! ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean3 %v";
// false && false
sample.long.one < 1 && ! ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean4 %v";
// pmns error || true
min_inst no_such_metric == 100 || sample.long.million > 0 -> print "error1 %v";
// true || true
min_inst sample.part_bin == 100 || ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean5:" " [%i] %v";
// false || true
// NOTE instance bindings here will be for the _left_ subexpression
// (which is always false) ... this is odd but not unexpected
max_inst sample.part_bin == 100 || ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean6:" " [%i] %v";
// true || false
sum_inst sample.part_bin > 500 || ! ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean7:" " [%i] %v";
// false || false
avg_inst(sample.part_bin) == 0 || ! ( sample.long.million + sample.long.one - sample.long.ten ) * sample.long.hundred / sample.long.ten >= 0 -> print "boolean8:" " [%i] %v";
count_inst(sample.part_bin > 0) > 0 -> print "count_inst:" "[%i] %v";
some_inst match_inst "bin-[12345]" sample.part_bin > 100 -> print "match_inst:" " [%i] %v";
some_inst nomatch_inst "bin-[12345]" sample.part_bin > 200 -> print "nomatch_inst:" " [%i] %v";
// rising, falling - see QA 515
all_inst rate sample.bin == 0 -> print "rate:" " [%i] %v";
66%_inst sample.colour >= 200 -> print "66%_inst:" " [%i] %v";
all_sample sample.long.ten @0..2 == 10 -> print "all_sample: " " [%i] %v";
60%_sample some_inst sample.part_bin #'bin-300' #'bin-500' #'bin-700' @0..1 >= 500 -> print "60%_sample: " " [%i] %v";
min_sample sample.long.hundred @0..1 == 100 -> print "min_sample: " " [%i] %v";
max_sample sample.long.hundred @0..1 == 100 -> print "max_sample: " " [%i] %v";
sum_sample sample.bin #'bin-100' @0..3 == 400 -> print "sum_sample: " " [%i] %v";
avg_sample sample.bin #'bin-200' @0..1 == 200 -> print "avg_sample: " " [%i] %v";
count_sample(some_inst sample.bin #'bin-200' #'bin-300' #'bin-400' @0..2 == 300) == 3 -> print "count_sample: " " [%i] %v";
min_inst sample.part_bin > 0 -> print "min_inst:" " @%h [%i] %v";
max_inst sample.part_bin > 0 -> print "max_inst:" " @%h [%i] %v";
sample.long.one == 1 -> shell "false" | print "false |: %v";
sample.long.ten == 10 -> shell "true" & print "true &: %v";
sample.long.hundred == 100 -> print "print |:" " %v" | print "bozo don't execute me!";
// TODO at some other time ... alarm and stomp actions
End-of-File
# real QA test starts here
cat <<End-of-File | pmie -t 250msec -d -Dappl1 >$tmp.out 2>$tmp.err &
f $tmp.pmie
l
r 1sec
v
End-of-File
wait
echo >>$seq.full
echo "pmie PID $!" >>$seq.full
echo >>$seq.full
echo "=== pmie output ===" >>$seq.full
cat $tmp.out >>$seq.full
echo >>$seq.full
echo "=== pmie errors ===" >>$seq.full
cat $tmp.err >>$seq.full
_filter2 <$tmp.err | _filter
_filter <$tmp.out
echo
echo "SYSLOG ..."
$sudo tail -100 $SYSLOG >$tmp.tmp
sed <$tmp.tmp -n \
-e 's/PCP QA '"$seq"'/PCP QA xxx/' \
-e '/ncpu equal/s/ [0-9][0-9]*/ N/g' \
-e 's/PCP QA xxx/PCP QA '"$seq"'/' \
-e '/\['$!']: PCP QA '"$seq"' - please ignore/{
s/.*please ignore/.../
p
}' \
| LC_COLLATE=POSIX sort -u
echo >>$seq.full
echo "=== tail SYSLOG ===" >>$seq.full
cat $tmp.tmp >>$seq.full
# success, all done
status=0
exit
|