From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3 3/4] tree: Use TST_EXP_PASS_OR_FAIL() and TST_EXP_FD_OR_FAIL()
Date: Fri, 14 Aug 2026 08:24:34 +0200 [thread overview]
Message-ID: <20260814062434.GD261864@pevik> (raw)
In-Reply-To: <6a7d66d6.be490abf.203406.d67e@mx.google.com>
> Hi Petr,
> > + TST_EXP_FD_OR_FAIL(fd = open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
> the correct usage should be:
> fd = TST_EXP_FD_OR_FAIL(open(FILE_TRUNCATE, O_WRONLY | O_TRUNC, PERM_MODE), exp_err);
Just a note: both compile and works the same (i.e. both are correct), but of
course the variant you suggested (fd = TST_EXP_FD_OR_FAIL...) is clearer.
This is because newer macros use ({ ... TST_RET; }). But the original macro
TEST() use do { ... } while (0), that's why we slightly ugly code:
$ git grep 'TEST.*(fd ='
testcases/kernel/syscalls/fsconfig/fsconfig01.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/fsconfig/fsconfig02.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/fsconfig/fsconfig03.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/fsmount/fsmount02.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/fsopen/fsopen01.c: TEST(fd = fsopen(tst_device->fs_type, tc->flags));
testcases/kernel/syscalls/move_mount/move_mount01.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/move_mount/move_mount02.c: TEST(fd = fsopen(tst_device->fs_type, 0));
testcases/kernel/syscalls/mq_open/mq_open01.c: TEST(fd = mq_open(qname, tc->oflag, S_IRWXU, tc->rq));
testcases/kernel/syscalls/name_to_handle_at/name_to_handle_at01.c: TEST(fd = open_by_handle_at(*tc->dfd, fhp, tc->flags));
testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at01.c: TEST(fd = open_by_handle_at(*tc->dfd, *tc->fhp, tc->flags));
testcases/kernel/syscalls/open_by_handle_at/open_by_handle_at02.c: TEST(fd = open_by_handle_at(tc->dfd, *tc->fhp, tc->flags));
testcases/kernel/syscalls/openat2/openat201.c: TEST(fd = openat2(*tc->dfd, tc->pathname, myhow, tc->size));
testcases/kernel/syscalls/socket/socket01.c: TEST(fd = socket(tc->domain, tc->type, tc->proto));
Anyway, this could be fixed before merge if this is a single thing to fix, but I
worry about agents findings:
https://lore.kernel.org/ltp/20260811160555.9333-1-linuxtestproject.agent@gmail.com/
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-14 6:25 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 15:51 [LTP] [PATCH v3 0/4] test_macros: Add TST_EXP_PASS_OR_FAIL() Petr Vorel
2026-08-11 15:51 ` [LTP] [PATCH v3 1/4] test macros: Fix TST_EXP_FD_OR_FAIL() Petr Vorel
2026-08-11 16:05 ` [LTP] " linuxtestproject.agent
2026-08-12 14:44 ` [LTP] [PATCH v3 1/4] " Cyril Hrubis
2026-08-13 6:40 ` Andrea Cervesato via ltp
2026-08-11 15:52 ` [LTP] [PATCH v3 2/4] test_macros: Add TST_EXP_PASS_OR_FAIL() Petr Vorel
2026-08-12 15:26 ` Cyril Hrubis
2026-08-13 6:41 ` Andrea Cervesato via ltp
2026-08-11 15:52 ` [LTP] [PATCH v3 3/4] tree: Use TST_EXP_PASS_OR_FAIL() and TST_EXP_FD_OR_FAIL() Petr Vorel
2026-08-13 6:40 ` Andrea Cervesato via ltp
2026-08-14 6:24 ` Petr Vorel [this message]
2026-08-14 6:35 ` Petr Vorel
2026-08-19 13:53 ` Petr Vorel
2026-08-20 7:52 ` Andrea Cervesato via ltp
2026-08-11 15:52 ` [LTP] [PATCH v3 4/4] test_macros*.c: Simplify with macros macros Petr Vorel
2026-08-20 7:51 ` Andrea Cervesato via ltp
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=20260814062434.GD261864@pevik \
--to=pvorel@suse.cz \
--cc=andrea.cervesato@suse.com \
--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