selftests: kselftest_harness: separate diagnostic message with # in ksft_test_result_code()
According to the spec we should always print a # if we add a diagnostic message. Having the caller pass in the new line as part of diagnostic message makes handling this a bit counter-intuitive, so append the new line in the helper. Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
732e203528
commit
42ab727eb9
@@ -287,10 +287,15 @@ void ksft_test_result_code(int exit_code, const char *test_name,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Docs seem to call for double space if directive is absent */
|
||||||
|
if (!directive[0] && msg[0])
|
||||||
|
directive = " # ";
|
||||||
|
|
||||||
va_start(args, msg);
|
va_start(args, msg);
|
||||||
printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
|
printf("%s %u %s%s", tap_code, ksft_test_num(), test_name, directive);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
vprintf(msg, args);
|
vprintf(msg, args);
|
||||||
|
printf("\n");
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1148,7 +1148,7 @@ void __run_test(struct __fixture_metadata *f,
|
|||||||
|
|
||||||
if (t->exit_code == KSFT_SKIP)
|
if (t->exit_code == KSFT_SKIP)
|
||||||
ksft_test_result_code(t->exit_code, test_name,
|
ksft_test_result_code(t->exit_code, test_name,
|
||||||
"%s\n", diagnostic);
|
"%s", diagnostic);
|
||||||
else
|
else
|
||||||
ksft_test_result(__test_passed(t), "%s\n", test_name);
|
ksft_test_result(__test_passed(t), "%s\n", test_name);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user