[LTP] [PATCH 1/3] swapoff0[12]: Remove unneeded tst_brk()

Petr Vorel pvorel@suse.cz
Thu Apr 18 16:13:10 CEST 2024


SAFE_MAKE_SWAPFILE_BLKS() calls make_swapfile() with safe parameter == 1,
therefore passes TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING to
tst_cmd() and following functions, which leads to quit testing due
tst_brkm(TCONF, ...).

This is a left over from transition from tst_fill_file() which does not
have safe parameter to make_swapfile() in 6249e87b5 (swapoff01.c) and
009a407a0 (swapoff02.c).

Fixes: 6249e87b5 ("libswap: customize swapfile size")
Fixes: 009a407a0 ("swapon/off: enable all_filesystem in swap test")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 4 +---
 testcases/kernel/syscalls/swapoff/swapoff02.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index cf13907e7..314630267 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -43,9 +43,7 @@ static void verify_swapoff(void)
 static void setup(void)
 {
 	is_swap_supported(TEST_FILE);
-
-	if (SAFE_MAKE_SWAPFILE_BLKS(SWAP_FILE, 65536))
-		tst_brk(TBROK, "Failed to create file for swap");
+	SAFE_MAKE_SWAPFILE_BLKS(SWAP_FILE, 65536);
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/swapoff/swapoff02.c b/testcases/kernel/syscalls/swapoff/swapoff02.c
index 61536dda4..5a15826e4 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff02.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff02.c
@@ -87,9 +87,7 @@ static void setup(void)
 	nobody_uid = nobody->pw_uid;
 
 	is_swap_supported(TEST_FILE);
-
-	if (SAFE_MAKE_SWAPFILE_BLKS(SWAP_FILE, 10))
-		tst_brk(TBROK, "Failed to create file for swap");
+	SAFE_MAKE_SWAPFILE_BLKS(SWAP_FILE, 10);
 }
 
 static struct tst_test test = {
-- 
2.43.0



More information about the ltp mailing list