Skip to content

Commit 2f1311c

Browse files
committed
lkl: tests: minor lkl_test_kasan changes
Grep for the kunit kasan group summary so that we can log the test + fail count. Use a common exit path to ensure log is always freed. Signed-off-by: David Disseldorp <ddiss@suse.de>
1 parent 88a4280 commit 2f1311c

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

tools/lkl/tests/boot.c

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -563,22 +563,26 @@ static int lkl_test_kasan(void)
563563
{
564564
char *log = strdup(boot_log);
565565
char *line = NULL;
566-
char c, d;
566+
int p, f, s, t;
567+
int num_lines, result = TEST_FAILURE;
567568

568569
line = strtok(log, "\n");
569-
while (line) {
570-
if (sscanf(line, "[ %*f] ok %*d kasa%c%c", &c, &d) == 1 &&
571-
c == 'n') {
570+
for (num_lines = 0; line; num_lines++) {
571+
if (sscanf(line,
572+
"[ %*f] # kasan: pass:%d fail:%d skip:%d total:%d",
573+
&p, &f, &s, &t) == 4) {
572574
lkl_test_logf("%s", line);
573-
return TEST_SUCCESS;
575+
result = (f == 0 ? TEST_SUCCESS : TEST_FAILURE);
576+
goto out;
574577
}
575578

576579
line = strtok(NULL, "\n");
577580
}
578581

582+
lkl_test_logf("no kasan test output in %d log lines\n", num_lines);
583+
out:
579584
free(log);
580-
581-
return TEST_FAILURE;
585+
return result;
582586
}
583587
#else
584588
#define KASAN_CMD_LINE

0 commit comments

Comments
 (0)