From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>, Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/2] Add shutdown01 test
Date: Fri, 7 Jun 2024 10:08:43 +0200 [thread overview]
Message-ID: <fa9f917b-2c19-4bbd-b04c-fd958dc11610@suse.com> (raw)
In-Reply-To: <20240605202434.GA452540@pevik>
Hi!
On 6/5/24 22:24, Petr Vorel wrote:
> 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?
In this case, data is not really important because we need to test if
send/recv are disabled after shutdown().
>
>> +
>> + 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
I will fix the rest.
Andrea
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2024-06-07 8:09 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
2024-06-07 8:08 ` Andrea Cervesato via ltp [this message]
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=fa9f917b-2c19-4bbd-b04c-fd958dc11610@suse.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=andrea.cervesato@suse.de \
--cc=pvorel@suse.cz \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.