[LTP] [PATCH 2/2] cgroup_regression_test.sh: simplify last controller detection

Li Wang liwang@redhat.com
Wed Apr 16 06:44:29 CEST 2025


On Wed, Apr 16, 2025 at 6:09 AM Petr Vorel <pvorel@suse.cz> wrote:

> Simplify last controller detection by using awk only - replace tail and
> pipe with 'END' awk command (works also on Busybox).
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>

Tested-by: Li Wang <liwang@redhat.com>
Reviewed-by: Li Wang <liwang@redhat.com>

---
>  testcases/kernel/controllers/cgroup/cgroup_regression_test.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> index c241a5c4fc..276231fe8d 100755
> --- a/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> +++ b/testcases/kernel/controllers/cgroup/cgroup_regression_test.sh
> @@ -352,7 +352,7 @@ test7()
>                 return
>         fi
>
> -       subsys=`tail -n 1 /proc/cgroups | awk '{ print $1 }'`
> +       subsys=$(awk 'END{ print $1 }' /proc/cgroups)
>
>         # remount to add new subsystems to the hierarchy
>         while [ $i -le 2 ]; do
> --
> 2.49.0
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list