mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
selftests/bpf: Consolidate kernel modules into common directory
The selftests build four kernel modules which use copy-pasted Makefile targets. This is a bit messy, and doesn't scale so well when we add more modules, so let's consolidate these rules into a single rule generated for each module name, and move the module sources into a single directory. To avoid parallel builds of the different modules stepping on each other's toes during the 'modpost' phase of the Kbuild 'make modules', the module files should really be a grouped target. However, make only added explicit support for grouped targets in version 4.3, which is newer than the minimum version supported by the kernel. However, make implicitly treats pattern matching rules with multiple targets as a grouped target, so we can work around this by turning the rule into a pattern matching target. We do this by replacing '.ko' with '%ko' in the targets with subst(). Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Viktor Malik <vmalik@redhat.com> Link: https://lore.kernel.org/bpf/20241204-bpf-selftests-mod-compile-v5-1-b96231134a49@redhat.com
This commit is contained in:
parent
e10500b69c
commit
d6212d82bf
@ -150,13 +150,13 @@ TEST_PROGS_EXTENDED := with_addr.sh \
|
||||
with_tunnels.sh ima_setup.sh verify_sig_setup.sh \
|
||||
test_xdp_vlan.sh test_bpftool.py
|
||||
|
||||
TEST_KMODS := bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
|
||||
bpf_test_modorder_y.ko
|
||||
TEST_KMOD_TARGETS = $(addprefix $(OUTPUT)/,$(TEST_KMODS))
|
||||
|
||||
# Compile but not part of 'make run_tests'
|
||||
TEST_GEN_PROGS_EXTENDED = \
|
||||
bench \
|
||||
bpf_testmod.ko \
|
||||
bpf_test_modorder_x.ko \
|
||||
bpf_test_modorder_y.ko \
|
||||
bpf_test_no_cfi.ko \
|
||||
flow_dissector_load \
|
||||
runqslower \
|
||||
test_cpp \
|
||||
@ -182,8 +182,9 @@ override define CLEAN
|
||||
$(Q)$(RM) -r $(TEST_GEN_PROGS)
|
||||
$(Q)$(RM) -r $(TEST_GEN_PROGS_EXTENDED)
|
||||
$(Q)$(RM) -r $(TEST_GEN_FILES)
|
||||
$(Q)$(RM) -r $(TEST_KMODS)
|
||||
$(Q)$(RM) -r $(EXTRA_CLEAN)
|
||||
$(Q)$(MAKE) -C bpf_testmod clean
|
||||
$(Q)$(MAKE) -C test_kmods clean
|
||||
$(Q)$(MAKE) docs-clean
|
||||
endef
|
||||
|
||||
@ -249,7 +250,7 @@ endif
|
||||
# to build individual tests.
|
||||
# NOTE: Semicolon at the end is critical to override lib.mk's default static
|
||||
# rule for binaries.
|
||||
$(notdir $(TEST_GEN_PROGS) \
|
||||
$(notdir $(TEST_GEN_PROGS) $(TEST_KMODS) \
|
||||
$(TEST_GEN_PROGS_EXTENDED)): %: $(OUTPUT)/% ;
|
||||
|
||||
# sort removes libbpf duplicates when not cross-building
|
||||
@ -303,37 +304,19 @@ $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c
|
||||
$< -o $@ \
|
||||
$(shell $(PKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto)
|
||||
|
||||
$(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard bpf_testmod/Makefile bpf_testmod/*.[ch])
|
||||
$(call msg,MOD,,$@)
|
||||
$(Q)$(RM) bpf_testmod/bpf_testmod.ko # force re-compilation
|
||||
$(Q)$(MAKE) $(submake_extras) -C bpf_testmod \
|
||||
RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) \
|
||||
# This should really be a grouped target, but make versions before 4.3 don't
|
||||
# support that for regular rules. However, pattern matching rules are implicitly
|
||||
# treated as grouped even with older versions of make, so as a workaround, the
|
||||
# subst() turns the rule into a pattern matching rule
|
||||
$(addprefix test_kmods/,$(subst .ko,%ko,$(TEST_KMODS))): $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard test_kmods/Makefile test_kmods/*.[ch])
|
||||
$(Q)$(RM) test_kmods/*.ko test_kmods/*.mod.o # force re-compilation
|
||||
$(Q)$(MAKE) $(submake_extras) -C test_kmods \
|
||||
RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) \
|
||||
EXTRA_CFLAGS='' EXTRA_LDFLAGS=''
|
||||
$(Q)cp bpf_testmod/bpf_testmod.ko $@
|
||||
|
||||
$(OUTPUT)/bpf_test_no_cfi.ko: $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard bpf_test_no_cfi/Makefile bpf_test_no_cfi/*.[ch])
|
||||
$(TEST_KMOD_TARGETS): $(addprefix test_kmods/,$(TEST_KMODS))
|
||||
$(call msg,MOD,,$@)
|
||||
$(Q)$(RM) bpf_test_no_cfi/bpf_test_no_cfi.ko # force re-compilation
|
||||
$(Q)$(MAKE) $(submake_extras) -C bpf_test_no_cfi \
|
||||
RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) \
|
||||
EXTRA_CFLAGS='' EXTRA_LDFLAGS=''
|
||||
$(Q)cp bpf_test_no_cfi/bpf_test_no_cfi.ko $@
|
||||
|
||||
$(OUTPUT)/bpf_test_modorder_x.ko: $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard bpf_test_modorder_x/Makefile bpf_test_modorder_x/*.[ch])
|
||||
$(call msg,MOD,,$@)
|
||||
$(Q)$(RM) bpf_test_modorder_x/bpf_test_modorder_x.ko # force re-compilation
|
||||
$(Q)$(MAKE) $(submake_extras) -C bpf_test_modorder_x \
|
||||
RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) \
|
||||
EXTRA_CFLAGS='' EXTRA_LDFLAGS=''
|
||||
$(Q)cp bpf_test_modorder_x/bpf_test_modorder_x.ko $@
|
||||
|
||||
$(OUTPUT)/bpf_test_modorder_y.ko: $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard bpf_test_modorder_y/Makefile bpf_test_modorder_y/*.[ch])
|
||||
$(call msg,MOD,,$@)
|
||||
$(Q)$(RM) bpf_test_modorder_y/bpf_test_modorder_y.ko # force re-compilation
|
||||
$(Q)$(MAKE) $(submake_extras) -C bpf_test_modorder_y \
|
||||
RESOLVE_BTFIDS=$(RESOLVE_BTFIDS) \
|
||||
EXTRA_CFLAGS='' EXTRA_LDFLAGS=''
|
||||
$(Q)cp bpf_test_modorder_y/bpf_test_modorder_y.ko $@
|
||||
$(Q)cp test_kmods/$(@F) $@
|
||||
|
||||
|
||||
DEFAULT_BPFTOOL := $(HOST_SCRATCH_DIR)/sbin/bpftool
|
||||
@ -758,14 +741,12 @@ TRUNNER_EXTRA_SOURCES := test_progs.c \
|
||||
json_writer.c \
|
||||
flow_dissector_load.h \
|
||||
ip_check_defrag_frags.h
|
||||
TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(OUTPUT)/bpf_testmod.ko \
|
||||
$(OUTPUT)/bpf_test_no_cfi.ko \
|
||||
$(OUTPUT)/bpf_test_modorder_x.ko \
|
||||
$(OUTPUT)/bpf_test_modorder_y.ko \
|
||||
TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read \
|
||||
$(OUTPUT)/liburandom_read.so \
|
||||
$(OUTPUT)/xdp_synproxy \
|
||||
$(OUTPUT)/sign-file \
|
||||
$(OUTPUT)/uprobe_multi \
|
||||
$(TEST_KMOD_TARGETS) \
|
||||
ima_setup.sh \
|
||||
verify_sig_setup.sh \
|
||||
$(wildcard progs/btf_dump_test_case_*.c) \
|
||||
@ -892,12 +873,9 @@ $(OUTPUT)/uprobe_multi: uprobe_multi.c uprobe_multi.ld
|
||||
|
||||
EXTRA_CLEAN := $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \
|
||||
prog_tests/tests.h map_tests/tests.h verifier/tests.h \
|
||||
feature bpftool \
|
||||
feature bpftool $(TEST_KMOD_TARGETS) \
|
||||
$(addprefix $(OUTPUT)/,*.o *.d *.skel.h *.lskel.h *.subskel.h \
|
||||
no_alu32 cpuv4 bpf_gcc bpf_testmod.ko \
|
||||
bpf_test_no_cfi.ko \
|
||||
bpf_test_modorder_x.ko \
|
||||
bpf_test_modorder_y.ko \
|
||||
no_alu32 cpuv4 bpf_gcc \
|
||||
liburandom_read.so) \
|
||||
$(OUTPUT)/FEATURE-DUMP.selftests
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
BPF_TESTMOD_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
KDIR ?= $(abspath $(BPF_TESTMOD_DIR)/../../../../..)
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
MODULES = bpf_test_modorder_x.ko
|
||||
|
||||
obj-m += bpf_test_modorder_x.o
|
||||
|
||||
all:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) modules
|
||||
|
||||
clean:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) clean
|
||||
|
@ -1,19 +0,0 @@
|
||||
BPF_TESTMOD_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
KDIR ?= $(abspath $(BPF_TESTMOD_DIR)/../../../../..)
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
MODULES = bpf_test_modorder_y.ko
|
||||
|
||||
obj-m += bpf_test_modorder_y.o
|
||||
|
||||
all:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) modules
|
||||
|
||||
clean:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) clean
|
||||
|
@ -1,19 +0,0 @@
|
||||
BPF_TEST_NO_CFI_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
KDIR ?= $(abspath $(BPF_TEST_NO_CFI_DIR)/../../../../..)
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
MODULES = bpf_test_no_cfi.ko
|
||||
|
||||
obj-m += bpf_test_no_cfi.o
|
||||
|
||||
all:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TEST_NO_CFI_DIR) modules
|
||||
|
||||
clean:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TEST_NO_CFI_DIR) clean
|
||||
|
@ -1,20 +0,0 @@
|
||||
BPF_TESTMOD_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
KDIR ?= $(abspath $(BPF_TESTMOD_DIR)/../../../../..)
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
MODULES = bpf_testmod.ko
|
||||
|
||||
obj-m += bpf_testmod.o
|
||||
CFLAGS_bpf_testmod.o = -I$(src)
|
||||
|
||||
all:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) modules
|
||||
|
||||
clean:
|
||||
+$(Q)make -C $(KDIR) M=$(BPF_TESTMOD_DIR) clean
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <test_progs.h>
|
||||
#include "progs/core_reloc_types.h"
|
||||
#include "bpf_testmod/bpf_testmod.h"
|
||||
#include "test_kmods/bpf_testmod.h"
|
||||
#include <linux/limits.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
struct map_value {
|
||||
struct prog_test_ref_kfunc __kptr *ptr;
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "bpf_experimental.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
static struct prog_test_ref_kfunc __kptr *v;
|
||||
long total_sum = -1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
SEC("tc")
|
||||
int kfunc_destructive_test(void)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2021 Facebook */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
struct syscall_test_args {
|
||||
__u8 data[16];
|
||||
|
@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
SEC("tc")
|
||||
int kfunc_call_fail(struct __sk_buff *ctx)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2021 Facebook */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
SEC("tc")
|
||||
int kfunc_call_test4(struct __sk_buff *skb)
|
||||
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* Copyright (c) 2021 Facebook */
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
extern const int bpf_prog_active __ksym;
|
||||
int active_res = -1;
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_core_read.h>
|
||||
#include "../bpf_experimental.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
struct plain_local;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
struct map_value {
|
||||
struct prog_test_ref_kfunc __kptr_untrusted *unref_ptr;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_core_read.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
struct map_value {
|
||||
char buf[8];
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "vmlinux.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "vmlinux.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Google LLC */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
SEC("syscall")
|
||||
int init_sock(struct init_sock_args *args)
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "bpf_kfuncs.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
SEC("tc")
|
||||
int kfunc_dynptr_nullable_test1(struct __sk_buff *skb)
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include <bpf/bpf_core_read.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
__u32 raw_tp_read_sz = 0;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "vmlinux.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
#include "bpf_misc.h"
|
||||
|
||||
SEC("tp_btf/bpf_testmod_test_nullable_bare")
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <vmlinux.h>
|
||||
#include <bpf/bpf_tracing.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod.h"
|
||||
#include "../test_kmods/bpf_testmod.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "bpf_experimental.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "bpf_experimental.h"
|
||||
#include <bpf/bpf_helpers.h>
|
||||
#include "bpf_misc.h"
|
||||
#include "../bpf_testmod/bpf_testmod_kfunc.h"
|
||||
#include "../test_kmods/bpf_testmod_kfunc.h"
|
||||
|
||||
char _license[] SEC("license") = "GPL";
|
||||
|
||||
|
21
tools/testing/selftests/bpf/test_kmods/Makefile
Normal file
21
tools/testing/selftests/bpf/test_kmods/Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
TEST_KMOD_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
|
||||
KDIR ?= $(abspath $(TEST_KMOD_DIR)/../../../../..)
|
||||
|
||||
ifeq ($(V),1)
|
||||
Q =
|
||||
else
|
||||
Q = @
|
||||
endif
|
||||
|
||||
MODULES = bpf_testmod.ko bpf_test_no_cfi.ko bpf_test_modorder_x.ko \
|
||||
bpf_test_modorder_y.ko
|
||||
|
||||
$(foreach m,$(MODULES),$(eval obj-m += $(m:.ko=.o)))
|
||||
|
||||
CFLAGS_bpf_testmod.o = -I$(src)
|
||||
|
||||
all:
|
||||
$(Q)$(MAKE) -C $(KDIR) M=$(TEST_KMOD_DIR) modules
|
||||
|
||||
clean:
|
||||
$(Q)$(MAKE) -C $(KDIR) M=$(TEST_KMOD_DIR) clean
|
Loading…
Reference in New Issue
Block a user