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

Xiao Yang yangx.jy@cn.fujitsu.com
Sun Jun 24 07:59:43 CEST 2018


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
 
-- 
1.8.3.1





More information about the ltp mailing list