diff options
| author | Ihor Solodrai <ihor.solodrai@linux.dev> | 2026-08-28 14:52:04 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-08-29 18:26:59 -0700 |
| commit | 122255fb1933a57d81d05d0224d417969ec35fa9 (patch) | |
| tree | 941472e13b2b63f9a49c69de5ece3e82d1c1358e /tools/lib/python/kdoc/python_version.py | |
| parent | c0722dc3288aa5f53e058c91bebd100bcc6682d0 (diff) | |
| download | linux-next-122255fb1933a57d81d05d0224d417969ec35fa9.tar.gz linux-next-122255fb1933a57d81d05d0224d417969ec35fa9.zip | |
selftests/bpf: Compare btf_dump expected output in-process
test_btf_dump_case() writes the dumped types to a temporary file and
then runs a command against the expectation:
system("awk '...' 'progs/x.c' | diff -u - '/tmp/x.output.XXXXXX'");
This creates three processes per test case: a shell, awk and diff. The
awk cannot be deferred to the failure path, because its output is the
expected text.
In a VM with a 9p root (used on BPF CI) process creation dominates the
cost. A bare fork+exec measures around 110ms, so the btf_dump test
cases spend most of their runtime forking.
Replace the awk pipeline with a simple marker parser. Buffer the dump
in memory, and use compare_text_to_expected(), which only runs diff(1)
on mismatch.
Measured with "time ./test_progs -t btf_dump" in the VM:
real 2.751s -> 0.702s, sys 1.901s -> 0.193s
This also drops the temporary file setup.
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Link: https://lore.kernel.org/r/20260828215207.3105313-4-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
