selftests/bpf: Make reg_bounds test more robust

The verifier log output may contain multiple lines that start with
18: (bf) r0 = r6
teach reg_bounds to look for lines that have ';' in them,
since reg_bounds test is looking for:
18: (bf) r0 = r6       ; R0=... R6=...

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>
Link: https://lore.kernel.org/r/20260325012242.45606-1-alexei.starovoitov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
Alexei Starovoitov
2026-03-24 18:22:42 -07:00
parent 9f7d8fa681
commit 400ff899c3

View File

@@ -1217,7 +1217,23 @@ static int parse_range_cmp_log(const char *log_buf, struct case_spec spec,
spec.compare_subregs ? "w0" : "r0",
spec.compare_subregs ? "w" : "r", specs[i].reg_idx);
q = strstr(p, buf);
/*
* In the verifier log look for lines:
* 18: (bf) r0 = r6 ; R0=... R6=...
* Different verifier passes may print
* 18: (bf) r0 = r6
* as well, but never followed by ';'.
*/
q = p;
while ((q = strstr(q, buf)) != NULL) {
const char *s = q + strlen(buf);
while (*s == ' ' || *s == '\t')
s++;
if (*s == ';')
break;
q = s;
}
if (!q) {
*specs[i].state = (struct reg_state){.valid = false};
continue;