python api: fix syntax error in recent context changes
[pcp.git] / qa / 730
blob86b4e48869b5cae592c1b33d5526218bae45f4dd
1 #!/bin/sh
2 # PCP QA Test No. 730
3 # Exercising the Linux cgroups metrics
5 # Copyright (c) 2014 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 [ $PCP_PLATFORM = linux ] || _notrun "cgroups test, only works with Linux"
18 status=1 # failure is the default!
19 $sudo rm -rf $tmp.* $seq.full
20 trap "cd $here; $sudo rm -rf $tmp.*; exit \$status" 0 1 2 3 15
22 _filter()
24 cat >$tmp.out
25 grep -v 'inst \[' $tmp.out
26 sed -n -e 's/inst \[[0-9][0-9]*/inst [N/p' $tmp.out \
27 | LC_COLLATE=POSIX sort
30 # real QA test starts here
31 root=$tmp.root
32 export PROC_HERTZ=100
33 export PROC_STATSPATH=$root
34 pmda=$PCP_PMDAS_DIR/proc/pmda_proc.so,proc_init
35 trees=`pminfo cgroup | awk -F. '{ print $2 }' | sort -u`
37 for tgz in $here/linux/cgroups-*.tgz
39 cd $here
40 $sudo rm -fr $root
41 mkdir $root || _fail "root in use when processing $tgz"
42 cd $root
43 rm -f $tmp.names
44 tar xzf $tgz
45 base=`basename $tgz`
47 echo "== Checking namespace and metric numbering - $base"
48 pminfo -L -K clear -K add,3,$pmda cgroup \
49 | LC_COLLATE=POSIX sort \
50 | tee $tmp.names
51 echo "== Checking metric descriptors and values - $base"
52 for metric in `cat $tmp.names`
54 pminfo -L -K clear -K add,3,$pmda -d -f $metric | _filter
55 done
56 echo "== Checking on an individual metric fetch - $base"
57 pminfo -L -K clear -K add,3,$pmda -f cgroup.blkio.dev.time | _filter
59 # takes too long to verify everything, so check just first
60 echo $base | grep -q 001 || continue
62 for tree in $trees
64 name=`pminfo cgroup.$tree | sed 1q`
65 echo "== Checking out multi-sample monitor tool - $base"
66 pmval -L -K clear -K add,3,$pmda -s 2048 -t 0.00001 $name >/dev/null
67 echo "checked cgroup tree $tree via metric $metric" >> $seq.full
68 done
70 echo && echo "== done" && echo
71 done
73 # success, all done
74 status=0
75 exit