Drop unused condition check
[pcp.git] / qa / 520
blob071c9f5075d70282a2de5c377e173922cf8c7d06
1 #!/bin/sh
2 # PCP QA Test No. 520
4 # pmie - lots of expressions, checking pmie -d output and %v binding
5 # - multihost cases, see also QA 514
7 # Copyright (c) 2012 Ken McDonell. All Rights Reserved.
10 seq=`basename $0`
11 echo "QA output created by $seq"
13 # get standard filters
14 . ./common.product
15 . ./common.filter
16 . ./common.check
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
22 _filter()
24 sed \
25 -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/' \
26 -e 's/DATE [12][0-9][0-9][0-9]/DATE/' \
27 -e '/evaluator exiting/s/pmie([0-9][0-9]*)/pmie(PID)/' \
28 -e '/Performance Co-Pilot Inference Engine/s/Version .*/Version .../'
31 # mapping to 0x0 -> (nil) needed for C compilers that don't do the
32 # (nil) translation automatically for a printf %p
34 _filter2()
36 sed \
37 -e 's/0x0\([ (]\)/(nil)\1/g' \
38 -e 's/0x0$/(nil)/' \
39 | $PCP_AWK_PROG '
40 $1 == "pmie:" { print; next }
41 /failed: / { print; next }
42 $1 == "bundle:" { skip=1 }
43 skip == 1 { if ($1 == "Rule:") skip = 0 }
44 skip == 1 { next }
45 { print }' >$tmp.tmp
46 tr ' =' '\012' <$tmp.tmp \
47 | grep '0x' \
48 | $PCP_AWK_PROG >$tmp.sed '
49 BEGIN { n = 0 }
50 { if (seen[$1] == 1) next
51 printf "s/%s/ADDR%03d/\n",$1,n
52 n++
53 seen[$1] = 1
55 sed -f $tmp.sed <$tmp.tmp
58 cat <<'End-of-File' >$tmp.pmie
59 hosts = ":vm00 :vm01 :vm02 :vm03";
60 some_host sampledso.drift $hosts > 0 -> print "some_host:" " @%h %v";
61 all_host 10 * sampledso.drift $hosts == sampledso.ulong.ten $hosts * sampledso.drift $hosts -> print "all_host:" " @%h %v";
62 25%_host (hinv.physmem $hosts / (1024*1024)) > 512 -> print "25%_host:" " @%h %v";
63 min_host hinv.physmem $hosts == 239 * 1024 Kbyte -> print "min_host:" " @%h %v";
64 max_host sampledso.colour $hosts #'red' < max_host max_inst (sampledso.colour $hosts) -> print "max_host:" " @%h %v";
65 sum_host hinv.ncpu $hosts == hinv.ncpu :vm00 + hinv.ncpu :vm01 + hinv.ncpu :vm02 + hinv.ncpu :vm03 -> print "sum_host:" " @%h %v";
66 avg_host min_inst sampledso.bin $hosts == 100 -> print "avg_host:" " @%h [%i] %v";
67 count_host (some_inst sampledso.part_bin > 300) > 0 -> print "count_host:" " @%h [%i] %v";
68 End-of-File
70 # real QA test starts here
71 cat <<End-of-File | pmie -t 2sec -d -Dappl1 -a archives/multi-vm00 -a archives/multi-vm01 -a archives/multi-vm02 -a archives/multi-vm03 >$tmp.out 2>$tmp.err &
72 f $tmp.pmie
74 r 10sec
76 End-of-File
78 wait
80 # strange but true ... sometimes don't need an echo here to deal
81 # with the pmie> (and no newline) prompt ...
83 case $PCP_PLATFORM
85 darwin)
86 : no
89 : yes
90 echo >>$tmp.out
92 esac
94 echo >>$seq.full
95 echo "pmie PID $!" >>$seq.full
96 echo >>$seq.full
97 echo "=== pmie output ===" >>$seq.full
98 cat $tmp.out >>$seq.full
99 echo >>$seq.full
100 echo "=== pmie errors ===" >>$seq.full
101 cat $tmp.err >>$seq.full
103 _filter2 <$tmp.err | _filter
104 _filter <$tmp.out
106 # success, all done
107 status=0
108 exit