Merge branch 'master' of https://github.com/kmcdonell/pcp into kenj-merge
[pcp.git] / qa / 735
blob234dd4e56ab00f0df6ddd30c5edc086ba4815494
1 #!/bin/sh
2 # PCP QA Test No. 735
3 # Exercise the Linux kernel proc.psinfo.cgroup metric
5 # Copyright (c) 2013 Red Hat. All Rights Reserved.
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 pid=$$
18 test $PCP_PLATFORM = linux || _notrun "Test unsupported on $PCP_PLATFORM"
19 test -f /proc/$pid/cgroup || _notrun "No per-process support for cgroups"
21 status=1 # failure is the default!
22 $sudo rm -rf $tmp.* $seq.full
23 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
25 # real QA test starts here
26 $sudo rm -f $seq.full
27 syscgroups=`cat /proc/$pid/cgroup \
28 | sed -e 's/^[0-9][0-9]*://' \
29 | tr '\n' ';' \
30 | sed -e 's/;$/\n/'`
31 echo "SYS cgroup list for process $pid is: $syscgroups" >> $seq.full
33 pminfo -f proc.psinfo.cgroups > $tmp.cgroups
34 pcpcgroups=`grep "^ inst \[$pid or " $tmp.cgroups \
35 | $PCP_AWK_PROG '{ print $NF }' \
36 | sed -e 's/^"//' -e 's/"$//'`
37 echo "PCP cgroup list for process $pid is: $pcpcgroups" >> $seq.full
38 echo "Extracted from pminfo:" >> $seq.full
39 cat $tmp.cgroups >> $seq.full
41 if [ "$pcpcgroups" = "$syscgroups" ]
42 then
43 echo "Control group list for current process checks out"
44 status=0
45 else
46 echo "Mismatch on control group list:"
47 echo "PCP cgroups: $pcpcgroups"
48 echo "SYS cgroups: $syscgroups"
49 status=1
52 exit