* [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
@ 2026-07-30 14:46 Sebastian Chlad
2026-07-30 18:27 ` Kuniyuki Iwashima
0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Chlad @ 2026-07-30 14:46 UTC (permalink / raw)
To: netdev; +Cc: Kuniyuki Iwashima, Sebastian Chlad
SO_INQ was added in df30285b3670 ("af_unix: Introduce SO_INQ."). On
older kernels this returns -ENOPROTOOPT for SOCK_STREAM too, which
scm_inq.basic/partial_read currently treat as a failure.
Enabling SO_INQ here is only a precondition for the actual test: the
SCM_INQ/ioctl(SIOCINQ) consistency checks that follow. SKIP when the
precondition itself isn't met, rather than asserting it succeeds.
Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
---
tools/testing/selftests/net/af_unix/scm_inq.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/net/af_unix/scm_inq.c b/tools/testing/selftests/net/af_unix/scm_inq.c
index 6268b5bf50be..2868cce61a9a 100644
--- a/tools/testing/selftests/net/af_unix/scm_inq.c
+++ b/tools/testing/selftests/net/af_unix/scm_inq.c
@@ -111,6 +111,9 @@ TEST_F(scm_inq, basic)
return;
}
+ if (err && errno == ENOPROTOOPT)
+ SKIP(return, "SO_INQ is not supported");
+
ASSERT_EQ(0, err);
err = ioctl(self->fd[1], SIOCINQ, &inq);
@@ -136,6 +139,10 @@ TEST_F(scm_inq, partial_read)
ASSERT_EQ(-ENOPROTOOPT, -errno);
return;
}
+
+ if (err && errno == ENOPROTOOPT)
+ SKIP(return, "SO_INQ is not supported");
+
ASSERT_EQ(0, err);
ret = send(self->fd[0], buf, sizeof(buf), 0);
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
2026-07-30 14:46 [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported Sebastian Chlad
@ 2026-07-30 18:27 ` Kuniyuki Iwashima
2026-07-31 5:41 ` Sebastian Chlad
0 siblings, 1 reply; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-07-30 18:27 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: netdev, Sebastian Chlad
On Thu, Jul 30, 2026 at 4:46 PM Sebastian Chlad
<sebastianchlad@gmail.com> wrote:
>
> SO_INQ was added in df30285b3670 ("af_unix: Introduce SO_INQ."). On
> older kernels this returns -ENOPROTOOPT for SOCK_STREAM too, which
> scm_inq.basic/partial_read currently treat as a failure.
>
> Enabling SO_INQ here is only a precondition for the actual test: the
> SCM_INQ/ioctl(SIOCINQ) consistency checks that follow. SKIP when the
> precondition itself isn't met, rather than asserting it succeeds.
>
> Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> ---
> tools/testing/selftests/net/af_unix/scm_inq.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/tools/testing/selftests/net/af_unix/scm_inq.c b/tools/testing/selftests/net/af_unix/scm_inq.c
> index 6268b5bf50be..2868cce61a9a 100644
> --- a/tools/testing/selftests/net/af_unix/scm_inq.c
> +++ b/tools/testing/selftests/net/af_unix/scm_inq.c
> @@ -111,6 +111,9 @@ TEST_F(scm_inq, basic)
> return;
> }
>
> + if (err && errno == ENOPROTOOPT)
> + SKIP(return, "SO_INQ is not supported");
> +
It seems you missed this in the few lines above.
if (variant->type != SOCK_STREAM) {
ASSERT_EQ(-ENOPROTOOPT, -errno);
return;
}
---
pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
2026-07-30 18:27 ` Kuniyuki Iwashima
@ 2026-07-31 5:41 ` Sebastian Chlad
2026-07-31 5:53 ` Kuniyuki Iwashima
0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Chlad @ 2026-07-31 5:41 UTC (permalink / raw)
To: Kuniyuki Iwashima; +Cc: Sebastian Chlad, netdev
On Thu, Jul 30, 2026 at 8:28 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
>
> On Thu, Jul 30, 2026 at 4:46 PM Sebastian Chlad
> <sebastianchlad@gmail.com> wrote:
> >
> > SO_INQ was added in df30285b3670 ("af_unix: Introduce SO_INQ."). On
> > older kernels this returns -ENOPROTOOPT for SOCK_STREAM too, which
> > scm_inq.basic/partial_read currently treat as a failure.
> >
> > Enabling SO_INQ here is only a precondition for the actual test: the
> > SCM_INQ/ioctl(SIOCINQ) consistency checks that follow. SKIP when the
> > precondition itself isn't met, rather than asserting it succeeds.
> >
> > Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> > ---
> > tools/testing/selftests/net/af_unix/scm_inq.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/tools/testing/selftests/net/af_unix/scm_inq.c b/tools/testing/selftests/net/af_unix/scm_inq.c
> > index 6268b5bf50be..2868cce61a9a 100644
> > --- a/tools/testing/selftests/net/af_unix/scm_inq.c
> > +++ b/tools/testing/selftests/net/af_unix/scm_inq.c
> > @@ -111,6 +111,9 @@ TEST_F(scm_inq, basic)
> > return;
> > }
> >
> > + if (err && errno == ENOPROTOOPT)
> > + SKIP(return, "SO_INQ is not supported");
> > +
>
> It seems you missed this in the few lines above.
>
> if (variant->type != SOCK_STREAM) {
> ASSERT_EQ(-ENOPROTOOPT, -errno);
> return;
> }
Isn't that just a guard for not exercising the tests against dgram and
seqpacket?
So the if condition I proposed is for SOCK_STREAM where SO_INQ isn't supported.
When I run af_unix against 6.12 with no SO_INQ, I get both
scm_inq.stream.basic and scm_inq.stream.partial_read failing. With the
patch, both tests are skipped.
Albeit I agree, if this test is run for stream af_unix not having
SO_INQ, it should be excluded altogether. After all the point of the
test is to test behaviour of SO_INQ.
Still marking the tests as skipped instead of failed for older kernels
is somewhat useful.
>
> ---
> pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
2026-07-31 5:41 ` Sebastian Chlad
@ 2026-07-31 5:53 ` Kuniyuki Iwashima
2026-07-31 5:57 ` Sebastian Chlad
2026-08-31 15:57 ` Michal Koutný
0 siblings, 2 replies; 6+ messages in thread
From: Kuniyuki Iwashima @ 2026-07-31 5:53 UTC (permalink / raw)
To: Sebastian Chlad; +Cc: Sebastian Chlad, netdev
On Fri, Jul 31, 2026 at 7:41 AM Sebastian Chlad
<sebastian.chlad@suse.com> wrote:
>
> On Thu, Jul 30, 2026 at 8:28 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> >
> > On Thu, Jul 30, 2026 at 4:46 PM Sebastian Chlad
> > <sebastianchlad@gmail.com> wrote:
> > >
> > > SO_INQ was added in df30285b3670 ("af_unix: Introduce SO_INQ."). On
> > > older kernels this returns -ENOPROTOOPT for SOCK_STREAM too, which
> > > scm_inq.basic/partial_read currently treat as a failure.
> > >
> > > Enabling SO_INQ here is only a precondition for the actual test: the
> > > SCM_INQ/ioctl(SIOCINQ) consistency checks that follow. SKIP when the
> > > precondition itself isn't met, rather than asserting it succeeds.
> > >
> > > Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> > > ---
> > > tools/testing/selftests/net/af_unix/scm_inq.c | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/tools/testing/selftests/net/af_unix/scm_inq.c b/tools/testing/selftests/net/af_unix/scm_inq.c
> > > index 6268b5bf50be..2868cce61a9a 100644
> > > --- a/tools/testing/selftests/net/af_unix/scm_inq.c
> > > +++ b/tools/testing/selftests/net/af_unix/scm_inq.c
> > > @@ -111,6 +111,9 @@ TEST_F(scm_inq, basic)
> > > return;
> > > }
> > >
> > > + if (err && errno == ENOPROTOOPT)
> > > + SKIP(return, "SO_INQ is not supported");
> > > +
> >
> > It seems you missed this in the few lines above.
> >
> > if (variant->type != SOCK_STREAM) {
> > ASSERT_EQ(-ENOPROTOOPT, -errno);
> > return;
> > }
>
> Isn't that just a guard for not exercising the tests against dgram and
> seqpacket?
> So the if condition I proposed is for SOCK_STREAM where SO_INQ isn't supported.
> When I run af_unix against 6.12 with no SO_INQ, I get both
> scm_inq.stream.basic and scm_inq.stream.partial_read failing. With the
> patch, both tests are skipped.
Why is this selftest backported to the kernel without the
functional changes ? That's the problem.
>
> Albeit I agree, if this test is run for stream af_unix not having
> SO_INQ, it should be excluded altogether. After all the point of the
> test is to test behaviour of SO_INQ.
> Still marking the tests as skipped instead of failed for older kernels
> is somewhat useful.
>
> >
> > ---
> > pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
2026-07-31 5:53 ` Kuniyuki Iwashima
@ 2026-07-31 5:57 ` Sebastian Chlad
2026-08-31 15:57 ` Michal Koutný
1 sibling, 0 replies; 6+ messages in thread
From: Sebastian Chlad @ 2026-07-31 5:57 UTC (permalink / raw)
To: Kuniyuki Iwashima; +Cc: Sebastian Chlad, netdev
On Fri, Jul 31, 2026 at 7:54 AM Kuniyuki Iwashima <kuniyu@google.com> wrote:
>
> On Fri, Jul 31, 2026 at 7:41 AM Sebastian Chlad
> <sebastian.chlad@suse.com> wrote:
> >
> > On Thu, Jul 30, 2026 at 8:28 PM Kuniyuki Iwashima <kuniyu@google.com> wrote:
> > >
> > > On Thu, Jul 30, 2026 at 4:46 PM Sebastian Chlad
> > > <sebastianchlad@gmail.com> wrote:
> > > >
> > > > SO_INQ was added in df30285b3670 ("af_unix: Introduce SO_INQ."). On
> > > > older kernels this returns -ENOPROTOOPT for SOCK_STREAM too, which
> > > > scm_inq.basic/partial_read currently treat as a failure.
> > > >
> > > > Enabling SO_INQ here is only a precondition for the actual test: the
> > > > SCM_INQ/ioctl(SIOCINQ) consistency checks that follow. SKIP when the
> > > > precondition itself isn't met, rather than asserting it succeeds.
> > > >
> > > > Signed-off-by: Sebastian Chlad <sebastian.chlad@suse.com>
> > > > ---
> > > > tools/testing/selftests/net/af_unix/scm_inq.c | 7 +++++++
> > > > 1 file changed, 7 insertions(+)
> > > >
> > > > diff --git a/tools/testing/selftests/net/af_unix/scm_inq.c b/tools/testing/selftests/net/af_unix/scm_inq.c
> > > > index 6268b5bf50be..2868cce61a9a 100644
> > > > --- a/tools/testing/selftests/net/af_unix/scm_inq.c
> > > > +++ b/tools/testing/selftests/net/af_unix/scm_inq.c
> > > > @@ -111,6 +111,9 @@ TEST_F(scm_inq, basic)
> > > > return;
> > > > }
> > > >
> > > > + if (err && errno == ENOPROTOOPT)
> > > > + SKIP(return, "SO_INQ is not supported");
> > > > +
> > >
> > > It seems you missed this in the few lines above.
> > >
> > > if (variant->type != SOCK_STREAM) {
> > > ASSERT_EQ(-ENOPROTOOPT, -errno);
> > > return;
> > > }
> >
> > Isn't that just a guard for not exercising the tests against dgram and
> > seqpacket?
> > So the if condition I proposed is for SOCK_STREAM where SO_INQ isn't supported.
> > When I run af_unix against 6.12 with no SO_INQ, I get both
> > scm_inq.stream.basic and scm_inq.stream.partial_read failing. With the
> > patch, both tests are skipped.
>
> Why is this selftest backported to the kernel without the
> functional changes ? That's the problem.
I'm trying to run the latest selftests af_unix code against all tested
kernels and in the process I try
to see if some guards can be introduced to make that possible.
>
>
> >
> > Albeit I agree, if this test is run for stream af_unix not having
> > SO_INQ, it should be excluded altogether. After all the point of the
> > test is to test behaviour of SO_INQ.
> > Still marking the tests as skipped instead of failed for older kernels
> > is somewhat useful.
> >
> > >
> > > ---
> > > pw-bot: cr
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported
2026-07-31 5:53 ` Kuniyuki Iwashima
2026-07-31 5:57 ` Sebastian Chlad
@ 2026-08-31 15:57 ` Michal Koutný
1 sibling, 0 replies; 6+ messages in thread
From: Michal Koutný @ 2026-08-31 15:57 UTC (permalink / raw)
To: Kuniyuki Iwashima; +Cc: Sebastian Chlad, Sebastian Chlad, netdev
[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]
Hi Kuniyuki.
On Fri, Jul 31, 2026 at 07:53:59AM +0200, Kuniyuki Iwashima <kuniyu@google.com> wrote:
> Why is this selftest backported to the kernel without the
> functional changes ? That's the problem.
Let me join the topic and vouch for the changes from Sebastian.
I consider there's a scale of selftests from validation of bugfixes to
checking of features. Another axis is the discoverability of the
supported features by the kernel (none ... CONFIG_ check ... runtime
indicator).
I've found it quite useful to have one set of tests that can be run
across different kernel versions (think of stable kernels), the
maintenance is simpler, sometimes even same builds may be reused.
Occasionally a reported failure raises unnecessary alarms when it is
actually only a missing or disabled feature.
So when the behavior is on the right side of the above spaces
(feature*discoverability), it is relatively easy to add a guard in the
selftest proper. That is something what've been striving for in cgroup
selftests.
Obviously, the dividing line for a good guard is not always clear cut,
in such cases it remains up to the interpreter of the test output to
decide how serious the failures are.
Here I think the ENOPROTOOPT are suitable for the feature detection.
Regards,
Michal
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-31 15:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-30 14:46 [PATCH net] selftests: af_unix: skip scm_inq tests when SO_INQ is unsupported Sebastian Chlad
2026-07-30 18:27 ` Kuniyuki Iwashima
2026-07-31 5:41 ` Sebastian Chlad
2026-07-31 5:53 ` Kuniyuki Iwashima
2026-07-31 5:57 ` Sebastian Chlad
2026-08-31 15:57 ` Michal Koutný
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.