log: Avoid including function names by default

Unless function names are requested, the logging system should not
compile these into the code. Adjust the macros to handle this.

This means that turning on function names at runtime won't work unless
CONFIG_LOGF_FUNC is enabled. We could perhaps split this into a
separate option if that is a problem.

Enable CONFIG_LOGF_FUNC logging for sandbox since the tests expect the
function names to be included. Fix up the pinmux test which checks a
logging statement.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
This commit is contained in:
Simon Glass
2024-08-22 07:54:56 -06:00
committed by Tom Rini
parent 99b23d45cb
commit dfc0acd0cc
6 changed files with 26 additions and 11 deletions

View File

@@ -30,7 +30,13 @@ static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
console_record_reset();
run_command("pinmux status P9", 0);
ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width");
if (IS_ENABLED(CONFIG_LOGF_FUNC)) {
ut_assert_nextlinen(
" single_of_to_plat() single-pinctrl pinctrl-single-no-width: missing register width");
} else {
ut_assert_nextlinen(
"single-pinctrl pinctrl-single-no-width: missing register width");
}
ut_assert_nextlinen("P9 not found");
ut_assert_console_end();

View File

@@ -452,8 +452,10 @@ int log_test_buffer(struct unit_test_state *uts)
/* This one should product no output due to the debug level */
log_buffer(LOGC_BOOT, LOGL_DEBUG, 0, buf, 1, 0x12, 0);
ut_assert_nextline("00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........");
ut_assert_nextline("00000010: 10 00 ..");
ut_assert_nextline(
" log_test_buffer() 00000000: 00 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ..\"3DUfw........");
ut_assert_nextline(
" log_test_buffer() 00000010: 10 00 ..");
ut_assert_console_end();
free(buf);