On 04/06/2011 10:37 AM, Jan Safranek wrote:
> Two new tests:
>   - Test cgsnapshot, cgconfigparser and lssubsys with hierarchies mounted
>     several times.
>   - Test all the above with *named* hierarchies mounted several times +
>     also with named hierarchy with ordinary controllers.
>
> Signed-off-by: Jan Safranek<jsafr...@redhat.com>
Acked-by: Ivana Hutarova Varekova<varek...@redhat.com>

> ---
>
>   configure.in                       |    1
>   tests/tools/Makefile.am            |    2 -
>   tests/tools/multimount/Makefile.am |    3 +
>   tests/tools/multimount/many_mp     |   85 ++++++++++++++++++++++++++++++
>   tests/tools/multimount/many_named  |  101 
> ++++++++++++++++++++++++++++++++++++
>   5 files changed, 191 insertions(+), 1 deletions(-)
>   create mode 100644 tests/tools/multimount/Makefile.am
>   create mode 100755 tests/tools/multimount/many_mp
>   create mode 100755 tests/tools/multimount/many_named
>
> diff --git a/configure.in b/configure.in
> index 03b2731..d1f19a2 100644
> --- a/configure.in
> +++ b/configure.in
> @@ -197,6 +197,7 @@ AC_CONFIG_FILES([Makefile
>       tests/tools/Makefile
>       tests/tools/cgconfigparser/Makefile
>       tests/tools/cgclassify/Makefile
> +     tests/tools/multimount/Makefile
>       src/Makefile
>       src/daemon/Makefile
>       src/tools/Makefile
> diff --git a/tests/tools/Makefile.am b/tests/tools/Makefile.am
> index 4f2b1b0..45c1955 100644
> --- a/tests/tools/Makefile.am
> +++ b/tests/tools/Makefile.am
> @@ -1,2 +1,2 @@
> -SUBDIRS = cgconfigparser cgclassify
> +SUBDIRS = cgconfigparser cgclassify multimount
>
> diff --git a/tests/tools/multimount/Makefile.am 
> b/tests/tools/multimount/Makefile.am
> new file mode 100644
> index 0000000..45fe043
> --- /dev/null
> +++ b/tests/tools/multimount/Makefile.am
> @@ -0,0 +1,3 @@
> +EXTRA_DIST = many_mp  many_named
> +
> +TESTS = many_mp  many_named
> diff --git a/tests/tools/multimount/many_mp b/tests/tools/multimount/many_mp
> new file mode 100755
> index 0000000..04659c1
> --- /dev/null
> +++ b/tests/tools/multimount/many_mp
> @@ -0,0 +1,85 @@
> +#!/bin/bash
> +# Test hierarchies mounted multiple times (one hierarchy mounted 99 times)
> +# - cgsnapshot
> +# - cgconfigparser
> +# - lssubsys
> +
> +. `dirname $0`/../testenv.sh
> +
> +# cgconfigparser cannot handle more than 100 mount points :-(
> +COUNT=99
> +
> +function check_config()
> +{
> +     CONFIG=$1
> +     # check basic sanity of generatet cgconfig.conf file
> +     #  - it has expected number of mount points
> +     if [ `grep '='<  $CONFIG | wc -l` -ne $(($COUNT*4)) ]; then
> +             die "wrong number of mount points in $CONFIG"
> +     fi
> +
> +     #  - it has mount section
> +     grep "mount">/dev/null<$CONFIG \
> +             || die "cgsnapshot failed, no mount section found in $CONFIG"
> +
> +     #  - it has 99 different mount points
> +     for i in `seq $COUNT`; do
> +             grep "cpuacct$i">/dev/null<$CONFIG \
> +                     || die "cgsnapshot failed, no cpuacct$i found in 
> $CONFIG"
> +     done
> +}
> +
> +for i in `seq $COUNT`; do
> +     mkdir -p $TMP/cgroups/cpuacct$i 2>/dev/null
> +     mount -t cgroup -o cpuacct,cpuset,memory,freezer cpuacct$i \
> +                     $TMP/cgroups/cpuacct$i \
> +             || die "Mount $i failed"
> +done
> +
> +# check lssubsys
> +# plain lssubsys - only one line with 4 controllers is expected
> +$TOOLSDIR/lssubsys>$TMP/subsys1.out \
> +     || die "plain lssubsys failed"
> +[ `wc -l<$TMP/subsys1.out` -eq 1 ] \
> +     || die "unexpected output of plan lssubsys"
> +
> +# lssubsys -m - first mount point is returned
> +$TOOLSDIR/lssubsys -m>$TMP/subsys2.out \
> +     || die "lssubsys -m failed"
> +[ `wc -l<$TMP/subsys2.out` -eq 1 ] \
> +     || die "unexpected output of lssubsys -m"
> +grep<$TMP/subsys2.out cpuacct1>/dev/null \
> +     || die "lssubsys -m does not show the first mount point"
> +
> +# lssubsys -M - all mount points are returned
> +$TOOLSDIR/lssubsys -M>$TMP/subsys3.out \
> +     || die "lssubsys -M failed"
> +[ `wc -l<$TMP/subsys3.out` -eq $COUNT ] \
> +     || die "unexpected output of lssubsys -M"
> +for i in `seq $COUNT`; do
> +     grep<$TMP/subsys3.out cpuacct$i>/dev/null \
> +             || die "lssubsys -m does not show cpuacct$i"
> +done
> +
> +# check cgsnapshot
> +$TOOLSDIR/cgsnapshot -b 
> $CONFIGDIR/cgsnapshot_blacklist.conf>$TMP/snapshot.conf \
> +     || die "cgsnapshot failed"
> +
> +check_config $TMP/snapshot.conf
> +
> +$TOOLSDIR/cgclear || die "cgclear 1 failed"
> +
> +# check cgconfigparser - try to parse the generated config
> +$TOOLSDIR/cgconfigparser -l $TMP/snapshot.conf \
> +     || die "cgconfigparser failed to parse the snapshot"
> +
> +# and make its snapshot again
> +$TOOLSDIR/cgsnapshot -b 
> $CONFIGDIR/cgsnapshot_blacklist.conf>$TMP/snapshot2.conf \
> +     || die "cgsnapshot2 failed"
> +
> +check_config $TMP/snapshot2.conf
> +
> +$TOOLSDIR/cgclear
> +
> +cleanup
> +exit 0
> diff --git a/tests/tools/multimount/many_named 
> b/tests/tools/multimount/many_named
> new file mode 100755
> index 0000000..9a72a88
> --- /dev/null
> +++ b/tests/tools/multimount/many_named
> @@ -0,0 +1,101 @@
> +#!/bin/bash
> +# Tests named hierarchies, mouted several times
> +# - cgsnapshot
> +# - cgconfigparser
> +# - lssubsys
> +
> +. `dirname $0`/../testenv.sh
> +
> +# 10 named hierarchies, each mounted 8 times
> +HIERARCHIES=10
> +COUNT=8
> +
> +function check_config()
> +{
> +     # check basic sanity of the generated file
> +     CONFIG=$1
> +
> +     # it has expected nr. of mount points
> +     if [ `grep '='<$CONFIG | wc -l` -ne $(($COUNT*$HIERARCHIES+3)) ];then
> +             die "wrong number of mount points displayed in $CONFIG"
> +     fi
> +     # it has mount section
> +     grep "mount">/dev/null<$CONFIG \
> +             || die "cgsnapshot failed, no mount section found in $CONFIG"
> +     # it has every hierarchy at least once
> +     for i in `seq $HIERARCHIES`; do
> +             grep "name=$i">/dev/null<$CONFIG \
> +                     || die "cgsnapshot failed, no name=$i found in $CONFIG"
> +     done
> +     # it has cpuacct,cpuset,name=cputest mount
> +     grep "name=cputest">/dev/null<$CONFIG \
> +             || die "cannot find name=cputest in $CONFIG"
> +     grep "cpuacct">/dev/null<$CONFIG \
> +             || die "cannot find cpuacct in $CONFIG"
> +}
> +
> +for i in `seq $HIERARCHIES`; do
> +     for j in `seq $COUNT`; do
> +             mkdir -p $TMP/cgroups/named$i-$j 2>/dev/null
> +             mount -t cgroup -o none,name=$i named$i \
> +                     $TMP/cgroups/named$i-$j \
> +                     || die "Mount $i_$j failed"
> +     done
> +done
> +
> +# add one named mount point with other controllers
> +mkdir -p $TMP/cgroups/cpu 2>/dev/null
> +mount -t cgroup -o cpuset,cpuacct,name=cputest test $TMP/cgroups/cpu \
> +             || die "Mount cpu failed"
> +
> +# check lssubsys
> +# plain lssubsys - every hierarchy only once
> +$TOOLSDIR/lssubsys>$TMP/subsys1.out \
> +     || die "plain lssubsys failed"
> +[ `wc -l<$TMP/subsys1.out` -eq $(( $HIERARCHIES+1 )) ] \
> +     || die "unexpected output of plan lssubsys"
> +
> +# lssubsys -m - first mount point is returned
> +$TOOLSDIR/lssubsys -m>$TMP/subsys2.out \
> +     || die "lssubsys -m failed"
> +[ `wc -l<$TMP/subsys2.out` -eq $(( $HIERARCHIES+1 )) ] \
> +     || die "unexpected output of lssubsys -m"
> +grep<$TMP/subsys2.out cgroups/cpu>/dev/null \
> +     || die "lssubsys -m does not show the first mount point for cputest"
> +for i in `seq $HIERARCHIES`; do
> +     grep<$TMP/subsys2.out cgroups/named$i-1>/dev/null \
> +             || die "lssubsys -m does not show cgroups/named$i-1"
> +done
> +
> +# lssubsys -M - all mount points are returned
> +$TOOLSDIR/lssubsys -M>$TMP/subsys3.out \
> +     || die "lssubsys -M failed"
> +[ `wc -l<$TMP/subsys3.out` -eq $(( $COUNT*$HIERARCHIES+1)) ] \
> +     || die "unexpected output of lssubsys -M"
> +for i in `seq $HIERARCHIES`; do
> +     for j in `seq $COUNT`; do
> +             grep<$TMP/subsys3.out cgroups/named$i-$j>/dev/null \
> +             || die "lssubsys -m does not show cgroups/named$i-$j"
> +     done
> +done
> +
> +$TOOLSDIR/cgsnapshot -b 
> $CONFIGDIR/cgsnapshot_blacklist.conf>$TMP/snapshot.conf \
> +     || die "cgsnapshot failed"
> +
> +check_config $TMP/snapshot.conf
> +
> +$TOOLSDIR/cgclear || die "cgclear 1 failed"
> +
> +# try to parse the config...
> +$TOOLSDIR/cgconfigparser -l $TMP/snapshot.conf \
> +     || die "cgconfigparser failed to parse the snapshot"
> +# and make its snapshot again
> +$TOOLSDIR/cgsnapshot -b 
> $CONFIGDIR/cgsnapshot_blacklist.conf>$TMP/snapshot2.conf \
> +     || die "cgsnapshot2 failed"
> +
> +check_config $TMP/snapshot2.conf
> +
> +$TOOLSDIR/cgclear
> +
> +cleanup
> +exit 0
>
>
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> Libcg-devel mailing list
> Libcg-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libcg-devel


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to