[LTP] [PATCH V2] controllers/cgroup_fj: fix and clean up
Cyril Hrubis
chrubis@suse.cz
Thu Nov 5 15:02:42 CET 2015
Hi!
> +mounted=1;
>
> expected=1;
>
> @@ -132,6 +133,12 @@ if [ "$#" -ne "9" ]; then
> exit -1;
> fi
>
> +mount_point=$(get_mount_point)
> +if [ "$mount_point" == "" ] ; then
> + mounted=0
> + mount_point=/dev/cgroup
> +fi
> +
> check_para;
> if [ $? -ne 0 ]; then
> usage;
> @@ -139,7 +146,9 @@ if [ $? -ne 0 ]; then
> fi
> setup;
>
> -mount_cgroup;
> +if [ $mounted -ne 1 ]; then
> + mount_cgroup;
> +fi
It would be more elegant if this snippets of code that detect if cgroup
is mounted and mount it if it isn't were part of the setup() function
instead of being copied in each test.
...
> +get_mount_point()
> +{
> + check_point=`grep -w $subsystem /proc/mounts | cut -f 2 | cut -d " " -f2`
I would do even more specific:
grep -w "^$subsystem"
which would match only lines that begin with word "$subsystem".
Otherwise this looks good.
--
Cyril Hrubis
chrubis@suse.cz
More information about the Ltp
mailing list