3 # Exercise the python collectl implementation
5 # Copyright (c) 2012-2014, Red Hat.
9 echo "QA output created by $seq"
13 [ -f common.python
] || _notrun
"Testsuite built without python support"
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
()
30 -e 's/RECORD.*$/RECORD/' \
31 -e 's/<-*Int/<-Int/' \
32 -e 's/Int-*>/Int->/' \
36 remove_extra_columns
()
40 -e 's/ [a-zA-Z0-9 ]* *$//' \
41 -e 's/^#<-*-/#<--/g' \
46 # using a given metric (arg1), check that each of its instances
47 # exists in output file (arg2).
53 eval set -- `pmprobe -I $metric`
54 [ $?
-eq 0 ] ||
exit 1
55 shift # skip metric name
56 shift # skip instance count
61 grep -q "$instance" $file && continue
62 echo "Instance $instance of $metric is missing from $file!"
68 echo |
tee -a $here/$seq.full
69 echo "=== $* ===" |
tee -a $here/$seq.full
71 |
tee -a $here/$seq.full \
72 | remove_extra_whitespace
75 # real QA test starts here
79 PYCOLLECTL
=pmcollectl.py
# developer version
80 which $PYCOLLECTL >/dev
/null
2>&1
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"
93 _run
$args -sj | remove_extra_columns
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
113 _run
$args -scd --verbose
117 $PYCOLLECTL -sdDcCnNjJm -f test.pmcollectl
-c10 -i $interval
118 logargs
="-c 2 -i $interval -p test.pmcollectl"
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`