Commit fec2e55bdef ("selftests: drv-net: Pull data before parsing headers")
added __ksym external symbol to xdp_native.bpf.c which now requires
a kernel with BTF. Enable BTF for driver selftests.

Before:

  # TAP version 13
  # 1..10
  # # Exception| Traceback (most recent call last):
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/ksft.py", line 244, in 
ksft_run
  # # Exception|     case(*args)
  # # Exception|     ~~~~^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 231, 
in test_xdp_native_pass_sb
  # # Exception|     _test_pass(cfg, bpf_info, 256)
  # # Exception|     ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 209, 
in _test_pass
  # # Exception|     prog_info = _load_xdp_prog(cfg, bpf_info)
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 114, 
in _load_xdp_prog
  # # Exception|     cmd(
  # # Exception|     ~~~^
  # # Exception|     f"ip link set dev {cfg.ifname} mtu {bpf_info.mtu} xdpdrv 
obj {abs_path} sec {bpf_info.xdp_sec}",
  # # Exception|     
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  # # Exception|     shell=True
  # # Exception|     ^^^^^^^^^^
  # # Exception|     )
  # # Exception|     ^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/utils.py", line 75, in 
__init__
  # # Exception|     self.process(terminate=False, fail=fail, timeout=timeout)
  # # Exception|     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/utils.py", line 95, in 
process
  # # Exception|     raise CmdExitFailure("Command failed: %s\nSTDOUT: 
%s\nSTDERR: %s" %
  # # Exception|                          (self.proc.args, stdout, stderr), 
self)
  # # Exception| net.lib.py.utils.CmdExitFailure: Command failed: ip link set 
dev eni30773np1 mtu 1500 xdpdrv obj 
/home/sdf/src/linux/tools/testing/selftests/net/lib/xdp_native.bpf.o sec xdp
  # # Exception| STDOUT: b''
  # # Exception| STDERR: b"libbpf: kernel BTF is missing at 
'/sys/kernel/btf/vmlinux', was CONFIG_DEBUG_INFO_BTF enabled?\nlibbpf: failed 
to find '.BTF' ELF section in 
/lib/modules/6.17.0-rc6-virtme/build/vmlinux\nlibbpf: failed to find valid 
kernel BTF\nlib
  bpf: Error loading vmlinux BTF: -3\nlibbpf: failed to load object 
'/home/sdf/src/linux/tools/testing/selftests/net/lib/xdp_native.bpf.o'\n"
  # not ok 1 xdp.test_xdp_native_pass_sb
  ...

After:

  # TAP version 13
  # 1..10
  # ok 1 xdp.test_xdp_native_pass_sb
  # ok 2 xdp.test_xdp_native_pass_mb
  # ok 3 xdp.test_xdp_native_drop_sb
  # ok 4 xdp.test_xdp_native_drop_mb
  # ok 5 xdp.test_xdp_native_tx_sb
  # ok 6 xdp.test_xdp_native_tx_mb
  # # Ignoring SIGTERM (cnt: 2), already exiting...
  # # Ignoring SIGTERM (cnt: 3), already exiting...
  # # Exception| Traceback (most recent call last):
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/ksft.py", line 244, in 
ksft_run
  # # Exception|     case(*args)
  # # Exception|     ~~~~^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 506, 
in test_xdp_native_adjst_taa
  # # Exception|     res = _test_xdp_native_tail_adjst(
  # # Exception|         cfg,
  # # Exception|         pkt_sz_lst,
  # # Exception|         offset_lst,
  # # Exception|     )
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 467, 
in _test_xdp_native_tail_adt
  # # Exception|     recvd_str = _exchg_udp(cfg, port, test_str)
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/drivers/net/./xdp.py", line 72, in 
_exchg_udp
  # # Exception|     with bkg(rx_udp_cmd, exit_wait=True) as nc:
  # # Exception|          ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/utils.py", line 137, in 
__exit__
  # # Exception|     return self.process(terminate=terminate, 
fail=self.check_fail)
  # # Exception|            
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/utils.py", line 85, in 
process
  # # Exception|     stdout, stderr = self.proc.communicate(timeout)
  # # Exception|                      ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  # # Exception|   File "/usr/lib/python3.13/subprocess.py", line 1222, in 
communicate
  # # Exception|     stdout, stderr = self._communicate(input, endtime, timeout)
  # # Exception|                      ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  # # Exception|   File "/usr/lib/python3.13/subprocess.py", line 2128, in 
_communicate
  # # Exception|     ready = selector.select(timeout)
  # # Exception|   File "/usr/lib/python3.13/selectors.py", line 398, in select
  # # Exception|     fd_event_list = self._selector.poll(timeout)
  # # Exception|   File 
"/home/sdf/src/linux/tools/testing/selftests/net/lib/py/ksft.py", line 208, in 
_ksft_intr
  # # Exception|     raise KsftTerminate()
  # # Exception| net.lib.py.ksft.KsftTerminate
  # # Stopping tests due to KsftTerminate.
  # not ok 7 xdp.test_xdp_native_adjst_tail_grow_data
  # # Totals: pass:6 fail:1 xfail:0 xpass:0 skip:0 error:0

Signed-off-by: Stanislav Fomichev <[email protected]>
---
 tools/testing/selftests/drivers/net/config | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/config 
b/tools/testing/selftests/drivers/net/config
index f27172ddee0a..da5a5a94fa6a 100644
--- a/tools/testing/selftests/drivers/net/config
+++ b/tools/testing/selftests/drivers/net/config
@@ -5,3 +5,5 @@ CONFIG_NETCONSOLE=m
 CONFIG_NETCONSOLE_DYNAMIC=y
 CONFIG_NETCONSOLE_EXTENDED_LOG=y
 CONFIG_XDP_SOCKETS=y
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_DEBUG_INFO_BTF_MODULES=n
-- 
2.51.0


Reply via email to