Merge branch 'master' of git://git.pcp.io/pcp into qt
[pcp.git] / qa / 974
blob4fb4044e7df2aa5c4034b55aac84df1276742191
1 #!/bin/sh
2 # PCP QA Test No. 974
3 # Exercise pmdaproc per-process metric extraction.
5 # Copyright (c) 2015-2016 Red Hat.
8 seq=`basename $0`
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
12 . ./common.product
13 . ./common.filter
14 . ./common.check
16 pminfo proc.nprocs >/dev/null 2>&1 || _notrun "proc PMDA not installed"
17 [ $PCP_PLATFORM = linux ] || _notrun "Linux proc test, only works with Linux"
19 status=1 # failure is the default!
20 $sudo rm -rf $tmp.* $seq.full
21 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
23 _filter()
25 cat >$tmp.out
26 grep -v 'inst \[' $tmp.out
27 sed -n -e 's/inst \[[0-9][0-9]*/inst [N/p' $tmp.out \
28 | LC_COLLATE=POSIX sort
31 # real QA test starts here
32 root=$tmp.root
33 export PROC_STATSPATH=$root
34 export PROC_PAGESIZE=4096
35 export PROC_THREADS=0
36 export PROC_HERTZ=100
37 pmda=$PCP_PMDAS_DIR/proc/pmda_proc.so,proc_init
39 for tgz in $here/linux/procpid-*-root-*.tgz
41 cd $here
42 $sudo rm -fr $root
43 mkdir $root || _fail "root in use when processing $tgz"
44 cd $root
45 tar xzf $tgz
46 base=`basename $tgz`
48 echo "== Extracting subtrees for later use - $base" | tee -a $seq.full
49 trees=`pminfo proc | awk -F. '{ print $2 }' | sort -u | egrep -v nproc`
50 echo $trees >> $here/$seq.full
52 echo "== Checking namespace and metric numbering - $base"
53 pminfo -L -K clear -K add,3,$pmda proc \
54 | LC_COLLATE=POSIX sort \
55 | tee $tmp.names >> $here/$seq.full
57 echo "== Checking metric descriptors and a fetch - $base"
58 for tree in $trees
60 metric=`grep $tree $tmp.names | head -1`
61 echo $metric >> $here/$seq.full
62 pminfo -L -K clear -K add,3,$pmda -d -f $metric | _filter
63 done
65 echo && echo "== done" && echo
66 done
68 # success, all done
69 status=0
70 exit