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

Add method Run to BPFProg(BPF_PROG_RUN) #428

Closed
wants to merge 1 commit into from

Conversation

sc07kvm
Copy link
Contributor

@sc07kvm sc07kvm commented May 11, 2024

The written code passes a bpf_prog_test_run_opts from libbpf. This is a good feature for writing tests on eBPF code.
References:

Example of a testing library in Cilium built on this feature:

@geyslan
Copy link
Member

geyslan commented May 17, 2024

@sc07kvm thanks for this contribution. I just put this in my stash for later review.

@MarcWort
Copy link
Contributor

I just wanted to say thank you. This is really useful for me. I am already using it :)

geyslan added a commit to geyslan/libbpfgo that referenced this pull request Jun 4, 2024
Run method is used to load and run the BPF program without attaching it
to any hook. This is useful for testing the BPF program.

It makes use of the bpf(BPF_PROG_TEST_RUN) via bpf_prog_test_run_opts().

The prog-run selftest is added to test the Run method. More examples
can be found in the linux kernel source code:
tools/testing/selftests/bpf/prog_tests.

Original code aquasecurity#428 was authored by sc07kvm, and this commiter have only
made cosmetics adjustments.

Co-authored-by: Geyslan Gregório <[email protected]>
@geyslan
Copy link
Member

geyslan commented Jun 4, 2024

@sc07kvm great work. I'm closing this in favour of #440 - credits maintained. Thanks a million.

@geyslan geyslan closed this Jun 4, 2024
geyslan added a commit that referenced this pull request Jun 6, 2024
Run method is used to load and run the BPF program without attaching it
to any hook. This is useful for testing the BPF program.

It makes use of the bpf(BPF_PROG_TEST_RUN) via bpf_prog_test_run_opts().

The prog-run selftest is added to test the Run method. More examples
can be found in the linux kernel source code:
tools/testing/selftests/bpf/prog_tests.

Original code #428 was authored by sc07kvm, and this commiter have only
made cosmetics adjustments.

Co-authored-by: Geyslan Gregório <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants