Merge branch 'selftests-net-use-khdr_includes-in-cflags'

Matthieu Baerts says:

====================
selftests: net: use KHDR_INCLUDES in CFLAGS

KHDR_INCLUDES is typically used to include headers from the kernel
source directory instead of only relying on the ones from the host: they
can be missing or outdated. See the issue reported in [1] where users
have to set USERCFLAGS instead, which shouldn't be needed.

The kselftest doc [2] recommends assigning KHDR_INCLUDES to CFLAGS in a
target Makefile. lib.mk will set KHDR_INCLUDES to "-isystem
$(top_srcdir)/usr/include" if the user didn't set it, e.g. if the kernel
was built in a different build directory.

Other net targets have KHDR_INCLUDES added to their CFLAGS.

Link: https://lore.kernel.org/275ba183-49fd-45b1-881d-0f362b4c74c0@ovn.org [1]
Link: https://docs.kernel.org/dev-tools/kselftest.html#contributing-new-tests-details [2]
====================

Link: https://patch.msgid.link/20260904-net-sft-nf-khdr_includes-v1-0-92455af428e9@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2026-09-09 13:49:42 -07:00
commit ea8cc4480f
2 changed files with 4 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0+ OR MIT
CFLAGS += $(KHDR_INCLUDES)
TEST_PROGS := \
bridge_activity_notify.sh \
bridge_fdb_learning_limit.sh \

View File

@ -2,6 +2,8 @@
top_srcdir = ../../../../..
CFLAGS += $(KHDR_INCLUDES)
HOSTPKG_CONFIG := pkg-config
MNL_CFLAGS := $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null)
MNL_LDLIBS := $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl)