diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/709 | |
download | pcp-47e6e7c84f008a53061e661f31ae96629bc694ef.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/709')
-rwxr-xr-x | qa/709 | 116 |
1 files changed, 116 insertions, 0 deletions
@@ -0,0 +1,116 @@ +#!/bin/sh +# PCP QA Test No. 709 +# Exercise the python collectl implementation +# +# Copyright (c) 2012-2014, Red Hat. +# + +seq=`basename $0` +echo "QA output created by $seq" + +# get standard environment, filters and checks +. ./common.product +. ./common.filter +. ./common.check + +status=0 # success is the default! +$sudo rm -fr $tmp.* $seq.full +trap "cd $here; rm -fr $tmp.*; exit \$status" 0 1 2 3 15 + +remove_extra_whitespace() +{ + sed \ + -e 's/>>>.*<<<//g' \ + -e 's/[0-9]/9/g' \ + -e 's/9[9]*/9/g' \ + -e 's/ *$//' \ + -e '/^ *$/d' \ + -e 's/ */ /g' \ + -e 's/^ *//' \ + -e 's/RECORD.*$/RECORD/' \ + -e 's/<-*Int/<-Int/' \ + -e 's/Int-*>/Int->/' \ + # end +} + +remove_extra_columns() +{ + sed \ + -e 's/^ *//' \ + -e 's/ [a-zA-Z0-9 ]* *$//' \ + -e 's/^#<-*-/#<--/g' \ + -e 's/-*->/--->/g' \ + # end +} + +# using a given metric (arg1), check that each of its instances +# exists in output file (arg2). +# +check_instances() +{ + metric=$1 + file=$2 + eval set -- `pmprobe -I $metric` + [ $? -eq 0 ] || exit 1 + shift # skip metric name + shift # skip instance count + while [ $# -gt 0 ] + do + instance="$1" + shift + grep -q "$instance" $file && continue + echo "Instance $instance of $metric is missing from $file!" + done +} + +# real QA test starts here +mkdir $tmp.$seq +cd $tmp.$seq + +#PYCOLLECTL=pmcollectl.py # developer version +PYCOLLECTL=pmcollectl # installed version +args="-c 2 -i 0.1" +$PYCOLLECTL $args -sc | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sd | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sn | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sj | remove_extra_whitespace | remove_extra_columns | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sm | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sc --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sd --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sn --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -sm --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 + +$PYCOLLECTL $args -sN > $tmp.net 2>&1 +check_instances network.interface.total.bytes $tmp.net + +$PYCOLLECTL $args -sD > $tmp.disk 2>&1 +check_instances disk.dev.total_bytes $tmp.disk + +# need a generic way to test these on any system +# $PYCOLLECTL $args -sC | remove_extra_whitespace | tee -a $tmp.out 2>&1 +# $PYCOLLECTL $args -sJ | remove_extra_whitespace | tee -a $tmp.out 2>&1 +# $PYCOLLECTL $args -sCD | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -scd | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $args -scd --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 + +# test playback +interval=0.1 +$PYCOLLECTL -sdDcCnNjJm -f test.pmcollectl -c10 -i $interval +logargs="-c 2 -i $interval -p test.pmcollectl" +$PYCOLLECTL $logargs -sd | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sc | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sn | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sm | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sd --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sc --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sn --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PYCOLLECTL $logargs -sm --verbose | remove_extra_whitespace | tee -a $tmp.out 2>&1 +cat $tmp.out >>$here/$seq.full + +eval `pmafm test.pmcollectl remove` + +# success, all done +status=0 +exit |