diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2018-01-11 08:15:54 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-01-22 23:09:12 +0100 |
commit | 853540c84fdad4c2b0755c0041e87efba376aec2 (patch) | |
tree | d3ddb07cbcf89b8673a7d06ca24303e6f3df56c7 /lib/efi_selftest/efi_selftest_console.c | |
parent | ac020196166b48371433772db645eab7de8c2ede (diff) |
efi_selftest: colored test output
Add color coding to output:
test section blue
success green
errors red
todo yellow
summary white
others light gray
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
[agraf: Fold in move of set_attribute before the print]
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_selftest/efi_selftest_console.c')
-rw-r--r-- | lib/efi_selftest/efi_selftest_console.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index 963ed913db..e1649f48bc 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -130,12 +130,13 @@ static void int2dec(s32 value, u16 **buf) } /* - * Print a formatted string to the EFI console + * Print a colored formatted string to the EFI console * - * @fmt: format string - * @...: optional arguments + * @color color, see constants in efi_api.h, use -1 for no color + * @fmt format string + * @... optional arguments */ -void efi_st_printf(const char *fmt, ...) +void efi_st_printc(int color, const char *fmt, ...) { va_list args; u16 buf[160]; @@ -146,6 +147,8 @@ void efi_st_printf(const char *fmt, ...) va_start(args, fmt); + if (color >= 0) + con_out->set_attribute(con_out, (unsigned long)color); c = fmt; for (; *c; ++c) { switch (*c) { @@ -220,6 +223,8 @@ void efi_st_printf(const char *fmt, ...) va_end(args); *pos = 0; con_out->output_string(con_out, buf); + if (color >= 0) + con_out->set_attribute(con_out, EFI_LIGHTGRAY); } /* |