summaryrefslogtreecommitdiff
path: root/test/print_ut.c
AgeCommit message (Collapse)Author
2020-05-18common: Drop log.h from common headerSimon Glass
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-18command: Remove the cmd_tbl_t typedefSimon Glass
We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-06-07lib/vsprintf: allow printing upper case GUIDsHeinrich Schuchardt
In the UEFI context GUIDs are expected to be rendered in upper case. The patch uses the formerly unused bit 1 of the parameter str_format of function uuid_bin_to_str() to indicate if we need upper or lower case output. Function uuid_string() in vsprint.c is adjusted to correctly set the bit depending on the print format code. %pUb: 01020304-0506-0708-090a-0b0c0d0e0f10 %pUB: 01020304-0506-0708-090A-0B0C0D0E0F10 %pUl: 04030201-0605-0807-090a-0b0c0d0e0f10 %pUL: 04030201-0605-0807-090A-0B0C0D0E0F10 Up to this point only a diagnostic message in mount_ubifs() using '%pUB' is concerned by the change. Further patches are needed to adjust the UEFI subsystem. A unit test is provided inside the ut_print command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-05lib/display_options: avoid illegal memory accessHeinrich Schuchardt
display_options_get_banner_priv() overwrites bytes before the start of the buffer if the buffer size is less then 3. This case occurs in the Sandbox when executing the `ut_print` command. Correctly handle small buffer sizes. Adjust the print unit test to catch when bytes before the buffer are overwritten. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-09-23test: print_ut.c use #if CONFIG_IS_ENABLED(EFI_LOADER)Heinrich Schuchardt
Using CONFIG_IS_ENABLED(EFI_LOADER) allows to simply the #if statements. Suggested-by: Alexander Graf <agraf@suse.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-28vsprintf.c: correct printing of a NULL device pathHeinrich Schuchardt
When printing '%pD' with a value of NULL we want to output '<NULL>'. But this requires copying to buf. Leave this to string16. A unit test is supplied which relies on EFI support in the sandbox. The development for EFI support in the sandbox is currently in branch u-boot-dm/efi-working. The branch lacks commit 6ea8b580f06b ("efi_loader: correct DeviceNodeToText for media types"). Ater rebasing the aforementioned branch on U-Boot v2018.01 and adding 256060e4257a2 and this patch the test is executed successfully. Fixes: 256060e4257a2 (vsprintf.c: add EFI device path printing) Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22vsprintf.c: add EFI device path printingHeinrich Schuchardt
For debugging efi_loader we need the capability to print EFI device paths. With this patch we can write: debug("device path: %pD", dp); A possible output would be device path: /MemoryMapped(0x0,0x3ff93a82,0x3ff93a82) This enhancement is not available when building without EFI support and neither in the SPL nor in the API example. A test is provided. It can be executed in the sandbox with command ut_print. The development for EFI support in the sandbox is currently in branch u-boot-dm/efi-working. The branch currently lacks commit 6ea8b580f06b ("efi_loader: correct DeviceNodeToText for media types"). Ater rebasing the aforementioned branch on U-Boot v2018.01 the test is executed successfully. Without EFI support in the sandbox the test is simply skipped. Suggested-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-08test: print_ut: Add test for %ls stringsRob Clark
Add a simple test for long strings. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-07-11test: Add a test for snprintf() and the banner/versionSimon Glass
Add a simple test to make sure that these functions obey the buffer size passed into them. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Stephen Warren <swarren@nvidia.com>