#!/bin/sh # PCP QA Test No. 382 # check dbpmda does the right thing when contexts are opened and # closed # # Copyright (c) 2010 Ken McDonell. All Rights Reserved. # seq=`basename $0` echo "QA output created by $seq" # get standard environment, filters and checks . ./common.product . ./common.filter . ./common.check rm -f $seq.out if [ $PCP_VER -lt 3600 ] then ln $seq.out.1 $seq.out else ln $seq.out.2 $seq.out fi status=0 # success is the default! username=`id -u -n` $sudo rm -rf $tmp.* $seq.full trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 _filter() { sed \ -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;g" \ -e 's/\.'"$DSO_SUFFIX"'/.$DSO_SUFFIX/g' \ -e "s;$tmp;\$tmp;g" \ -e 's/[A-Z][a-z][a-z] [A-Z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/' \ -e "s/`hostname`/LOCALHOST/" \ -e "s/ -U $username//g" \ -e '/pmResult/s/ from .*/ .../' \ -e 's/\(value.*\) 0x[0-9a-f][0-9a-f]*/\1/' \ -e 's/\(value.*\) [0-9][0-9]*\.[0-9]*e[-+][0-9][0-9]*/\1/' \ } # real QA test starts here pipeargs="-d 29 -D appl1" id pcp >/dev/null 2>&1 && pipeargs="$pipeargs -U $username" for cmds in \ close \ 'fetch sample.percontext.pdu;close' \ 'fetch sample.percontext.pdu;quit' \ 'fetch sample.percontext.pdu;exit' \ 'fetch sample.percontext.pdu' \ 'fetch sample.percontext.pdu;fetch sample.percontext.pdu;fetch sample.percontext.pdu' \ do echo "open pipe $PCP_VAR_DIR/pmdas/sample/pmdasample $pipeargs -l $tmp.log" >$tmp.cmd echo "$cmds" | tr ';' '\012' >>$tmp.cmd rm -f $tmp.log dbpmda -ei <$tmp.cmd 2>&1 | _filter # let daemon PMDA exit and flush stdio buffer to $tmp.log sleep 2 _filter <$tmp.log \ | _filter_dumpresult echo "open dso $PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX sample_init 30" >$tmp.cmd echo "$cmds" | tr ';' '\012' >>$tmp.cmd dbpmda -D appl1 -ei <$tmp.cmd 2>&1 | _filter \ | _filter_dumpresult done # success, all done exit