diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-07-08 13:14:15 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-07-12 17:04:22 +0000 |
commit | ebbbdf1a29296004acaa87b57de2059c146e3a3e (patch) | |
tree | 61c28e3aaa4519a74f48f5c9c307fb598d201093 /test | |
parent | c0f4b8bec7ccb755fb1151b01816d6cf5d26fdfa (diff) | |
download | chrome-ec-ebbbdf1a29296004acaa87b57de2059c146e3a3e.tar.gz |
tree: Remove non-standard %pb printf format
The binary printf format doesn't provide much over printing hex, so
change existing binary prints to hex. Using standard format specifiers
makes it easier to switch between the "builtin" EC standard library and
the C standard library provided by the toolchain (or Zephyr).
BRANCH=none
BUG=b:238433667, b:234181908
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I55153f0ea1a4864e7819cee0e0f35368baa3f682
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3756176
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/printf.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/test/printf.c b/test/printf.c index 8ad84f46c4..90d146b45d 100644 --- a/test/printf.c +++ b/test/printf.c @@ -286,7 +286,6 @@ test_static int test_vsnprintf_long(void) test_static int test_vsnprintf_pointers(void) { void *ptr = (void *)0x55005E00; - unsigned int val = 0; T(expect_success("55005e00", "%pP", ptr)); T(expect_success(err_str, "%P", ptr)); @@ -297,18 +296,12 @@ test_static int test_vsnprintf_pointers(void) /* %p with an unknown suffix is invalid */ T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%pQ")); - /* Test %pb, binary format */ - T(expect_success("0", "%pb", BINARY_VALUE(val, 0))); - val = 0x5E; - T(expect_success("1011110", "%pb", BINARY_VALUE(val, 0))); - T(expect_success("0000000001011110", "%pb", BINARY_VALUE(val, 16))); - val = 0x12345678; - T(expect_success("10010001101000101011001111000", "%pb", - BINARY_VALUE(val, 0))); - val = 0xFEDCBA90; - /* Test a number that makes the longest string possible */ - T(expect_success("11111110110111001011101010010000", "%pb", - BINARY_VALUE(val, 0))); + /* + * Test %pb, which used to print binary, but is non-standard and no + * longer supported. + */ + T(expect(EC_ERROR_INVAL, "", false, sizeof(output), "%pb", 0xff)); + return EC_SUCCESS; } |