[LTP] [PATCH v2] cgroup_regression_test.sh: Remove obselte test_5

Yang Xu
2019-09-19T10:38:08Z

test_5 is a very old regresstion test and kernel code has been
rewritten completely since 2.6. No user will use such old kernel
code to test. So I think we can remove it.

Also rename test10 as test5, modify TST_CNT.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
---
...ssion_10_1.sh => cgroup_regression_5_1.sh} | 0
...ssion_10_2.sh => cgroup_regression_5_2.sh} | 0
.../cgroup/cgroup_regression_test.sh | 111 +++---------------
3 files changed, 18 insertions(+), 93 deletions(-)
rename testcases/kernel/controllers/cgroup/{cgroup_regression_10_1.sh => cgroup_regression_5_1.sh} (100%)
rename testcases/kernel/controllers/cgroup/{cgroup_regression_10_2.sh => cgroup_regression_5_2.sh} (100%)

diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_10_1.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_5_1.sh
similarity index 100%
rename from testcases/kernel/controllers/cgroup/cgroup_regression_10_1.sh
rename to testcases/kernel/controllers/cgroup/cgroup_regression_5_1.sh
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_10_2.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_5_2.sh
similarity index 100%
rename from testcases/kernel/controllers/cgroup/cgroup_regression_10_2.sh
rename to testcases/kernel/controllers/cgroup/cgroup_regression_5_2.sh
diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
index e197f5d3f..1f7f3820e 100755
--- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
+++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
@@ -7,7 +7,7 @@
TST_TESTFUNC=test
TST_SETUP=do_setup
TST_CLEANUP=do_cleanup
-TST_CNT=10
+TST_CNT=9
TST_NEEDS_ROOT=1
TST_NEEDS_TMPDIR=1
TST_NEEDS_CMDS="awk dmesg find mountpoint rmdir"
@@ -233,77 +233,28 @@ test4()
}

#---------------------------------------------------------------------------
-# Bug: When mount cgroup fs and the fs was busy, root_count should not be
-# decremented in cgroup_kill_sb()
-# Kernel: 2.6.29-rcX
-# Links: https://openvz.org/pipermail/devel/2009-January/016345.html
-# http://lkml.org/lkml/2009/1/28/190
-# Fix: commit 839ec5452ebfd5905b9c69b20ceb640903a8ea1a
+# Bug: When running 2 concurrent mount/umount threads, kernel WARNING
+# may be triggered, but it's VFS' issue but not cgroup.
+# Kernel: 2.6.24 - 2.6.29-rcX
+# Links: http://lkml.org/lkml/2009/1/4/354
+# Fix: commit 1a88b5364b535edaa321d70a566e358390ff0872
#---------------------------------------------------------------------------
test5()
{
- local mounted
- local failing
- local mntpoint
-
- local lines=`cat /proc/cgroups | wc -l`
- if [ $lines -le 2 ]; then
- tst_res TCONF "require at least 2 cgroup subsystems"
- return
- fi
-
- local subsys1=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
- local subsys2=`tail -n 2 /proc/cgroups | head -1 | awk '{ print $1 }'`
-
- # Accounting here for the fact that the chosen subsystems could
- # have been already previously mounted at boot time: in such a
- # case we must skip the initial co-mount step (which would
- # fail anyway) and properly re-organize the $mntpoint and
- # $failing params to be used in the following expected-to-fail
- # mount action. Note that the subsysN name itself will be listed
- # amongst mounts options.
- get_cgroup_mountpoint $subsys1 >/dev/null && mounted=$subsys1
- [ -z "$mounted" ] && get_cgroup_mountpoint $subsys2 >/dev/null && mounted=$subsys2
- if [ -z "$mounted" ]; then
- mntpoint=cgroup
- failing=$subsys1
- mount -t cgroup -o $subsys1,$subsys2 xxx $mntpoint/
- if [ $? -ne 0 ]; then
- tst_res TFAIL "mount $subsys1 and $subsys2 failed"
- return
- fi
- else
- # Use the pre-esistent mountpoint as $mntpoint and use a
- # co-mount with $failing: this way the 2nd mount will
- # also fail (as expected) in this 'mirrored' configuration.
- mntpoint=$(get_cgroup_mountpoint $mounted)
- failing=$subsys1,$subsys2
- fi
-
- # This 2nd mount has been properly configured to fail
- mount -t cgroup -o $failing xxx $mntpoint/ 2> /dev/null
- if [ $? -eq 0 ]; then
- tst_res TFAIL "mount $failing should fail"
- # Do NOT unmount pre-existent mountpoints...
- [ -z "$mounted" ] && umount $mntpoint/
- return
- fi
-
- mkdir $mntpoint/0
- # Otherwise we can't attach task
- if [ "$subsys1" = cpuset -o "$subsys2" = cpuset ]; then
- echo 0 > $mntpoint/0/cpuset.cpus 2> /dev/null
- echo 0 > $mntpoint/0/cpuset.mems 2> /dev/null
- fi
+ cgroup_regression_5_1.sh &
+ local pid1=$!
+ cgroup_regression_5_2.sh &
+ local pid2=$!

- sleep 100 &
- echo $! > $mntpoint/0/tasks
+ sleep 30
+ kill -USR1 $pid1 $pid2
+ wait $pid1 2>/dev/null
+ wait $pid2 2>/dev/null

- kill -TERM $! > /dev/null
- wait $! 2>/dev/null
- rmdir $mntpoint/0
- # Do NOT unmount pre-existent mountpoints...
- [ -z "$mounted" ] && umount $mntpoint/
+ mount -t cgroup none cgroup 2> /dev/null
+ mkdir cgroup/0
+ rmdir cgroup/0
+ umount cgroup/ 2> /dev/null
check_kernel_bug
}

@@ -488,30 +439,4 @@ test9()
check_kernel_bug
}

-#---------------------------------------------------------------------------
-# Bug: When running 2 concurrent mount/umount threads, kernel WARNING
-# may be triggered, but it's VFS' issue but not cgroup.
-# Kernel: 2.6.24 - 2.6.29-rcX
-# Links: http://lkml.org/lkml/2009/1/4/354
-# Fix: commit 1a88b5364b535edaa321d70a566e358390ff0872
-#---------------------------------------------------------------------------
-test10()
-{
- cgroup_regression_10_1.sh &
- local pid1=$!
- cgroup_regression_10_2.sh &
- local pid2=$!
-
- sleep 30
- kill -USR1 $pid1 $pid2
- wait $pid1 2>/dev/null
- wait $pid2 2>/dev/null
-
- mount -t cgroup none cgroup 2> /dev/null
- mkdir cgroup/0
- rmdir cgroup/0
- umount cgroup/ 2> /dev/null
- check_kernel_bug
-}
-
tst_run
--
2.18.1