Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elf: skip BenchmarkWriteELF if ELF file wasn't built #17536

Merged
merged 1 commit into from Oct 11, 2021

Conversation

tklauser
Copy link
Member

@tklauser tklauser commented Oct 5, 2021

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

@tklauser tklauser added the release-note/misc This PR makes changes that have no direct user impact. label Oct 5, 2021
@tklauser tklauser requested review from a team and jibi October 5, 2021 09:27
Copy link
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @tklauser!

pkg/elf/elf_test.go Outdated Show resolved Hide resolved
@tklauser tklauser force-pushed the elf-bench-skip-elf-not-found branch from f4c26f2 to d8f5ac4 Compare October 6, 2021 09:11
Copy link
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++ with one comment. Thank you @tklauser!

pkg/elf/elf_test.go Outdated Show resolved Hide resolved
@tklauser tklauser force-pushed the elf-bench-skip-elf-not-found branch from d8f5ac4 to 6073db5 Compare October 6, 2021 09:14
Copy link
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++ 👏🏿🤙🏾🎉 let's ship it, thank you @tklauser!

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 cilium#17535

Reported-by: Emmanuel T Odeke <emmanuel@orijtech.com>
Signed-off-by: Tobias Klauser <tobias@cilium.io>
@tklauser tklauser force-pushed the elf-bench-skip-elf-not-found branch from 6073db5 to 6ef84f6 Compare October 6, 2021 15:26
@tklauser
Copy link
Member Author

Reviews are in. Travis CI and GH actions passed, no need to run full CI. Marking as ready to merge.

@tklauser tklauser added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Oct 11, 2021
@aanm aanm merged commit 9bf8bc6 into cilium:master Oct 11, 2021
@tklauser tklauser deleted the elf-bench-skip-elf-not-found branch October 11, 2021 12:37
gandro added a commit to gandro/cilium that referenced this pull request Nov 29, 2021
This will skip the test when running the tests standalone (i.e. via `go
test` and not via Makefile). See cilium#17536 for more details about this
particular file, which applied the same principle to the benchmark in
that test suite.

See also cilium#16914

Reported-by: Hemanth Malla <hemanth.malla@datadoghq.com>
Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
qmonnet pushed a commit that referenced this pull request Nov 30, 2021
This will skip the test when running the tests standalone (i.e. via `go
test` and not via Makefile). See #17536 for more details about this
particular file, which applied the same principle to the benchmark in
that test suite.

See also #16914

Reported-by: Hemanth Malla <hemanth.malla@datadoghq.com>
Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants