[LTP] [PATCH v3] io_submit04: Add test case for RWF_NOWAIT flag

Jan Stancek jstancek@redhat.com
Wed Jan 7 09:53:22 CET 2026


On Tue, Jan 6, 2026 at 9:39 AM Petr Vorel <pvorel@suse.cz> wrote:
>
> Hi all,
>
> ...
> > > > +static void run(void)
> > > > +{
> > > > + struct io_event evbuf;
> > > > + struct timespec timeout = { .tv_sec = 1 };
> > > > + long nr = 1;
> > > > +
> > > > + TEST(tst_syscall(__NR_io_submit, ctx, nr, iocbs));
> > > > +
> > > > + if (TST_RET == nr)
> > > > +         tst_res(TPASS, "io_submit() pass");
> > > > + else
> > > > +         tst_res(TFAIL | TTERRNO, "io_submit() returns %ld, expected %ld", TST_RET, nr);
>
> > > Our goal is to verify that io_getevents() returns EAGAIN, so we can just:
>
> > > if (TST_RET != nr) {
> > >     tst_res(TBROK | TTERRNO, "io_submit() returns %ld, expected %ld", TST_RET, nr);
> > >     return;
> > > }
>
> > > We return because if io_submit() fails there's nothing to do more.
> > tst_res(TBROK will trigger error such as :
> > make[1]: Leaving directory '/home/wegao/ltp/lib'
> > In file included from ../../../../include/tst_test.h:20,
> >                  from io_submit04.c:14:
> > io_submit04.c: In function ‘run’:
> > ../../../../include/tst_common.h:80:32: error: size of unnamed array is negative
> >    80 |         do { ((void)sizeof(char[1 - 2 * !!(condition)])); } while (0)
> >       |                                ^
> > ../../../../include/tst_common.h:83:9: note: in expansion of macro ‘TST_BUILD_BUG_ON’
> >    83 |         TST_BUILD_BUG_ON(condition)
> >       |         ^~~~~~~~~~~~~~~~
> > ../../../../include/tst_test.h:71:17: note: in expansion of macro ‘TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN’
> >    71 |                 TST_RES_SUPPORTS_TCONF_TDEBUG_TFAIL_TINFO_TPASS_TWARN(\
> >       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > io_submit04.c:63:17: note: in expansion of macro ‘tst_res’
> >    63 |                 tst_res(TBROK | TTERRNO, "io_submit() returns %ld, expected %ld",
> >       |                 ^~~~~~~
> > make: *** [../../../../include/mk/rules.mk:48: io_submit04] Error 1
> > -bash: ./io_submit04: No such file or directory
>
> > So i suppose we need use "tst_brk(TBROK" without return, correct?
>
> Yes, that's a macro which enforces using TBROK only with tst_brk().
>
> @Cyril @Li @Jan I wonder if we still need this enforcement after Cyril's change
> a1f82704c2 ("lib/tst_test.c: Fix tst_brk() handling")

Looking at differences between tst_res_() and tst_vbrk_() , vbrk_ has
some additional cleanup calls
so they don't look to be exactly identical. I'd keep it to encourage
usage of tst_brk() if you need
to abort the test (from any context: library, test, test children).



More information about the ltp mailing list