tools/bpf: Remove bpf-helpers from bpftool docs
This logic is used for validating the manual pages from selftests, so move the infra under tools/testing/selftests/bpf/ and rely on selftests for validation rather than tying it into the bpftool build. Signed-off-by: Joe Stringer <joe@cilium.io> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/20210302171947.2268128-12-joe@cilium.io
This commit is contained in:
parent
a67882a221
commit
a01d935b2e
1
tools/bpf/bpftool/.gitignore
vendored
1
tools/bpf/bpftool/.gitignore
vendored
@ -3,7 +3,6 @@
|
|||||||
/bootstrap/
|
/bootstrap/
|
||||||
/bpftool
|
/bpftool
|
||||||
bpftool*.8
|
bpftool*.8
|
||||||
bpf-helpers.*
|
|
||||||
FEATURE-DUMP.bpftool
|
FEATURE-DUMP.bpftool
|
||||||
feature
|
feature
|
||||||
libbpf
|
libbpf
|
||||||
|
@ -16,15 +16,12 @@ prefix ?= /usr/local
|
|||||||
mandir ?= $(prefix)/man
|
mandir ?= $(prefix)/man
|
||||||
man8dir = $(mandir)/man8
|
man8dir = $(mandir)/man8
|
||||||
|
|
||||||
# Load targets for building eBPF helpers man page.
|
|
||||||
include ../../Makefile.helpers
|
|
||||||
|
|
||||||
MAN8_RST = $(wildcard bpftool*.rst)
|
MAN8_RST = $(wildcard bpftool*.rst)
|
||||||
|
|
||||||
_DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
|
_DOC_MAN8 = $(patsubst %.rst,%.8,$(MAN8_RST))
|
||||||
DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
|
DOC_MAN8 = $(addprefix $(OUTPUT),$(_DOC_MAN8))
|
||||||
|
|
||||||
man: man8 helpers
|
man: man8
|
||||||
man8: $(DOC_MAN8)
|
man8: $(DOC_MAN8)
|
||||||
|
|
||||||
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
|
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
|
||||||
@ -46,16 +43,16 @@ ifndef RST2MAN_DEP
|
|||||||
endif
|
endif
|
||||||
$(QUIET_GEN)( cat $< ; printf "%b" $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
|
$(QUIET_GEN)( cat $< ; printf "%b" $(call see_also,$<) ) | rst2man $(RST2MAN_OPTS) > $@
|
||||||
|
|
||||||
clean: helpers-clean
|
clean:
|
||||||
$(call QUIET_CLEAN, Documentation)
|
$(call QUIET_CLEAN, Documentation)
|
||||||
$(Q)$(RM) $(DOC_MAN8)
|
$(Q)$(RM) $(DOC_MAN8)
|
||||||
|
|
||||||
install: man helpers-install
|
install: man
|
||||||
$(call QUIET_INSTALL, Documentation-man)
|
$(call QUIET_INSTALL, Documentation-man)
|
||||||
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
|
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
|
||||||
$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
|
$(Q)$(INSTALL) -m 644 $(DOC_MAN8) $(DESTDIR)$(man8dir)
|
||||||
|
|
||||||
uninstall: helpers-uninstall
|
uninstall:
|
||||||
$(call QUIET_UNINST, Documentation-man)
|
$(call QUIET_UNINST, Documentation-man)
|
||||||
$(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
|
$(Q)$(RM) $(addprefix $(DESTDIR)$(man8dir)/,$(_DOC_MAN8))
|
||||||
$(Q)$(RMDIR) $(DESTDIR)$(man8dir)
|
$(Q)$(RMDIR) $(DESTDIR)$(man8dir)
|
||||||
|
1
tools/testing/selftests/bpf/.gitignore
vendored
1
tools/testing/selftests/bpf/.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
bpf-helpers*
|
||||||
test_verifier
|
test_verifier
|
||||||
test_maps
|
test_maps
|
||||||
test_lru_map
|
test_lru_map
|
||||||
|
@ -68,6 +68,7 @@ TEST_PROGS := test_kmod.sh \
|
|||||||
test_bpftool_build.sh \
|
test_bpftool_build.sh \
|
||||||
test_bpftool.sh \
|
test_bpftool.sh \
|
||||||
test_bpftool_metadata.sh \
|
test_bpftool_metadata.sh \
|
||||||
|
test_docs_build.sh \
|
||||||
test_xsk.sh
|
test_xsk.sh
|
||||||
|
|
||||||
TEST_PROGS_EXTENDED := with_addr.sh \
|
TEST_PROGS_EXTENDED := with_addr.sh \
|
||||||
@ -103,6 +104,7 @@ override define CLEAN
|
|||||||
$(call msg,CLEAN)
|
$(call msg,CLEAN)
|
||||||
$(Q)$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
|
$(Q)$(RM) -r $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(EXTRA_CLEAN)
|
||||||
$(Q)$(MAKE) -C bpf_testmod clean
|
$(Q)$(MAKE) -C bpf_testmod clean
|
||||||
|
$(Q)$(MAKE) docs-clean
|
||||||
endef
|
endef
|
||||||
|
|
||||||
include ../lib.mk
|
include ../lib.mk
|
||||||
@ -180,6 +182,7 @@ $(OUTPUT)/runqslower: $(BPFOBJ) | $(DEFAULT_BPFTOOL)
|
|||||||
cp $(SCRATCH_DIR)/runqslower $@
|
cp $(SCRATCH_DIR)/runqslower $@
|
||||||
|
|
||||||
$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
|
$(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/test_stub.o $(BPFOBJ)
|
||||||
|
$(TEST_GEN_FILES): docs
|
||||||
|
|
||||||
$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
|
$(OUTPUT)/test_dev_cgroup: cgroup_helpers.c
|
||||||
$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
|
$(OUTPUT)/test_skb_cgroup_id_user: cgroup_helpers.c
|
||||||
@ -200,11 +203,16 @@ $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
|
|||||||
CC=$(HOSTCC) LD=$(HOSTLD) \
|
CC=$(HOSTCC) LD=$(HOSTLD) \
|
||||||
OUTPUT=$(HOST_BUILD_DIR)/bpftool/ \
|
OUTPUT=$(HOST_BUILD_DIR)/bpftool/ \
|
||||||
prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
|
prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
|
||||||
$(Q)mkdir -p $(BUILD_DIR)/bpftool/Documentation
|
|
||||||
|
docs:
|
||||||
$(Q)RST2MAN_OPTS="--exit-status=1" $(MAKE) $(submake_extras) \
|
$(Q)RST2MAN_OPTS="--exit-status=1" $(MAKE) $(submake_extras) \
|
||||||
-C $(BPFTOOLDIR)/Documentation \
|
-f Makefile.docs \
|
||||||
OUTPUT=$(BUILD_DIR)/bpftool/Documentation/ \
|
prefix= OUTPUT=$(OUTPUT)/ DESTDIR=$(OUTPUT)/ $@
|
||||||
prefix= DESTDIR=$(SCRATCH_DIR)/ install
|
|
||||||
|
docs-clean:
|
||||||
|
$(Q)$(MAKE) $(submake_extras) \
|
||||||
|
-f Makefile.docs \
|
||||||
|
prefix= OUTPUT=$(OUTPUT)/ DESTDIR=$(OUTPUT)/ $@
|
||||||
|
|
||||||
$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
|
$(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile) \
|
||||||
../../../include/uapi/linux/bpf.h \
|
../../../include/uapi/linux/bpf.h \
|
||||||
@ -477,3 +485,5 @@ EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) $(HOST_SCRATCH_DIR) \
|
|||||||
prog_tests/tests.h map_tests/tests.h verifier/tests.h \
|
prog_tests/tests.h map_tests/tests.h verifier/tests.h \
|
||||||
feature \
|
feature \
|
||||||
$(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc bpf_testmod.ko)
|
$(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc bpf_testmod.ko)
|
||||||
|
|
||||||
|
.PHONY: docs docs-clean
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
ifndef allow-override
|
|
||||||
include ../scripts/Makefile.include
|
include ../../../scripts/Makefile.include
|
||||||
include ../scripts/utilities.mak
|
include ../../../scripts/utilities.mak
|
||||||
else
|
|
||||||
# Assume Makefile.helpers is being run from bpftool/Documentation
|
|
||||||
# subdirectory. Go up two more directories to fetch bpf.h header and
|
|
||||||
# associated script.
|
|
||||||
UP2DIR := ../../
|
|
||||||
endif
|
|
||||||
|
|
||||||
INSTALL ?= install
|
INSTALL ?= install
|
||||||
RM ?= rm -f
|
RM ?= rm -f
|
||||||
@ -29,13 +23,21 @@ MAN7_RST = $(HELPERS_RST)
|
|||||||
_DOC_MAN7 = $(patsubst %.rst,%.7,$(MAN7_RST))
|
_DOC_MAN7 = $(patsubst %.rst,%.7,$(MAN7_RST))
|
||||||
DOC_MAN7 = $(addprefix $(OUTPUT),$(_DOC_MAN7))
|
DOC_MAN7 = $(addprefix $(OUTPUT),$(_DOC_MAN7))
|
||||||
|
|
||||||
|
DOCTARGETS := helpers
|
||||||
|
|
||||||
|
docs: $(DOCTARGETS)
|
||||||
helpers: man7
|
helpers: man7
|
||||||
man7: $(DOC_MAN7)
|
man7: $(DOC_MAN7)
|
||||||
|
|
||||||
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
|
RST2MAN_DEP := $(shell command -v rst2man 2>/dev/null)
|
||||||
|
|
||||||
$(OUTPUT)$(HELPERS_RST): $(UP2DIR)../../include/uapi/linux/bpf.h
|
# Configure make rules for the man page bpf-$1.$2.
|
||||||
$(QUIET_GEN)$(UP2DIR)../../scripts/bpf_doc.py --filename $< > $@
|
# $1 - target for scripts/bpf_doc.py
|
||||||
|
# $2 - man page section to generate the troff file
|
||||||
|
define DOCS_RULES =
|
||||||
|
$(OUTPUT)bpf-$1.rst: ../../../../include/uapi/linux/bpf.h
|
||||||
|
$$(QUIET_GEN)../../../../scripts/bpf_doc.py $1 \
|
||||||
|
--filename $$< > $$@
|
||||||
|
|
||||||
$(OUTPUT)%.7: $(OUTPUT)%.rst
|
$(OUTPUT)%.7: $(OUTPUT)%.rst
|
||||||
ifndef RST2MAN_DEP
|
ifndef RST2MAN_DEP
|
||||||
@ -43,18 +45,18 @@ ifndef RST2MAN_DEP
|
|||||||
endif
|
endif
|
||||||
$(QUIET_GEN)rst2man $< > $@
|
$(QUIET_GEN)rst2man $< > $@
|
||||||
|
|
||||||
helpers-clean:
|
docs-clean:
|
||||||
$(call QUIET_CLEAN, eBPF_helpers-manpage)
|
$(call QUIET_CLEAN, eBPF_helpers-manpage)
|
||||||
$(Q)$(RM) $(DOC_MAN7) $(OUTPUT)$(HELPERS_RST)
|
$(Q)$(RM) $(DOC_MAN7) $(OUTPUT)$(HELPERS_RST)
|
||||||
|
|
||||||
helpers-install: helpers
|
docs-install: helpers
|
||||||
$(call QUIET_INSTALL, eBPF_helpers-manpage)
|
$(call QUIET_INSTALL, eBPF_helpers-manpage)
|
||||||
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
|
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
|
||||||
$(Q)$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
|
$(Q)$(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
|
||||||
|
|
||||||
helpers-uninstall:
|
docs-uninstall:
|
||||||
$(call QUIET_UNINST, eBPF_helpers-manpage)
|
$(call QUIET_UNINST, eBPF_helpers-manpage)
|
||||||
$(Q)$(RM) $(addprefix $(DESTDIR)$(man7dir)/,$(_DOC_MAN7))
|
$(Q)$(RM) $(addprefix $(DESTDIR)$(man7dir)/,$(_DOC_MAN7))
|
||||||
$(Q)$(RMDIR) $(DESTDIR)$(man7dir)
|
$(Q)$(RMDIR) $(DESTDIR)$(man7dir)
|
||||||
|
|
||||||
.PHONY: helpers helpers-clean helpers-install helpers-uninstall
|
.PHONY: docs docs-clean docs-install docs-uninstall
|
@ -85,23 +85,6 @@ make_with_tmpdir() {
|
|||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
make_doc_and_clean() {
|
|
||||||
echo -e "\$PWD: $PWD"
|
|
||||||
echo -e "command: make -s $* doc >/dev/null"
|
|
||||||
RST2MAN_OPTS="--exit-status=1" make $J -s $* doc
|
|
||||||
if [ $? -ne 0 ] ; then
|
|
||||||
ERROR=1
|
|
||||||
printf "FAILURE: Errors or warnings when building documentation\n"
|
|
||||||
fi
|
|
||||||
(
|
|
||||||
if [ $# -ge 1 ] ; then
|
|
||||||
cd ${@: -1}
|
|
||||||
fi
|
|
||||||
make -s doc-clean
|
|
||||||
)
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Trying to build bpftool"
|
echo "Trying to build bpftool"
|
||||||
echo -e "... through kbuild\n"
|
echo -e "... through kbuild\n"
|
||||||
|
|
||||||
@ -162,7 +145,3 @@ make_and_clean
|
|||||||
make_with_tmpdir OUTPUT
|
make_with_tmpdir OUTPUT
|
||||||
|
|
||||||
make_with_tmpdir O
|
make_with_tmpdir O
|
||||||
|
|
||||||
echo -e "Checking documentation build\n"
|
|
||||||
# From tools/bpf/bpftool
|
|
||||||
make_doc_and_clean
|
|
||||||
|
13
tools/testing/selftests/bpf/test_doc_build.sh
Executable file
13
tools/testing/selftests/bpf/test_doc_build.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||||
|
|
||||||
|
# Assume script is located under tools/testing/selftests/bpf/. We want to start
|
||||||
|
# build attempts from the top of kernel repository.
|
||||||
|
SCRIPT_REL_PATH=$(realpath --relative-to=$PWD $0)
|
||||||
|
SCRIPT_REL_DIR=$(dirname $SCRIPT_REL_PATH)
|
||||||
|
KDIR_ROOT_DIR=$(realpath $PWD/$SCRIPT_REL_DIR/../../../../)
|
||||||
|
cd $KDIR_ROOT_DIR
|
||||||
|
|
||||||
|
for tgt in docs docs-clean; do
|
||||||
|
make -s -C $PWD/$SCRIPT_REL_DIR $tgt;
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user