Skip to content

Commit 0ab3053

Browse files
selftests/bpf: fix veristat comp mode with new stats
JIRA: https://issues.redhat.com/browse/RHEL-78201 commit 9468f39 Author: Mahe Tardy <[email protected]> Date: Fri Dec 20 15:22:18 2024 +0000 selftests/bpf: fix veristat comp mode with new stats Commit 82c1f13 ("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: 82c1f13 ("selftests/bpf: Add more stats into veristat") Signed-off-by: Mahe Tardy <[email protected]> Tested-by: Mykyta Yatsenko<[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: Jerome Marchand <[email protected]>
1 parent ddb5be5 commit 0ab3053

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/testing/selftests/bpf/veristat.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,10 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
16731673
case TOTAL_STATES:
16741674
case PEAK_STATES:
16751675
case MAX_STATES_PER_INSN:
1676-
case MARK_READ_MAX_LEN: {
1676+
case MARK_READ_MAX_LEN:
1677+
case SIZE:
1678+
case JITED_SIZE:
1679+
case STACK: {
16771680
long val;
16781681
int err, n;
16791682

@@ -1686,6 +1689,9 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
16861689
st->stats[id] = val;
16871690
break;
16881691
}
1692+
case PROG_TYPE:
1693+
case ATTACH_TYPE:
1694+
break;
16891695
default:
16901696
fprintf(stderr, "Unrecognized stat #%d\n", id);
16911697
return -EINVAL;

0 commit comments

Comments
 (0)