diff mbox series

[v2] commands/mkswap01.sh: Fix unexisted "/dev/disk/by-*" files on old kernels

Message ID 1529819983-461-1-git-send-email-yangx.jy@cn.fujitsu.com
State Accepted
Delegated to: Petr Vorel
Headers show
Series [v2] commands/mkswap01.sh: Fix unexisted "/dev/disk/by-*" files on old kernels | expand

Commit Message

Xiao Yang June 24, 2018, 5:59 a.m. UTC
Before kernel commit c3473c6(e.g. RHEL6), mkswap -L or mkswap -U for loop
devices can not generate corresponding "/dev/disk/by-*" files.  It is just
a way to check the success of mkswap rather than a bug, so the test should
not get TBROK when "/dev/disk/by-*" files are not generated but swapon
enables loop devices for swapping sucessfully.

Suggested-by: Li Wang <liwang@redhat.com>
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 testcases/commands/mkswap/mkswap01.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Li Wang June 25, 2018, 9:02 a.m. UTC | #1
On Sun, Jun 24, 2018 at 1:59 PM, Xiao Yang <yangx.jy@cn.fujitsu.com> wrote:
> Before kernel commit c3473c6(e.g. RHEL6), mkswap -L or mkswap -U for loop
> devices can not generate corresponding "/dev/disk/by-*" files.  It is just
> a way to check the success of mkswap rather than a bug, so the test should
> not get TBROK when "/dev/disk/by-*" files are not generated but swapon
> enables loop devices for swapping sucessfully.
>
> Suggested-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Reviewed-by: Li Wang <liwang@redhat.com>

> ---
>  testcases/commands/mkswap/mkswap01.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh
> index 5ead4cd..4185702 100755
> --- a/testcases/commands/mkswap/mkswap01.sh
> +++ b/testcases/commands/mkswap/mkswap01.sh
> @@ -64,7 +64,12 @@ mkswap_verify()
>                 local pagesize=$PAGE_SIZE
>         fi
>
> -       TST_RETRY_FUNC "check_for_file $dev_file" 0
> +       if tst_kvcmp -lt "2.6.35" && [ -n "$dev_file" ]; then
> +               tst_res TINFO "Waiting for $dev_file to appear"
> +               tst_sleep 100ms
> +       else
> +               TST_RETRY_FUNC "check_for_file $dev_file" 0
> +       fi
>
>         swapon $swapfile 2>/dev/null
>
> --
> 1.8.3.1
>
>
>
Petr Vorel June 28, 2018, 11:26 a.m. UTC | #2
Hi Li, Xiao,


> Before kernel commit c3473c6(e.g. RHEL6), mkswap -L or mkswap -U for loop
> devices can not generate corresponding "/dev/disk/by-*" files.  It is just
> a way to check the success of mkswap rather than a bug, so the test should
> not get TBROK when "/dev/disk/by-*" files are not generated but swapon
> enables loop devices for swapping sucessfully.

> Suggested-by: Li Wang <liwang@redhat.com>
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  testcases/commands/mkswap/mkswap01.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

> diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh
> index 5ead4cd..4185702 100755
> --- a/testcases/commands/mkswap/mkswap01.sh
> +++ b/testcases/commands/mkswap/mkswap01.sh
> @@ -64,7 +64,12 @@ mkswap_verify()
>  		local pagesize=$PAGE_SIZE
>  	fi

> -	TST_RETRY_FUNC "check_for_file $dev_file" 0
> +	if tst_kvcmp -lt "2.6.35" && [ -n "$dev_file" ]; then
> +		tst_res TINFO "Waiting for $dev_file to appear"
> +		tst_sleep 100ms
> +	else
> +		TST_RETRY_FUNC "check_for_file $dev_file" 0
> +	fi

>  	swapon $swapfile 2>/dev/null

pushed, thanks!


Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/commands/mkswap/mkswap01.sh b/testcases/commands/mkswap/mkswap01.sh
index 5ead4cd..4185702 100755
--- a/testcases/commands/mkswap/mkswap01.sh
+++ b/testcases/commands/mkswap/mkswap01.sh
@@ -64,7 +64,12 @@  mkswap_verify()
 		local pagesize=$PAGE_SIZE
 	fi
 
-	TST_RETRY_FUNC "check_for_file $dev_file" 0
+	if tst_kvcmp -lt "2.6.35" && [ -n "$dev_file" ]; then
+		tst_res TINFO "Waiting for $dev_file to appear"
+		tst_sleep 100ms
+	else
+		TST_RETRY_FUNC "check_for_file $dev_file" 0
+	fi
 
 	swapon $swapfile 2>/dev/null