diff options
Diffstat (limited to 'qa/361')
-rwxr-xr-x | qa/361 | 95 |
1 files changed, 95 insertions, 0 deletions
@@ -0,0 +1,95 @@ +#! /bin/sh +# PCP QA Test No. 361 +# Exercise cgroup metrics in the Linux PMDA +# +# Copyright (c) 2010 Aconex. All Rights Reserved. +# + +seq=`basename $0` +echo "QA output created by $seq" + +# get standard filters +. ./common.product +. ./common.check +. ./localconfig + +[ $PCP_PLATFORM = linux ] || _notrun "tests pmdalinux functionality on Linux only" + +rm -f $seq.out +# cgroup metrics may not be available +# +if pminfo cgroup >/dev/null 2>&1 +then + prefix=cgroup + ln $seq.out.2 $seq.out +else + if pminfo proc.cgroup >/dev/null 2>&1 + then + prefix=proc.cgroup + ln $seq.out.1 $seq.out + else + _notrun cgroup metrics not available + fi +fi + +_cleanup() +{ + rm -f $tmp.* + $sudo umount $grp 2>/dev/null + rmdir $grp 2>/dev/null +} + +grp=/tmp/cgroup_$seq +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +[ -f /proc/cgroups ] || _notrun "No support for cgroups in the running kernel" +grep -q cgroup /proc/mounts && _notrun "One or more cgroups already in use" +grep -q cpuacct /proc/cgroups || _notrun "No cpuacct cgroup support" +grep -q cpuset /proc/cgroups || _notrun "No cpuset cgroup support" +grep -q cpu /proc/cgroups || _notrun "No cpusched cgroup support" + +rmdir $grp 2>/dev/null +mkdir $grp || _fail "Cannot create cgroup mount point" + +# since the proc PMDA was split from the Linux PMDA, the proc PMDA may +# not be installed (caught by the notrun cases above) or installed as +# a daemon, in which case the standard processing of pmcd.conf for +# a local PMAPI context connection will not find it, so may have to +# be specific about the proc PMDA DSO location +# +pmda="-Kclear -Kadd,3,$PCP_PMDAS_DIR/proc/pmda_proc.so,proc_init" + +# real test starts here +echo "initial fetch, starting with a clean slate" +pmprobe -L $pmda -v $prefix.mounts \ +| LC_COLLATE=POSIX sort + +echo "cpuset metrics fetch, no user groups defined, single controller" +$sudo mount -t cgroup -o cpuset none $grp || _fail "cpuset mount" +pminfo -L $pmda -m $prefix.mounts $prefix.groups \ +| LC_COLLATE=POSIX sort +$sudo umount $grp || _fail "cpuset umount" + +echo "cpuacct and cpuset fetch, no user groups defined, dual controllers" +$sudo mount -t cgroup -o cpuacct,cpuset none $grp || _fail "cpu,cpuacct mount" +pminfo -L $pmda -m $prefix.mounts $prefix.groups \ +| LC_COLLATE=POSIX sort +$sudo umount $grp || _fail "cpu,cpuacct cgroup umount" + +echo "cpuacct and cpuset fetch, one user group defined, dual controllers" +$sudo mount -t cgroup -o cpuacct,cpuset none $grp || _fail "cpu,cpuacct mount" +$sudo mkdir $grp/pcpqa +pminfo -L $pmda $prefix.mounts $prefix.groups \ +| LC_COLLATE=POSIX sort \ +| xargs pminfo -L -d $pmda -m +$sudo rmdir $grp/pcpqa +echo "cpuacct and cpuset fetch, one user group removed, dual controllers" +pminfo -L $pmda $prefix.mounts $prefix.groups \ +| LC_COLLATE=POSIX sort \ +| xargs pminfo -L -d $pmda -m +$sudo umount $grp || _fail "cpu,cpuacct cgroup umount" + +# success, all done +status=0 +exit |