From: iob via ltp <ltp@lists.linux.it>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v8 4/4] Extend ioctl02 to test termio and termios
Date: Thu, 26 Oct 2023 08:34:58 +0200 [thread overview]
Message-ID: <87lebpnb4v.fsf@> (raw)
In-Reply-To: <20231025221349.GD477570@pevik>
Petr Vorel <pvorel@suse.cz> writes:
> Hi Marius
>
> ...
>> - if (termio.c_iflag != (BRKINT | IGNPAR | INPCK | ISTRIP
>> - | ICRNL | IUCLC | IXON | IXANY | IXOFF)) {
>> - tst_res(TFAIL, "iflag has incorrect value. %o",
>> - termio.c_iflag);
>> - flag++;
>
>> +#define CMP_ATTR(tcexp, tcval, attr) \
>> + do { \
>> + if ((tcval).attr != (tcexp).attr) { \
>> + tst_res(TINFO, #attr " has incorrect value %o", \
>> + (tcval).attr); \
>> + flag++; \
>> + } \
>> + } while (0)
>> +
>> +#define CECK_CONTROL_CHARS(tcval) \
Was this meant to named as CHECK_CONTROL_CHARS?
>> + for (i = 0; i < NCC; i++) { \
>> + if (i == VEOL2) { \
>> + if (!(tcval).c_cc[i]) { \
>> + continue; \
>> + } else { \
>> + tst_res(TFAIL, "control char %d has " \
>> + "incorrect value %d", i, (tcval).c_cc[i]); \
>> + flag++; \
>> + continue; \
>> + } \
>> + } \
>> + if ((tcval).c_cc[i] != CSTART) { \
>> + tst_res(TFAIL, "control char %d has incorrect " \
>> + "value %d.", i, (tcval).c_cc[i]); \
>> + flag++; \
>> + } \
>> }
>
> Could be this written as a function? Or what is the benefit of it? Because
> readability suffers. (We prefer avoid macros, tst_test_macros.h is the exception
> due using kernel syscalls, but readability also suffers).
>
> I know you mentioned C++ in cover letter, but please no C++ :).
>
> Kind regards,
> Petr
--
Sent with my mu4e
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2023-10-26 6:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 11:08 [LTP] [PATCH v8 0/4] Improve ioctl02.c Marius Kittler
2023-10-25 11:08 ` [LTP] [PATCH v8 1/4] Refactor ioctl02.c to use the new test API Marius Kittler
2023-10-25 22:06 ` Petr Vorel
2023-10-25 22:09 ` Petr Vorel
2023-10-25 22:20 ` Petr Vorel
2023-10-25 22:23 ` Petr Vorel
2023-10-25 11:08 ` [LTP] [PATCH v8 2/4] Make checks for termio flags more strict Marius Kittler
2023-10-25 22:31 ` Petr Vorel
2023-10-25 11:08 ` [LTP] [PATCH v8 3/4] Remove disabled code in ioctl02.c Marius Kittler
2023-10-25 22:22 ` Petr Vorel
2023-10-25 11:08 ` [LTP] [PATCH v8 4/4] Extend ioctl02 to test termio and termios Marius Kittler
2023-10-25 22:13 ` Petr Vorel
2023-10-26 6:34 ` iob via ltp [this message]
2023-10-26 8:35 ` Petr Vorel
2023-10-25 21:26 ` [LTP] [PATCH v8 0/4] Improve ioctl02.c Petr Vorel
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=87lebpnb4v.fsf@ \
--to=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=ybonatakis@suse.com \
/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