Drop unused condition check
[pcp.git] / qa / 709
blobdc87f550ca576f8b68c84f0cb18bb35aac858536
1 #!/bin/sh
2 # PCP QA Test No. 709
3 # Exercise the python collectl implementation
5 # Copyright (c) 2012-2014, Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 . ./common.check
12 . ./common.setup
13 [ -f common.python ] || _notrun "Testsuite built without python support"
15 . ./common.python
16 status=0 # success is the default!
17 $sudo rm -fr $tmp.* $seq.full
18 trap "cd $here; rm -fr $tmp.*; exit \$status" 0 1 2 3 15
20 remove_extra_whitespace()
22 sed \
23 -e 's/>>>.*<<<//g' \
24 -e 's/[0-9]/9/g' \
25 -e 's/9[9]*/9/g' \
26 -e 's/ *$//' \
27 -e '/^ *$/d' \
28 -e 's/ */ /g' \
29 -e 's/^ *//' \
30 -e 's/RECORD.*$/RECORD/' \
31 -e 's/<-*Int/<-Int/' \
32 -e 's/Int-*>/Int->/' \
33 # end
36 remove_extra_columns()
38 sed \
39 -e 's/^ *//' \
40 -e 's/ [a-zA-Z0-9 ]* *$//' \
41 -e 's/^#<-*-/#<--/g' \
42 -e 's/-*->/--->/g' \
43 # end
46 # using a given metric (arg1), check that each of its instances
47 # exists in output file (arg2).
49 check_instances()
51 metric=$1
52 file=$2
53 eval set -- `pmprobe -I $metric`
54 [ $? -eq 0 ] || exit 1
55 shift # skip metric name
56 shift # skip instance count
57 while [ $# -gt 0 ]
59 instance="$1"
60 shift
61 grep -q "$instance" $file && continue
62 echo "Instance $instance of $metric is missing from $file!"
63 done
66 _run()
68 echo | tee -a $here/$seq.full
69 echo "=== $* ===" | tee -a $here/$seq.full
70 $PYCOLLECTL $* 2>&1 \
71 | tee -a $here/$seq.full \
72 | remove_extra_whitespace
75 # real QA test starts here
76 mkdir $tmp.$seq
77 cd $tmp.$seq
79 PYCOLLECTL=pmcollectl.py # developer version
80 which $PYCOLLECTL >/dev/null 2>&1
81 if [ $? -ne 0 ]; then
82 PYCOLLECTL=pmcollectl # installed version
83 which $PYCOLLECTL >$tmp.cmd 2>&1 || _notrun "pmcollectl not installed"
84 PYCOLLECTL=`cat $tmp.cmd`
85 PYCOLLECTL="$python $PYCOLLECTL"
88 args="-c 2 -i 0.1"
90 _run $args -sc
91 _run $args -sd
92 _run $args -sn
93 _run $args -sj | remove_extra_columns
94 _run $args -sm
95 _run $args -sc --verbose
96 _run $args -sd --verbose
97 _run $args -sn --verbose
98 _run $args -sm --verbose
100 $PYCOLLECTL $args -sN > $tmp.net 2>&1
101 check_instances network.interface.total.bytes $tmp.net
103 $PYCOLLECTL $args -sD > $tmp.disk 2>&1
104 check_instances disk.dev.total_bytes $tmp.disk
106 # need a generic way to test these on any system
107 #_run $args -sC
108 #_run $args -sJ
109 #_run $args -sCD
110 _run $args
111 _run $args --verbose
112 _run $args -scd
113 _run $args -scd --verbose
115 # test playback
116 interval=0.1
117 $PYCOLLECTL -sdDcCnNjJm -f test.pmcollectl -c10 -i $interval
118 logargs="-c 2 -i $interval -p test.pmcollectl"
119 _run $logargs -sd
120 _run $logargs -sc
121 _run $logargs -sn
122 _run $logargs -sm
123 _run $logargs -sd --verbose
124 _run $logargs -sc --verbose
125 _run $logargs -sn --verbose
126 _run $logargs -sm --verbose
128 eval `pmafm test.pmcollectl remove`
130 # success, all done
131 status=0
132 exit