bpftool, selftests: Add tests for C dump and fix a dropped type
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest6 patches 0 repliesApplied 6/6
- v14 patches 8 repliesSuperseded
Changes in v2 from the cover letter
* new patches (#1-#3) introducing compare_text_to_expected() helper and refactoring btf_dump selftests
* bpftool dump selftest compares the output to the expected files exactly (Eduard)
* use VALIDATE_RAW_BTF macro in the new test (Eduard)
* drop v1 patch #4 ("selftests/bpf: Check that sorting preserves types in bpftool dump") as it became unnecessary
* nit in the bpftool fix (Andrii)
Patches in v2 All 6 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | selftests/bpf: Add compare_text_to_expected() helpertools/ tools/ tools/ | +69 | 0 replies | Applied |
| 2/6 | selftests/bpf: Modernize btf_dump test scaffoldingtools/ | +8 | 0 replies | Applied |
| 3/6 | selftests/bpf: Compare btf_dump expected output in-processtools/ | +82 | 0 replies | Applied |
| 4/6 | selftests/bpf: NUL-terminate bpftool command outputtools/ | +5 | 0 replies | Applied |
| 5/6 | selftests/bpf: Add tests for bpftool btf dump format ctools/ tools/ tools/ +1 more | +276 | 0 replies | Applied |
| 6/6 | bpftool: Don't drop a type in the sorted C dumptools/ tools/ | +9 | 0 replies | Applied |
Reviews trailers per patch
2 of 6 patches have a Reviewed-by or Acked-by.
| Patch | Eduard Zingerman |
|---|---|
| 1/6 | |
| 2/6 | |
| 3/6 | |
| 4/6 | A-b |
| 5/6 | |
| 6/6 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf-next v2 0/6] bpftool, selftests: Add tests for C dump and fix a dropped type
"bpftool btf dump format c" generates the vmlinux.h that BPF programs are built against, and it has no direct test coverage. Building against the header is not a substitute for testing it, nothing a compiler accepts would break the build.
Add selftests targeting C dump in particular.
While we are here, refactor btf_dump selftests to use a new compare_text_to_expected() helper and become more efficient.
Fix a bug in bpftool dump that dropped a type when sorting.
---
v1->v2:
* new patches (#1-#3) introducing compare_text_to_expected() helper and refactoring btf_dump selftests
* bpftool dump selftest compares the output to the expected files exactly (Eduard)
* use VALIDATE_RAW_BTF macro in the new test (Eduard)
* drop v1 patch #4 ("selftests/bpf: Check that sorting preserves types in bpftool dump") as it became unnecessary
* nit in the bpftool fix (Andrii)
v1: https://lore.kernel.org/bpf/[email protected]/
---
Ihor Solodrai (6):
selftests/bpf: Add compare_text_to_expected() helper selftests/bpf: Modernize btf_dump test scaffolding selftests/bpf: Compare btf_dump expected output in-process selftests/bpf: NUL-terminate bpftool command output selftests/bpf: Add tests for bpftool btf dump format c
bpftool: Don't drop a type in the sorted C dump
tools/bpf/bpftool/btf.c | 6 +- tools/testing/selftests/bpf/Makefile | 8 +- .../bpf/bpftool_btf_dump_sorted.expected | 48 +++++ .../bpf/bpftool_btf_dump_unsorted.expected | 48 +++++ tools/testing/selftests/bpf/bpftool_helpers.c | 7 +- .../bpf/prog_tests/bpftool_btf_dump.c | 178 ++++++++++++++++++ .../selftests/bpf/prog_tests/btf_dump.c | 125 ++++++++---- .../bpf/prog_tests/prog_tests_framework.c | 23 +++ tools/testing/selftests/bpf/testing_helpers.c | 43 +++++ tools/testing/selftests/bpf/testing_helpers.h | 3 + 10 files changed, 446 insertions(+), 43 deletions(-) create mode 100644 tools/testing/selftests/bpf/bpftool_btf_dump_sorted.expected create mode 100644 tools/testing/selftests/bpf/bpftool_btf_dump_unsorted.expected create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_btf_dump.c
base-commit: cd35e1b10182c42b4ae31ee49119463b17d8ba7f
Signature · 1 line
2.55.0