#!/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/>>>.*<</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