[LTP] [PATCH 2/2] swapon01: Simplify code, add copyright

Petr Vorel pvorel@suse.cz
Wed Oct 11 18:24:28 CEST 2023


Remove  ambiguous comment with -i option during swapoff,
it's needed for a test cleanup anyway.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
I wonder which command's -i option is meant. runltp -i ? swapon does not
have -i option.

Kind regards,
Petr

 testcases/kernel/syscalls/swapon/swapon01.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c
index 6b7f96cf7..9286751a3 100644
--- a/testcases/kernel/syscalls/swapon/swapon01.c
+++ b/testcases/kernel/syscalls/swapon/swapon01.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 /*
  * Copyright (c) Wipro Technologies Ltd, 2002.  All Rights Reserved.
+ * Copyright (c) Linux Test Project, 2003-2023
  */
 
 /*\
@@ -21,18 +22,11 @@
 
 static void verify_swapon(void)
 {
-	TEST(tst_syscall(__NR_swapon, SWAP_FILE, 0));
+	TST_EXP_PASS(tst_syscall(__NR_swapon, SWAP_FILE, 0));
 
-	if (TST_RET == -1) {
-		tst_res(TFAIL | TTERRNO, "Failed to turn on swapfile");
-	} else {
-		tst_res(TPASS, "Succeeded to turn on swapfile");
-		/*we need to turn this swap file off for -i option */
-		if (tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {
-			tst_brk(TBROK | TERRNO, "Failed to turn off swapfile,"
-				" system reboot after execution of LTP "
-				"test suite is recommended.");
-		}
+	if (tst_syscall(__NR_swapoff, SWAP_FILE) != 0) {
+		tst_brk(TBROK | TERRNO,
+				"Failed to turn off swapfile, system reboot recommended");
 	}
 }
 
-- 
2.42.0



More information about the ltp mailing list