In present version of testsuite OPAQUE_HIERARCHY variable is ignored, thus testsuite is broken in systems where OPAQUE_HIERARCHY is nonempty. The patch fix this problem.
CHANGELOG v1: * use ^cgroup instead of cgroup in grep (otherwise it counts also tmpfs /sys/fs/cgroup) * remove obsolete IS_OPAQUE variable Signed-off-by: Ivana Hutarova Varekova <varek...@redhat.com> --- tests/runlibcgrouptest.sh | 36 ++++++++++++++++++++++++++++++------ 1 files changed, 30 insertions(+), 6 deletions(-) diff --git a/tests/runlibcgrouptest.sh b/tests/runlibcgrouptest.sh index 847f932..df1a921 100755 --- a/tests/runlibcgrouptest.sh +++ b/tests/runlibcgrouptest.sh @@ -15,6 +15,9 @@ # Description: This script runs the the basic tests for testing libcgroup apis. # +# TODO path to config.h have to be set properly +OPAQUE_HIERARCHY=`grep "OPAQUE_HIERARCHY" ../config.h |\ + cut -d" " -f3 | sed 's|\"||g'` DEBUG=false; # for debug messages FS_MOUNTED=0; # 0 for not mounted, 1 for mounted, 2 for multimounted MOUNTPOINT=/dev/cgroup_controllers; # Just to initialize @@ -72,12 +75,31 @@ check_mount_fs () umount_fs () { - while check_mount_fs + PROC_ENTRY_NUMBER=`cat /proc/mounts|grep ^cgroup | wc -l`; + NUMBER=1; + #go and remove all ot opaque mount points + while [ $PROC_ENTRY_NUMBER -ge $NUMBER ] do - PROC_ENTRY=`cat /proc/mounts|grep cgroup|\ - tr -s [:space:]|cut -d" " -f2`; - # Get first mountpoint in case of multiple mounts - PROC_ENTRY=`echo $PROC_ENTRY|cut -d" " -f1`; + # Get $NUMBER-th mountpoint in case of multiple mount + PROC_ENTRY=`cat /proc/mounts|grep ^cgroup|\ + tr -s [:space:]|cut -d" " -f2 |\ + head -n$NUMBER | tail -n1`; + # if the hierarchy is opaque skip to next item + if [ -n "$OPAQUE_HIERARCHY" ] + then + # find whether is the NUMBER-th item opaque + PROC_ENTRY_OPT=`cat /proc/mounts|grep ^cgroup|\ + tr -s [:space:]|cut -d" " -f4 |\ + head -n$NUMBER | tail -n1`; + echo $PROC_ENTRY_OPT | grep $OPAQUE_HIERARCHY + # if yes skip it to the next item + if [ $? -eq 0 ] + then + let NUMBER=$NUMBER+1 + continue + fi; + fi; + # remove the item if [ ! -z "$PROC_ENTRY" ] then TARGET=$PROC_ENTRY; @@ -87,7 +109,9 @@ umount_fs () rmdir $TARGET; debug "umounted $TARGET"; fi; - done + # go to the next item + let NUMBER=$NUMBER+1 + done; FS_MOUNTED=0; TARGET=/dev/cgroup_controllers; #?? echo "Cleanup done"; ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Libcg-devel mailing list Libcg-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libcg-devel