Skip to content

Commit

Permalink
ci: Change selftest cross compile patch
Browse files Browse the repository at this point in the history
The original patch caused a race condition where 2 rules tried to write to the
same files (host-tools and (target) tools directory) causing errors similar to
the ones below.

Instead of changing what the scratch dir is, this new patch sets `BPFTOOL` to
default to
`TRUNNER_BPFTOOL` instead of `DEFAUlT_BPFTOOL`.

```
2024-02-14T19:49:54.6430105Z   MKDIR
2024-02-14T19:49:54.6547753Z   GEN     /tmp/work/bpf/bpf/tools/testing/selftests/bpf/bpf-helpers.rst
2024-02-14T19:49:54.6552447Z   GEN     /tmp/work/bpf/bpf/tools/testing/selftests/bpf/bpf-syscall.rst
2024-02-14T19:49:54.6698129Z   GEN     /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/build/host/libbpf/bpf_helper_defs.h
2024-02-14T19:49:54.6699474Z   GEN     /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/build/libbpf/bpf_helper_defs.h
2024-02-14T19:49:54.6700946Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/bpf.h
2024-02-14T19:49:54.6702035Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf.h
2024-02-14T19:49:54.6703060Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/libbpf.h
2024-02-14T19:49:54.6705068Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf.h
2024-02-14T19:49:54.6706136Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/btf.h
2024-02-14T19:49:54.6707103Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/btf.h
2024-02-14T19:49:54.6708613Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/libbpf_common.h
2024-02-14T19:49:54.6709705Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/libbpf_legacy.h
2024-02-14T19:49:54.6710767Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h
2024-02-14T19:49:54.6711833Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_legacy.h
2024-02-14T19:49:54.6712886Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/bpf_helpers.h
2024-02-14T19:49:54.6713934Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/bpf_tracing.h
2024-02-14T19:49:54.6715873Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf_helpers.h
2024-02-14T19:49:54.6717899Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/bpf_endian.h
2024-02-14T19:49:54.6719951Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf_tracing.h
2024-02-14T19:49:54.6722146Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/bpf_core_read.h
2024-02-14T19:49:54.6724480Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/skel_internal.h
2024-02-14T19:49:54.6726350Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf_endian.h
2024-02-14T19:49:54.6728299Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/libbpf_version.h
2024-02-14T19:49:54.6730306Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools//include/bpf/usdt.bpf.h
2024-02-14T19:49:54.6732346Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf_core_read.h
2024-02-14T19:49:54.6733964Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/skel_internal.h
2024-02-14T19:49:54.6735555Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_version.h
2024-02-14T19:49:54.6746662Z install: cannot change permissions of '/tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf.h': No such file or directory
2024-02-14T19:49:54.6749334Z make[1]: *** [Makefile:250: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf.h] Error 1
2024-02-14T19:49:54.6750682Z make[1]: *** Deleting file '/tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/bpf.h'
2024-02-14T19:49:54.6751477Z make[1]: *** Waiting for unfinished jobs....
2024-02-14T19:49:54.6752760Z install: cannot create regular file '/tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h': File exists
2024-02-14T19:49:54.6754094Z   INSTALL /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/usdt.bpf.h
2024-02-14T19:49:54.6755332Z make[1]: *** [Makefile:250: /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h] Error 1
2024-02-14T19:49:54.6756783Z make[1]: *** Deleting file '/tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/include/bpf/libbpf_common.h'
2024-02-14T19:49:54.6823593Z   HOSTCC  /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/build/host/libbpf/fixdep.o
2024-02-14T19:49:54.6824781Z   HOSTCC  /tmp/work/bpf/bpf/tools/testing/selftests/bpf/tools/build/libbpf/fixdep.o
```

Signed-off-by: Manu Bretelle <[email protected]>
  • Loading branch information
chantra committed Feb 14, 2024
1 parent 06021b4 commit f73cd5c
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions ci/diffs/0099-selftest-cross-compile.diff
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index a38a3001527c..a403a9d5c529 100644
index a38a3001527c..af68528cc944 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -171,7 +171,8 @@ INCLUDE_DIR := $(SCRATCH_DIR)/include
BPFOBJ := $(BUILD_DIR)/libbpf/libbpf.a
ifneq ($(CROSS_COMPILE),)
HOST_BUILD_DIR := $(BUILD_DIR)/host
-HOST_SCRATCH_DIR := $(OUTPUT)/host-tools
+#HOST_SCRATCH_DIR := $(OUTPUT)/host-tools
+HOST_SCRATCH_DIR := $(SCRATCH_DIR)
HOST_INCLUDE_DIR := $(HOST_SCRATCH_DIR)/include
else
HOST_BUILD_DIR := $(BUILD_DIR)
@@ -304,7 +304,7 @@ $(OUTPUT)/test_maps: $(TESTING_HELPERS)
$(OUTPUT)/test_verifier: $(TESTING_HELPERS) $(CAP_HELPERS) $(UNPRIV_HELPERS)
$(OUTPUT)/xsk.o: $(BPFOBJ)

-BPFTOOL ?= $(DEFAULT_BPFTOOL)
+BPFTOOL ?= $(TRUNNER_BPFTOOL)
$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) \
$(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
$(Q)$(MAKE) $(submake_extras) -C $(BPFTOOLDIR) \

0 comments on commit f73cd5c

Please sign in to comment.