public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile()
@ 2024-01-19 13:52 Petr Vorel
  2024-01-20  8:34 ` Li Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2024-01-19 13:52 UTC (permalink / raw)
  To: ltp

Not only that enum is better than int (we should not rely on
TST_CMD_PASS_RETVAL being 1, but also it was missing
TST_CMD_TCONF_ON_MISSING, thus on systems without mkswap test reported
wrong results on filesystems which supports swap:

TFAIL: mkswap on ext2/ext3/ext4 failed

Now it correctly print:

tst_cmd.c:75: TCONF: Couldn't find '___mkswap' in $PATH at tst_cmd.c:75

Fixes: ec51970b7 ("lib/tst_cmd_*(): Turn int pass_exit_val into enum")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

obviously OK, but before git freeze I rather post than directly push.

Kind regards,
Petr

 libs/libltpswap/libswap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libs/libltpswap/libswap.c b/libs/libltpswap/libswap.c
index d014325e5..13610709e 100644
--- a/libs/libltpswap/libswap.c
+++ b/libs/libltpswap/libswap.c
@@ -30,7 +30,8 @@ int make_swapfile(const char *swapfile, int safe)
 	argv[1] = swapfile;
 	argv[2] = NULL;
 
-	return tst_cmd(argv, "/dev/null", "/dev/null", safe);
+	return tst_cmd(argv, "/dev/null", "/dev/null", safe ?
+				   TST_CMD_PASS_RETVAL | TST_CMD_TCONF_ON_MISSING : 0);
 }
 
 /*
-- 
2.43.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile()
  2024-01-19 13:52 [LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile() Petr Vorel
@ 2024-01-20  8:34 ` Li Wang
  2024-01-22  7:07   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2024-01-20  8:34 UTC (permalink / raw)
  To: Petr Vorel; +Cc: ltp

Reviewed-by: Li Wang <liwang@redhat.com>


-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile()
  2024-01-20  8:34 ` Li Wang
@ 2024-01-22  7:07   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2024-01-22  7:07 UTC (permalink / raw)
  To: Li Wang; +Cc: ltp

Hi Li,

> Reviewed-by: Li Wang <liwang@redhat.com>

Thanks, merged!

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-22  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-19 13:52 [LTP] [RFC PATCH 1/1] libswap: Pass enum instead of int to make_swapfile() Petr Vorel
2024-01-20  8:34 ` Li Wang
2024-01-22  7:07   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox