[LTP] [PATCH v1] recvmsg01: Refactor using new LTP API
Petr Vorel
pvorel@suse.cz
Thu Mar 30 07:58:02 CEST 2023
Hi Wei,
{
PF_INET, SOCK_STREAM, 0, iov, 1, (void *)buf, sizeof(buf),
&msgdat, -1, (struct sockaddr *)&from, -1, -1,
EINVAL, setup1, cleanup1, "invalid socket length"},
.flags is -1 here, it's unsigned int, please use UINT_MAX (the same value, but
more obvious).
> - for (lc = 0; TEST_LOOPING(lc); ++lc) {
> - tst_count = 0;
> - for (testno = 0; testno < TST_TOTAL; ++testno) {
> - if ((tst_kvercmp(3, 17, 0) < 0)
> - && (tdat[testno].flags & MSG_ERRQUEUE)
> - && (tdat[testno].type & SOCK_STREAM)) {
> - tst_resm(TCONF, "skip MSG_ERRQUEUE test, "
> - "it's supported from 3.17");
> - continue;
> - }
...
> + if ((tst_kvercmp(3, 17, 0) < 0)
> + && (tc->flags & MSG_ERRQUEUE)
> + && (tc->type & SOCK_STREAM)) {
> + tst_res(TCONF, "skip MSG_ERRQUEUE test, "
> + "it's supported from 3.17");
The reason for the MSG_ERRQUEUE on SOCK_STREAM was described in
e5fd512d8 ("skip MSG_ERRQUEUE+tcp test on kernels < 3.17")
The limitation for MSG_ERRQUEUE is only on SOCK_STREAM, but because MSG_ERRQUEUE
is tested only on SOCK_STREAM, it should be enough to check just MSG_ERRQUEUE.
Also, UINT_MAX & MSG_ERRQUEUE is always true (in "invalid socket length") and I
don't think that test should be skipped.
The check could be:
if (tc->flags != UINT_MAX && tc->flags & MSG_ERRQUEUE
&& tst_kvercmp(3, 17, 0) < 0) {
tst_res(TCONF, "MSG_ERRQUEUE support for TCP has been added in 3.17");
}
Kind regards,
Petr
More information about the ltp
mailing list