From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/2] Add shutdown01 test
Date: Wed, 5 Jun 2024 22:24:34 +0200 [thread overview]
Message-ID: <20240605202434.GA452540@pevik> (raw)
In-Reply-To: <20240527-shutdown-v1-1-1feffca5e3df@suse.com>
Hi Andrea,
...
> diff --git a/testcases/kernel/syscalls/shutdown/shutdown01.c b/testcases/kernel/syscalls/shutdown/shutdown01.c
> new file mode 100644
> index 000000000..b68b14ae8
> --- /dev/null
> +++ b/testcases/kernel/syscalls/shutdown/shutdown01.c
> @@ -0,0 +1,136 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * [Description]
> + *
> + * This test verifies the following shutdown() functionalities:
nit: here needs to be blank line to get list formatting.
> + * * SHUT_RD should enable send() ops but disable recv() ops
> + * * SHUT_WR should enable recv() ops but disable send() ops
> + * * SHUT_RDWR should disable both recv() and send() ops
> + */
...
> +static void test_shutdown_recv(void)
> +{
> + int client_sock;
> + char buff[MSGSIZE] = {0};
Wouldn't it be better to send some data?
Or is it not important, we use guarded buffers?
> +
> + client_sock = start_test();
> +
> + tst_res(TINFO, "Testing SHUT_RD flag");
> +
> + TST_EXP_PASS(shutdown(client_sock, SHUT_RD));
> + TST_EXP_EQ_LI(recv(client_sock, buff, MSGSIZE, 0), 0);
Interesting, I would expect failure ("If how is SHUT_RD, further receptions will
be disallowed.")
And maybe use SAFE_RECV()?
> + TST_EXP_EQ_LI(send(client_sock, buff, MSGSIZE, 0), MSGSIZE);
And SAFE_SEND() here?
> +
> + SAFE_CLOSE(client_sock);
> + TST_CHECKPOINT_WAKE(0);
> +}
nit: I would also use struct tcase and .tcnt, because all 3 tests are nearly
identical.
Otherwise LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-06-05 20:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 6:30 [LTP] [PATCH 0/2] shutdown testing suite Andrea Cervesato
2024-05-27 6:30 ` [LTP] [PATCH 1/2] Add shutdown01 test Andrea Cervesato
2024-06-05 20:24 ` Petr Vorel [this message]
2024-06-07 8:08 ` Andrea Cervesato via ltp
2024-05-27 6:30 ` [LTP] [PATCH 2/2] Add shutdown02 test Andrea Cervesato
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240605202434.GA452540@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox