Message ID | 20231011162428.583911-3-pvorel@suse.cz |
---|---|
State | Accepted |
Headers | show |
Series | swapon01: Test on all filesystems, cleanup | expand |
Hi! > /*\ > @@ -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) { Maybe if (TST_PASS && tst_syscall(__NR_swapoff, ...) != 0) { Otherwise it looks good, with that change: Reviewed-by: Cyril Hrubis <chrubis@suse.cz> > + tst_brk(TBROK | TERRNO, > + "Failed to turn off swapfile, system reboot recommended"); > } > } > > -- > 2.42.0 >
Hi Cyril, > Hi! > > /*\ > > @@ -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) { > Maybe if (TST_PASS && tst_syscall(__NR_swapoff, ...) != 0) { Rebased, add this change and merged. Thanks! Kind regards, Petr > Otherwise it looks good, with that change: > Reviewed-by: Cyril Hrubis <chrubis@suse.cz> > > + tst_brk(TBROK | TERRNO, > > + "Failed to turn off swapfile, system reboot recommended"); > > } > > } > > -- > > 2.42.0
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"); } }
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(-)