Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
elf: skip BenchmarkWriteELF if ELF file wasn't built
When running `go test -run=^$ -bench=. ./...` on the Cilium source, BenchmarkWriteELF currently fails with: --- FAIL: BenchmarkWriteELF elf_test.go:201: failed to open ELF file ../../test/bpf/elf-demo.o: open ../../test/bpf/elf-demo.o: no such file or directory That particular file is only built when running tests/benchmarks using the Makefile-based flow. In order to still allow Cilium's benchmarks suite to run without errors when invoked using native `go test -bench`, just skip BenchmarkWriteELF if the ELF file doesn't exist. In the future we might want to embed that ELF file into the test/benchmark itself using bpf2go [1]. [1] https://pkg.go.dev/github.com/cilium/ebpf/cmd/bpf2go For #17535 Reported-by: Emmanuel T Odeke <emmanuel@orijtech.com> Signed-off-by: Tobias Klauser <tobias@cilium.io>
- Loading branch information