[LTP] [PATCH 16/16] controllers: update cgroup_regression_test to use newer cgroup lib

Li Wang liwang@redhat.com
Wed Mar 16 10:09:23 CET 2022


On Sat, Mar 5, 2022 at 7:19 AM Luke Nowakowski-Krijger <
luke.nowakowskikrijger@canonical.com> wrote:

> The older function in the cgroup lib 'get_cgroup_mountpoint' has been
> removed, so instead replace it with its old functionaility to get
> mountpoint.
>
> Also use the newer cgroup lib require operation to mount and cleanup a
> cpu controller.
>
> Signed-off-by: Luke Nowakowski-Krijger <
> luke.nowakowskikrijger@canonical.com>
> ---
>  .../cgroup/cgroup_regression_test.sh            | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> index 592a1d3b1..2df216f43 100755
> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> @@ -170,17 +170,8 @@ test3()
>                 return
>         fi
>
> -       cpu_subsys_path=$(get_cgroup_mountpoint "cpu")
> -
> -       # Run the test for 30 secs
> -       if [ -z "$cpu_subsys_path" ]; then
> -               mount -t cgroup -o cpu xxx cgroup/
> -               if [ $? -ne 0 ]; then
> -                       tst_res TFAIL "Failed to mount cpu subsys"
> -                       return
> -               fi
> -               cpu_subsys_path=cgroup
> -       fi
> +       cgroup_require "cpu"
> +       cpu_subsys_path=$(cgroup_get_mountpoint "cpu")
>
>         cgroup_regression_3_1.sh $cpu_subsys_path &
>         pid1=$!
> @@ -193,7 +184,7 @@ test3()
>         wait $pid2 2>/dev/null
>
>         rmdir $cpu_subsys_path/0 2> /dev/null
> -       tst_umount $PWD/cgroup
> +       cgroup_cleanup
>         check_kernel_bug
>  }
>
> @@ -310,7 +301,7 @@ test_7_1()
>         # could be passed here as params and this will lead to ambiguity
> and
>         # errors when grepping simply for 'debug' in /proc/mounts since
> we'll
>         # find also /sys/kernel/debug. Helper takes care of this.
> -       local subsys_path=$(get_cgroup_mountpoint $subsys)
> +       local subsys_path=$(grep cgroup /proc/mounts | grep -w $subsys |
> awk '{ print $2 }')
>

Why not use 'cgroup_get_mountpoint' like test3 but
switch back to grep for getting the subsys path?
The grep way won't work on Cgroup V2, isn't it?


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220316/8d402457/attachment-0001.htm>


More information about the ltp mailing list