Thread (6 messages) flat view 6 messages, 2 authors, 5d ago

Re: [PATCH net-next v2] selftests: net: move log_test to lib file and remove duplicate code

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-08-31 15:03:22
Also in: linux-kselftest, lkml

On Mon, 31 Aug 2026 17:21:28 +0800 Hangbin Liu wrote:
Many test scripts under tools/testing/selftests/net/ each define their own
log_test() function with near-identical logic for comparing a return
code against an expected value and printing OK/FAIL. Add a shared
log_test_expected() to lib.sh and replace each local definition with a
thin wrapper that delegates to it.

The function is named log_test_expected() rather than log_test() because
lib.sh already exports log_test() with a different signature used by
the forwarding tests.

Two tests required special handling:

- icmp_redirect.sh passed a fourth "xfail" argument to log_test(). The
  underlying issue has been fixed and the argument is always absent now,
  so it is simply dropped.

- fib_nexthops.sh checked for ksft_skip (exit code 4) inside log_test(),
  but no test in the file produces that code. The check is removed,
  callers that need to report a skip should use log_test_skip() instead.
  Two callers compared against exit code 2 are left as-is since code 2
  correctly counts as a failure in the previous log_test().
still breaks fib_tests.sh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help