diff options
| author | Ihor Solodrai <ihor.solodrai@linux.dev> | 2026-08-28 14:52:02 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-08-29 18:26:59 -0700 |
| commit | bd71904697c64fe88e83322a79f8e6e68d0306d1 (patch) | |
| tree | 5003330f6dbcc3ffead2ee5a58416939fd109b42 /tools/lib/python/kdoc/python_version.py | |
| parent | 776c86a3e72265bb2e71d515995fec0992a715a8 (diff) | |
| download | linux-next-bd71904697c64fe88e83322a79f8e6e68d0306d1.tar.gz linux-next-bd71904697c64fe88e83322a79f8e6e68d0306d1.zip | |
selftests/bpf: Add compare_text_to_expected() helper
Some selftests generate text (such as BTF dump) and check it against
an expectation committed nearby.
There is no shared way to do that. prog_tests/btf_dump.c assembles an
"awk ... | diff -u" pipeline and hands it to system(). Any other test
wanting the same behaviour needs to reproduce both the comparison and
the reporting of a mismatch.
test_progs captures per-subtest output by pointing the stdout and
stderr FILE * globals at a memstream. But a child process inherits
descriptors, not the globals. So the "| diff -u" goes to the console
instead of the subtest log and is absent from the failure report.
Add a helper that compares two strings and runs diff(1) on mismatch,
properly relaying the output to stdout. Add tests for the helper.
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260828215207.3105313-2-ihor.solodrai@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
