Skip to content

Commit b7a27c3

Browse files
netoptimizerAlexei Starovoitov
authored andcommitted
bpf, doc: howto use/run the BPF selftests
I always forget howto run the BPF selftests. Thus, lets add that info to the QA document. Documentation was based on Cilium's documentation: http://cilium.readthedocs.io/en/latest/bpf/#verifying-the-setup Signed-off-by: Jesper Dangaard Brouer <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 5422283 commit b7a27c3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

Documentation/bpf/bpf_devel_QA.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,33 @@ submitted by the BPF maintainers to the stable maintainers.
417417
Testing patches
418418
===============
419419

420+
Q: How to run BPF selftests
421+
---------------------------
422+
A: After you have booted into the newly compiled kernel, navigate to
423+
the BPF selftests_ suite in order to test BPF functionality (current
424+
working directory points to the root of the cloned git tree)::
425+
426+
$ cd tools/testing/selftests/bpf/
427+
$ make
428+
429+
To run the verifier tests::
430+
431+
$ sudo ./test_verifier
432+
433+
The verifier tests print out all the current checks being
434+
performed. The summary at the end of running all tests will dump
435+
information of test successes and failures::
436+
437+
Summary: 418 PASSED, 0 FAILED
438+
439+
In order to run through all BPF selftests, the following command is
440+
needed::
441+
442+
$ sudo make run_tests
443+
444+
See the kernels selftest `Documentation/dev-tools/kselftest.rst`_
445+
document for further documentation.
446+
420447
Q: Which BPF kernel selftests version should I run my kernel against?
421448
---------------------------------------------------------------------
422449
A: If you run a kernel ``xyz``, then always run the BPF kernel selftests
@@ -607,5 +634,7 @@ when:
607634
.. _netdev FAQ: ../networking/netdev-FAQ.txt
608635
.. _samples/bpf/: ../../samples/bpf/
609636
.. _selftests: ../../tools/testing/selftests/bpf/
637+
.. _Documentation/dev-tools/kselftest.rst:
638+
https://www.kernel.org/doc/html/latest/dev-tools/kselftest.html
610639

611640
Happy BPF hacking!

0 commit comments

Comments
 (0)