[PATCH v14 bpf-next 09/10] selftests/bpf: Add feature test for FEAT_BTF_LAYOUT

Alan Maguire <[email protected]>
Newsgroups org.kernel.vger.dwarves,org.kernel.vger.bpf
Message-ID <[email protected]>
It should return true for the current kernel.

Signed-off-by: Alan Maguire <[email protected]>
---
 .../selftests/bpf/prog_tests/bpf_features.c    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_features.c

diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_features.c b/tools/testing/selftests/bpf/prog_tests/bpf_features.c
new file mode 100644
index 000000000000..cf20e17624a5
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_features.c
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2026, Oracle and/or its affiliates. */
+#include <test_progs.h>
+#include <linux/btf.h>
+#include <bpf/libbpf_internal.h>
+
+#include "kfree_skb.skel.h"
+
+void test_btf_layout_feature(void)
+{
+	struct kfree_skb *skel = kfree_skb__open_and_load();
+
+	if (ASSERT_OK_PTR(skel, "kfree_skb_skel")) {
+		ASSERT_TRUE(kernel_supports(skel->obj, FEAT_BTF_LAYOUT),
+		    "btf_layout_supported");
+	}
+	kfree_skb__destroy(skel);
+}
-- 
2.39.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.