BPF List
 help / color / mirror / Atom feed
* [PATCH v1 bpf-next  0/9] bpftool: Add end-to-end testing
@ 2023-11-16 19:42 Manu Bretelle
  2023-11-16 19:42 ` [PATCH v1 bpf-next 1/9] bpftool: add testing skeleton Manu Bretelle
                   ` (8 more replies)
  0 siblings, 9 replies; 25+ messages in thread
From: Manu Bretelle @ 2023-11-16 19:42 UTC (permalink / raw)
  To: bpf, quentin, andrii, daniel, ast, martin.lau, song,
	john.fastabend, kpsingh, sdf, haoluo, jolsa

This series introduce a more ergonomic end-to-end testing for `bpftool`.

While there is already some `bpftool` tests, they are so far shallow
tests, validating features (test_bpftool.py), or validating expectations
by mean of grepping for expected output in payload
(test_bpftool_metadata.sh), which is hard to extend.

`bpftool` being an operational tool, it is important to ensure that it
operates correctly and reliably when needed, e.g when dealing with
operational issues/incidents.
By performing end-to-end validation of `bpftool` functionalities, we can
ensure that no regression is introduced.

To improve testability, and make end-to-end testing easier, this series is
leveraging `libbpf-rs` [0], allowing us to leverage an existing testing
framework [1], and the ability to load and natively interact with bpf
programs, maps, struct_ops... and finally running `bpftool` command and
checking its output, behaviour, against a set of known expectations.

Currently, the series comes with a set of tests that validate basic
operations such as listing maps, and progs, dumping them, and being able
to attribute the pid that loaded/created those. For struct_ops, it tests
that we can list, dump, and also unregister them by id or name.


    test bpftool_tests::run_bpftool ... ok
    test bpftool_tests::run_bpftool_map_dump_id ... ok
    test bpftool_tests::run_bpftool_map_list ... ok
    test bpftool_tests::run_bpftool_map_pids ... ok
    test bpftool_tests::run_bpftool_prog_list ... ok
    test bpftool_tests::run_bpftool_prog_pids ... ok
    test bpftool_tests::run_bpftool_prog_show_id ... ok
    test bpftool_tests::run_bpftool_struct_ops_can_unregister_id ... ok
    test bpftool_tests::run_bpftool_struct_ops_can_unregister_name ... ok
    test bpftool_tests::run_bpftool_struct_ops_dump_name ... ok
    test bpftool_tests::run_bpftool_struct_ops_list ... ok

[0] https://docs.rs/libbpf-rs/latest/libbpf_rs/
[1] https://doc.rust-lang.org/book/ch11-00-testing.html

Manu Bretelle (9):
  bpftool: add testing skeleton
  bpftool: add libbpf-rs dependency and minimal bpf program
  bpftool: open and load bpf object
  bpftool: Add test to verify that pids are associated to maps.
  bpftool: add test for bpftool prog
  bpftool: test that we can dump and read the content of a map
  bpftool: Add struct_ops tests
  bpftool: Add bpftool_tests README.md
  bpftool: Add Makefile to facilitate bpftool_tests usage

 .../selftests/bpf/bpftool_tests/.gitignore    |   3 +
 .../selftests/bpf/bpftool_tests/Cargo.toml    |  14 +
 .../selftests/bpf/bpftool_tests/Makefile      |  22 +
 .../selftests/bpf/bpftool_tests/README.md     |  91 ++++
 .../selftests/bpf/bpftool_tests/build.rs      |  16 +
 .../bpftool_tests/src/bpf/bpftool_tests.bpf.c |  82 ++++
 .../bpf/bpftool_tests/src/bpf/vmlinux.h       |   1 +
 .../bpf/bpftool_tests/src/bpftool_tests.rs    | 408 ++++++++++++++++++
 .../selftests/bpf/bpftool_tests/src/main.rs   |   2 +
 9 files changed, 639 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/.gitignore
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/Cargo.toml
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/Makefile
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/README.md
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/build.rs
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/src/bpf/bpftool_tests.bpf.c
 create mode 120000 tools/testing/selftests/bpf/bpftool_tests/src/bpf/vmlinux.h
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/src/bpftool_tests.rs
 create mode 100644 tools/testing/selftests/bpf/bpftool_tests/src/main.rs

-- 
2.39.3


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-12-15  6:37 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-16 19:42 [PATCH v1 bpf-next 0/9] bpftool: Add end-to-end testing Manu Bretelle
2023-11-16 19:42 ` [PATCH v1 bpf-next 1/9] bpftool: add testing skeleton Manu Bretelle
2023-11-21  1:37   ` Alexei Starovoitov
2023-11-21 16:26     ` Quentin Monnet
2023-11-21 16:42       ` Alexei Starovoitov
2023-11-21 19:50         ` Andrii Nakryiko
2023-11-27 17:07           ` Quentin Monnet
2023-11-27 18:39             ` Andrii Nakryiko
2023-12-15  6:26               ` Manu Bretelle
2023-11-27 17:07         ` Quentin Monnet
2023-12-15  6:37           ` Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet
2023-11-16 19:42 ` [PATCH v1 bpf-next 2/9] bpftool: add libbpf-rs dependency and minimal bpf program Manu Bretelle
2023-11-16 19:42 ` [PATCH v1 bpf-next 3/9] bpftool: open and load bpf object Manu Bretelle
2023-11-16 19:42 ` [PATCH v1 bpf-next 4/9] bpftool: Add test to verify that pids are associated to maps Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet
2023-11-16 19:42 ` [PATCH v1 bpf-next 5/9] bpftool: add test for bpftool prog Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet
2023-11-16 19:42 ` [PATCH v1 bpf-next 6/9] bpftool: test that we can dump and read the content of a map Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet
2023-11-16 19:42 ` [PATCH v1 bpf-next 7/9] bpftool: Add struct_ops tests Manu Bretelle
2023-11-16 19:42 ` [PATCH v1 bpf-next 8/9] bpftool: Add bpftool_tests README.md Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet
2023-11-16 19:42 ` [PATCH v1 bpf-next 9/9] bpftool: Add Makefile to facilitate bpftool_tests usage Manu Bretelle
2023-11-21 16:26   ` Quentin Monnet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox