[LTP] [PATCH v2 3/4] fs_bind: Convert cloneNS tests

Joerg Vehlow
2021-07-08T05:26:55Z

Hi,

please do not merge, I found a bug in the code

On 7/6/2021 2:04 PM, Joerg Vehlow wrote:
> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
>
> diff --git a/testcases/kernel/fs/fs_bind/fs_bind_lib.sh b/testcases/kernel/fs/fs_bind/fs_bind_lib.sh
> index b644ef512..94e94024c 100644
> --- a/testcases/kernel/fs/fs_bind/fs_bind_lib.sh
> +++ b/testcases/kernel/fs/fs_bind/fs_bind_lib.sh
> @@ -28,6 +28,8 @@ FS_BIND_DISK2="disk2"
> FS_BIND_DISK3="disk3"
> FS_BIND_DISK4="disk4"
>
> +FS_BIND_MNTNS_PID=
> +
> # Creates a directory and bind-mounts it to itself.
> # usage: fs_bind_makedir share_mode directory
> # where
> @@ -68,16 +70,23 @@ fs_bind_makedir()
> # If -n is given, only two directories are allowed.
> fs_bind_check()
> {
> - local expect_diff args msg dir1 dir2 fail output
> + local expect_diff use_ns args msg dir1 dir2 fail output
> expect_diff=0
> - while getopts "n" args; do
> + use_ns=0
> + while getopts "ns" args; do
> case "$args" in
> n) expect_diff=1; shift; ;;
> + s) use_ns=1; shift; ;;
> esac
> done
This getopts loop does not seem to be portable. I will send a v3....

Joerg