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>
This commit is contained in:
David Disseldorp
2025-06-19 13:23:24 +02:00
parent 88a4280e01
commit 2f1311c005

View File

@@ -563,22 +563,26 @@ static int lkl_test_kasan(void)
{
char *log = strdup(boot_log);
char *line = NULL;
char c, d;
int p, f, s, t;
int num_lines, result = TEST_FAILURE;
line = strtok(log, "\n");
while (line) {
if (sscanf(line, "[ %*f] ok %*d kasa%c%c", &c, &d) == 1 &&
c == 'n') {
for (num_lines = 0; line; num_lines++) {
if (sscanf(line,
"[ %*f] # kasan: pass:%d fail:%d skip:%d total:%d",
&p, &f, &s, &t) == 4) {
lkl_test_logf("%s", line);
return TEST_SUCCESS;
result = (f == 0 ? TEST_SUCCESS : TEST_FAILURE);
goto out;
}
line = strtok(NULL, "\n");
}
lkl_test_logf("no kasan test output in %d log lines\n", num_lines);
out:
free(log);
return TEST_FAILURE;
return result;
}
#else
#define KASAN_CMD_LINE