Re: [PATCH net 6/6] selftests: seg6: add test for skb checksum with CHECKSUM_COMPLETE

From: Andrea Mayer

Date: Wed Nov 04 2026 - 20:29:53 EST


On Tue, 3 Nov 2026 11:26:35 +0800
Hangbin Liu <hangbin.liu@xxxxxxxxx> wrote:

> [snip]
> > +
> > +log_test()
> > +{
> > + log_test_expected "$1" "$2" "$3"
> > +}
>
> We'd better use log_test_expected directly, otherwise the log_test in
> lib.sh will be overwrite.

Hi Hangbin,

Right, I will call log_test_expected() directly in v2.

> > +
> > +test_command_or_ksft_skip()
> > +{
> > + local cmd="$1"
> > +
> > + if [ ! -x "$(command -v "${cmd}")" ]; then
> > + echo "SKIP: Could not run test without \"${cmd}\" tool"
> > + exit "${ksft_skip}"
> > + fi
> > +}
>
> Then we can use require_command() in lib.sh here, which will call
> log_test() in lib.sh.

Yes, I will use require_command() too.

> [snip]
> > +
> > +if [ "$(id -u)" -ne 0 ]; then
> > + echo "SKIP: Need root privileges"
> > + exit "${ksft_skip}"
> > +fi
>
> I wonder if there is any one run the selftest with none root privileges.
> Cause almost all the selftests need ip configurations.
> [snip]

The test needs root privileges to create the namespaces, write the
sysctls, add the tc filters and load the BPF programs. Without the
check, a non-root user without these privileges gets a SKIP from a later
check, for example "SKIP: dummy dev not supported", which does not say
that the privileges are missing. With the check, that user gets "SKIP:
Need root privileges". I would prefer to keep it.

Thanks for the review,
Andrea