diff options
Diffstat (limited to 'qa/722')
-rw-r--r-- | qa/722 | 86 |
1 files changed, 86 insertions, 0 deletions
@@ -0,0 +1,86 @@ +#!/bin/sh +# PCP QA Test No. 722 +# Exercise the python pmatop implementation +# +# Copyright (c) 2013-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 -f $tmp.* $seq.full +trap "rm -f $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\.e]*/9/g' \ + -e 's/ *$//' \ + -e '/^ *$/d' \ + -e 's/ */ /g' \ + -e 's/^ *//' \ + -e 's/RECORD.*$/RECORD/' \ + +} + +redact_lines() +{ + $PCP_AWK_PROG -v f=$1 ' +BEGIN {first_cpu=1;first_dsk=1;first_lvm=1;proc_printed=0} +/^9/ {if (! proc_printed) { + gsub("[SR]","x",$10) + gsub("[a-zA-Z_][a-zA-Z_]+","userid",$6) + gsub("[a-zA-Z_][a-zA-Z_]+","process",$9) + gsub("[a-zA-Z_][a-zA-Z_]+","process",$12) + if ($2 != "9K") $2="HHMMSS" + if ($3 != "9K") $3="HHMMSS" + proc_printed = 1 + print $0} + next} +/cpu/ {if (first_cpu) {print $0; first_cpu=0}; next} +/PRC/ {$4 = "HHMMSS";$7 = "HHMMSS"} +/DSK/ {if (first_dsk) {$3 = "DISKNAME"; print $0; first_dsk=0}; next} +/LVM/ {if (first_lvm) {gsub("[a-zA-Z0-9_-]*","x",$3);print $0; first_lvm=0;}; next} +/NET/ {if ($3 == "transport" || $3 == "network") {print $0}; next} +/ATOP/ {gsub("[A-Za-z]*","Day",$3);gsub("[A-Za-z]*","Month",$4)} + {print $0}' +} + +redact_header() +{ + $PCP_AWK_PROG -v f=$1 ' +/ATOP/ {gsub("[A-Za-z]*","Day",$3);gsub("[A-Za-z]*","Month",$4)} +/LVM/ {gsub("[a-zA-Z0-9_-]*","x",$3);print $0; next} + {print $0}' +} + +PMATOP=pmatop.py # local version, wont be there on installed system +which $PMATOP >/dev/null 2>&1 +if [ $? -ne 0 ]; then + PMATOP=pmatop + which $PMATOP >/dev/null 2>&1 || _notrun "pmatop not installed" +fi + +# real QA test starts here +$PMATOP -r $here/src/pmatop-log.folio -m 1 1 | redact_header | remove_extra_whitespace | tee -a $tmp.out 2>&1 +$PMATOP -r $here/src/pmatop-log.folio -g 1 1 | redact_header | remove_extra_whitespace | tee -a $tmp.out 2>&1 + +$PMATOP -w test.pmatop 0.2 10 +if pmafm test.pmatop check | grep -q OK +then echo pmatop log creation OK | tee -a $tmp.out 2>&1 +else echo pmatop log creation FAILED | tee -a $tmp.out 2>&1; fi + +cat $tmp.out >>$here/$seq.full + +# success, all done +eval `pmafm test.pmatop remove` +status=0 +exit |