Commit b9670b90 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov

selftests/bpf: ensure we always have non-ambiguous sorting in veristat

Always fall back to unique file/prog comparison if user's custom order
specs are ambiguous. This ensures stable output no matter what.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20221103055304.2904589-5-andrii@kernel.orgSigned-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 10b1b3f3
...@@ -723,7 +723,11 @@ static int cmp_prog_stats(const void *v1, const void *v2) ...@@ -723,7 +723,11 @@ static int cmp_prog_stats(const void *v1, const void *v2)
return cmp; return cmp;
} }
return 0; /* always disambiguate with file+prog, which are unique */
cmp = strcmp(s1->file_name, s2->file_name);
if (cmp != 0)
return cmp;
return strcmp(s1->prog_name, s2->prog_name);
} }
#define HEADER_CHAR '-' #define HEADER_CHAR '-'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment