Skip to content

Commit 5819489

Browse files
mtardyKernel Patches Daemon
authored andcommitted
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. Signed-off-by: Mahe Tardy <[email protected]> Tested-by: Mykyta Yatsenko<[email protected]>
1 parent a16555e commit 5819489

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
@@ -1672,7 +1672,10 @@ static int parse_stat_value(const char *str, enum stat_id id, struct verif_stats
16721672
case TOTAL_STATES:
16731673
case PEAK_STATES:
16741674
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: {
16761679
long val;
16771680
int err, n;
16781681

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

0 commit comments

Comments
 (0)