thom311 / libnl

Netlink Library Suite
GNU Lesser General Public License v2.1
419 stars 311 forks source link

libnl-3.8.0 fails checks #361

Closed bdubbs closed 9 months ago

bdubbs commented 1 year ago

./configure make make check

Testsuite summary for libnl 3.8.0

TOTAL: 2

PASS: 1

SKIP: 0

XFAIL: 0

FAIL: 1

From test-suite.log:

FAIL: tests/check-all

Running suite(s): main Abstract addresses Netlink attributes Clone ematch tree runs with NLTST_SEED_RAND=0 netns 37%: Checks: 29, Failures: 18, Errors: 0 tests/nl-test-util.c:125:S:Core:cache_and_clone:0: assert(r == 0) failed (errno=22, Invalid argument) tests/nl-test-util.c:125:S:Core:test_create_iface:0: assert(r == 0) failed (errno=22, Invalid argument)

And failures for test_create_iface:1 through test_create_iface:16

thom311 commented 1 year ago

on your system unshare(CLONE_NEWUSER) fails with EINVAL.

what gives unshare -U true and strace unshare -U true

bdubbs commented 1 year ago

Indeed, I did not have CONFIG_USER_NS set in the kernel. The tests now only have six failures:

Running suite(s): main Abstract addresses Netlink attributes Clone ematch tree runs with NLTST_SEED_RAND=0 netns ... 79%: Checks: 29, Failures: 6, Errors: 0 tests/nl-test-util.c:389:F:Core:cache_and_clone:0: Assertion 'r == 0' failed: r == -10, 0 == 0 tests/nl-test-util.c:389:F:Core:test_create_iface:10: Assertion 'r == 0' failed: r == -10, 0 == 0 also for test_create_iface:11, 12, 13, 14.

What else am I missing?

It would help to have some documentation on the tests.

thom311 commented 10 months ago

I think the test should be adjusted, so that it can gracefully skip if user-ns doesn't work.

thom311 commented 9 months ago

anyway...

so, the test suite uses a network namespace to run. If you don't have the required permissions, the test suite fails. That's a known issue.

What probably makes sense, to gracefully handle the error and skip the tests in those case. Patch welcome. But that is not going to "fix" the tests, it will merely skip them automatically.

Closing this, because the problem is an unsupported usage (though, patches are welcome to better support it).

xry111 commented 9 months ago

Besides the namespaces, if I read the code correctly it also requires some other kernel configuration items, like CONFIG_BRIDGE.

It would be better to document these requirements somewhere.

thom311 commented 9 months ago

the unit tests are for developers of the library itself. They don't have proper documentation, but sure, maybe this could be explained somewhere (patch welcome).

In any case, if you build a kernel without CONFIG_BRIDGE, it seems you are the exception already. You are very welcome to just not run the unit tests (or send a patch to handle this better).