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/344 | |
download | pcp-47e6e7c84f008a53061e661f31ae96629bc694ef.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/344')
-rwxr-xr-x | qa/344 | 151 |
1 files changed, 151 insertions, 0 deletions
@@ -0,0 +1,151 @@ +#!/bin/sh +# PCP QA Test No. 344 +# +# exercise __pmLocalPMDA functionality +# +# Copyright (c) 2010 Ken McDonell. All Rights Reserved. +# + +seq=`basename $0` +echo "QA output created by $seq" + +# get standard filters +. ./common.product +. ./common.filter +. ./common.check + +status=0 # success is the default! +host=`hostname` +$sudo rm -rf $tmp.* $seq.full +trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15 + +cat <<End-of-File >$tmp.pmns +root { + qa + sample + tmpsample +} + +qa { + pid 400:0:1 + colour 400:0:5 + bin 400:0:6 + string +} + +qa.string { + write_me 400:0:29 +} + +sample { + colour 30:0:5 + bin 30:0:6 + string +} + +sample.string { + write_me 30:0:29 +} + +tmpsample { + colour 130:0:5 + bin 130:0:6 + string +} + +tmpsample.string { + write_me 130:0:29 +} +End-of-File + +_filter() +{ + tee -a $seq.full \ + | sed \ + -e "/^pmWhichContext/d" \ + -e "/^pmNewContext/d" \ + -e "/^Dump /d" \ + -e "/^Context\[/d" \ + -e "/^Local Context PMDA Table/d" \ + -e "s;$tmp;TMP;g" \ + -e "s/host: @/host: HOST/g" \ + -e "s/host: $host/host: HOST/g" \ + -e "s;$PCP_PMCDCONF_PATH;\$PCP_PMCDCONF_PATH;" \ + -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;" \ + -e "s/\.$DSO_SUFFIX/.\$DSO_SUFFIX/g" \ + -e '/^0*x*[0-9a-f][0-9a-f]* /d' \ + -e '/^\[[0-9][0-9]*]/d' \ + -e '/^__pmLocalPMDA(/d' +} + +# -e "s;$PCP_PMDAS_DIR;\$PCP_PMDAS_DIR;" \ +# -e "s;$PCP_VAR_DIR;\$PCP_VAR_DIR;g" \ + +# real QA test starts here +pminfo -fL -n $tmp.pmns -K clear -K add,400,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init qa.colour + +echo +pminfo -fL -n $tmp.pmns -K clear -K add,400,$PCP_VAR_DIR/pmdas/sample/pmda_sample,sample_init qa.pid >$tmp.out & +expect=$! +wait +got=`sed -n -e '/value/s/.*value //p' $tmp.out` +if [ "$got" != "$expect" ] +then + echo "Error: expecting pid $expect, got $got from" + cat $tmp.out +else + echo "PID check passes" +fi + +echo +echo "=== expect no sample metrics ===" +pminfo -fmL -n $tmp.pmns -K clear -K add,400,sample/pmda_sample.$DSO_SUFFIX,sample_init qa.colour sample.colour + +echo +echo "=== sample metrics this time ===" +# need to copy DSO so running sample_init() only once per DSO +cp $PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX $tmp.$DSO_SUFFIX +export PMDA_LOCAL_SAMPLE=yes +$sudo pminfo -fmL -n $tmp.pmns -K add,400,$tmp.$DSO_SUFFIX,sample_init qa.colour sample.colour + +echo +echo "=== -K spec parsing in pminfo ===" +for spec in \ + clear clear, clear,400 clear,400, clear,400,$tmp.$DSO_SUFFIX clear,400,$tmp.$DSO_SUFFIX, \ + clear,400,$tmp.$DSO_SUFFIX,sample_init clear,,$tmp.$DSO_SUFFIX,sample_init clear,,,sample_init \ + clear,,$tmp.$DSO_SUFFIX,sample_init clear,400,,sample_init \ + add add, add,400 add,400, add,400,$tmp.$DSO_SUFFIX add,400,$tmp.$DSO_SUFFIX, \ + add,400,$tmp.$DSO_SUFFIX,sample_init \ + del del, del,30 del,30, del,,sample/pmda_sample.$DSO_SUFFIX \ + del,30,sample/pmda_sample.$DSO_SUFFIX, \ + del,30,sample/pmda_sample.$DSO_SUFFIX,sample_init \ + del,, del,,, del,,,sample_init +do + echo "+++ -K $spec +++" | _filter + $sudo pminfo -Dcontext -fmL -n $tmp.pmns -K $spec \ + sample.string.write_me qa.string.write_me 2>&1 \ + | _filter +done + +echo +echo "=== some __pmLocalPMDA() exercises ===" +pminfo -Dcontext -fmL -n $tmp.pmns -K clear \ + -K add,30,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \ + -K add,400,$tmp.$DSO_SUFFIX,sample_init \ + -K del,30,0,0 \ + -K clear \ + -K add,30,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \ + -K del,0,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,0 \ + -K add,130,$PCP_VAR_DIR/pmdas/sample/pmda_sample.$DSO_SUFFIX,sample_init \ + -K add,400,$tmp.$DSO_SUFFIX,sample_init \ + tmpsample.bin 2>&1 \ +| _filter + +echo +echo "=== other tools than know about -K ..." +pmval -s 3 -t 0.1 -K clear -K add,30,$PCP_PMDAS_DIR/sample/pmda_sample.$DSO_SUFFIX,sample_init '@:sampledso.bin["bin-100","bin-900"]' | _filter +echo +pmprobe -K clear -K add,30,$PCP_PMDAS_DIR/sample/pmda_sample.$DSO_SUFFIX,sample_init -I sampledso.bin + +# success, all done +exit |