Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/bpf: fix veristat comp mode with new stats

Commit 82c1f13de315 ("selftests/bpf: Add more stats into veristat")
introduced new stats, added by default in the CSV output, that were not
added to parse_stat_value, used in parse_stats_csv which is used in
comparison mode. Thus it broke comparison mode altogether making it fail
with "Unrecognized stat #7" and EINVAL.

One quirk is that PROG_TYPE and ATTACH_TYPE have been transformed to
strings using libbpf_bpf_prog_type_str and libbpf_bpf_attach_type_str
respectively. Since we might not want to compare those string values, we
just skip the parsing in this patch. We might want to translate it back
to the enum value or compare the string value directly.

Fixes: 82c1f13de315 ("selftests/bpf: Add more stats into veristat")
Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
Tested-by: Mykyta Yatsenko<yatsenko@meta.com>
Link: https://lore.kernel.org/r/20241220152218.28405-1-mahe.tardy@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Mahe Tardy and committed by
Alexei Starovoitov
9468f39b 4a240359

+7 -1
+7 -1
tools/testing/selftests/bpf/veristat.c
··· 1672 1672 case TOTAL_STATES: 1673 1673 case PEAK_STATES: 1674 1674 case MAX_STATES_PER_INSN: 1675 - case MARK_READ_MAX_LEN: { 1675 + case MARK_READ_MAX_LEN: 1676 + case SIZE: 1677 + case JITED_SIZE: 1678 + case STACK: { 1676 1679 long val; 1677 1680 int err, n; 1678 1681 ··· 1688 1685 st->stats[id] = val; 1689 1686 break; 1690 1687 } 1688 + case PROG_TYPE: 1689 + case ATTACH_TYPE: 1690 + break; 1691 1691 default: 1692 1692 fprintf(stderr, "Unrecognized stat #%d\n", id); 1693 1693 return -EINVAL;