[LTP] [PATCH v2 18/19] controllers: update cpuset_regression_test.sh to use newer cgroup lib
Luke Nowakowski-Krijger
luke.nowakowskikrijger@canonical.com
Thu Apr 28 22:39:43 CEST 2022
Update the test to use the newer cgroup lib which handles mounting for
v1 and v2 controllers enabling them both to be tested and cleaning up
the mounting and cleanup process.
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
---
v2: Change variable cgroup_v to cgroup_version
.../cpuset/cpuset_regression_test.sh | 26 +++++--------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
index a6806b7b0..67fed791a 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_regression_test.sh
@@ -123,18 +123,13 @@ cpuset_restore()
setup()
{
- if ! is_cgroup_subsystem_available_and_enabled "cpuset"; then
- tst_brk TCONF "Either kernel does not support cpuset controller or feature not enabled"
- fi
-
- # We need to mount cpuset if it is not found.
- root_cpuset_dir=$(get_cgroup_mountpoint cpuset)
- if [ -z "$root_cpuset_dir" ]; then
- root_cpuset_dir="$LOCAL_MOUNTPOINT"
+ cgroup_require "cpuset"
+ cgroup_version=$(cgroup_get_version "cpuset")
+ root_cpuset_dir=$(cgroup_get_mountpoint "cpuset")
+ testpath=$(cgroup_get_test_path "cpuset")
+ task_list=$(cgroup_get_task_list "cpuset")
- ROD_SILENT mkdir -p ${root_cpuset_dir}
- ROD_SILENT mount -t cpuset cpuset ${root_cpuset_dir}
- fi
+ tst_res TINFO "test starts with cgroup version $cgroup_version"
if ! [ -f ${root_cpuset_dir}/${cpu_exclusive} ]; then
cpu_exclusive=cpu_exclusive
@@ -181,14 +176,7 @@ cleanup()
echo ${old_cpu_exclusive_value} > ${root_cpuset_dir}/${cpu_exclusive}
fi
- if [ -d "$LOCAL_MOUNTPOINT" ]; then
- umount ${LOCAL_MOUNTPOINT}
- if [ $? -ne 0 ]; then
- tst_res TWARN "'umount ${LOCAL_MOUNTPOINT}' failed"
- fi
-
- rmdir ${LOCAL_MOUNTPOINT}
- fi
+ cgroup_cleanup
}
test()
--
2.32.0
More information about the ltp
mailing list