diff options
author | Joel Kitching <kitching@google.com> | 2019-10-04 17:46:29 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-23 16:28:14 +0000 |
commit | 3c477458fa7f1506e722ede38636eaced8810687 (patch) | |
tree | 6af8c80467619faa021405a72ab8c6e5eb12b55b /tests | |
parent | ffa02e80c8cec862106607ffd0333258bb1ed62e (diff) | |
download | vboot-3c477458fa7f1506e722ede38636eaced8810687.tar.gz |
vboot: format hex numbers with %#x instead of 0x%x
Also standardize on using hex for printing ASCII key values
across vboot_ui.c and vboot_ui_menu.c.
BUG=b:124141368
TEST=make clean && make runtests
BRANCH=none
Change-Id: Ib10288d95e29c248ebe807d99108aea75775b155
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1840191
Reviewed-by: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/secdata_tpm_tests.c | 8 | ||||
-rw-r--r-- | tests/test_common.c | 6 | ||||
-rw-r--r-- | tests/tlcl_tests.c | 2 | ||||
-rw-r--r-- | tests/tpm_lite/lock.c | 2 | ||||
-rw-r--r-- | tests/tpm_lite/startup.c | 6 | ||||
-rw-r--r-- | tests/tpm_lite/tlcl_tests.h | 4 | ||||
-rw-r--r-- | tests/tpm_lite/tpmtest_timing.c | 2 | ||||
-rw-r--r-- | tests/tpm_lite/tpmtest_writelimit.c | 2 | ||||
-rw-r--r-- | tests/vboot_api_kernel_tests.c | 6 | ||||
-rw-r--r-- | tests/vboot_detach_menu_tests.c | 6 |
10 files changed, 22 insertions, 22 deletions
diff --git a/tests/secdata_tpm_tests.c b/tests/secdata_tpm_tests.c index cac51338..dd28e62a 100644 --- a/tests/secdata_tpm_tests.c +++ b/tests/secdata_tpm_tests.c @@ -141,7 +141,7 @@ uint32_t TlclSetDeactivated(uint8_t flag) uint32_t TlclRead(uint32_t index, void* data, uint32_t length) { - mock_cnext += sprintf(mock_cnext, "TlclRead(0x%x, %d)\n", + mock_cnext += sprintf(mock_cnext, "TlclRead(%#x, %d)\n", index, length); if (FIRMWARE_NV_INDEX == index) { @@ -164,7 +164,7 @@ uint32_t TlclRead(uint32_t index, void* data, uint32_t length) uint32_t TlclWrite(uint32_t index, const void *data, uint32_t length) { - mock_cnext += sprintf(mock_cnext, "TlclWrite(0x%x, %d)\n", + mock_cnext += sprintf(mock_cnext, "TlclWrite(%#x, %d)\n", index, length); if (FIRMWARE_NV_INDEX == index) { @@ -180,7 +180,7 @@ uint32_t TlclWrite(uint32_t index, const void *data, uint32_t length) uint32_t TlclDefineSpace(uint32_t index, uint32_t perm, uint32_t size) { - mock_cnext += sprintf(mock_cnext, "TlclDefineSpace(0x%x, 0x%x, %d)\n", + mock_cnext += sprintf(mock_cnext, "TlclDefineSpace(%#x, %#x, %d)\n", index, perm, size); return (++mock_count == fail_at_count) ? fail_with_error : TPM_SUCCESS; } @@ -246,7 +246,7 @@ uint32_t TlclLockPhysicalPresence(void) uint32_t TlclGetPermissions(uint32_t index, uint32_t* permissions) { - mock_cnext += sprintf(mock_cnext, "TlclGetPermissions(0x%x)\n", index); + mock_cnext += sprintf(mock_cnext, "TlclGetPermissions(%#x)\n", index); *permissions = mock_permissions; return (++mock_count == fail_at_count) ? fail_with_error : TPM_SUCCESS; } diff --git a/tests/test_common.c b/tests/test_common.c index 02cbc165..21740b60 100644 --- a/tests/test_common.c +++ b/tests/test_common.c @@ -27,7 +27,7 @@ int test_eq(int result, int expected, } else { fprintf(stderr, "%s: %s ... " COL_RED "FAILED\n" COL_STOP, preamble, comment ? comment : desc); - fprintf(stderr, " Expected: 0x%x (%d), got: 0x%x (%d)\n", + fprintf(stderr, " Expected: %#x (%d), got: %#x (%d)\n", expected, expected, result, result); gTestSuccess = 0; return 0; @@ -44,7 +44,7 @@ int test_neq(int result, int not_expected, } else { fprintf(stderr, "%s: %s, %s ... " COL_RED "FAILED\n" COL_STOP, preamble, desc, comment); - fprintf(stderr, " Didn't expect 0x%x (%d), but got it.\n", + fprintf(stderr, " Didn't expect %#x (%d), but got it.\n", not_expected, not_expected); gTestSuccess = 0; return 0; @@ -139,7 +139,7 @@ int test_succ(int result, } else { fprintf(stderr, "%s: %s ... " COL_RED "FAILED\n" COL_STOP, preamble, comment ? comment : desc); - fprintf(stderr, " Expected SUCCESS, got: 0x%x (%d)\n", + fprintf(stderr, " Expected SUCCESS, got: %#x (%d)\n", result, result); gTestSuccess = 0; } diff --git a/tests/tlcl_tests.c b/tests/tlcl_tests.c index 7e8d2311..c9521f97 100644 --- a/tests/tlcl_tests.c +++ b/tests/tlcl_tests.c @@ -88,7 +88,7 @@ uint32_t VbExTpmSendReceive(const uint8_t *request, uint32_t request_length, FromTpmUint32(request + 6, &c->req_cmd); // KLUDGE - remove - printf("TSR [%d] 0x%x\n", ncalls-1, c->req_cmd); + printf("TSR [%d] %#x\n", ncalls-1, c->req_cmd); memset(response, 0, *response_length); if (c->rsp_size) diff --git a/tests/tpm_lite/lock.c b/tests/tpm_lite/lock.c index bfc10e2e..55d2dfe7 100644 --- a/tests/tpm_lite/lock.c +++ b/tests/tpm_lite/lock.c @@ -24,6 +24,6 @@ int main(int argc, char** argv) { TlclWriteLock(INDEX0); - printf("Locked 0x%x\n", INDEX0); + printf("Locked %#x\n", INDEX0); exit(0); } diff --git a/tests/tpm_lite/startup.c b/tests/tpm_lite/startup.c index 3d901f39..573373dc 100644 --- a/tests/tpm_lite/startup.c +++ b/tests/tpm_lite/startup.c @@ -15,17 +15,17 @@ int main(int argc, char** argv) { TlclLibInit(); result = TlclStartup(); if (result != 0) { - printf("tpm startup failed with 0x%x\n", result); + printf("tpm startup failed with %#x\n", result); } result = TlclGetFlags(NULL, NULL, NULL); if (result != 0) { - printf("tpm getflags failed with 0x%x\n", result); + printf("tpm getflags failed with %#x\n", result); } printf("executing SelfTestFull\n"); TlclSelfTestFull(); result = TlclGetFlags(NULL, NULL, NULL); if (result != 0) { - printf("tpm getflags failed with 0x%x\n", result); + printf("tpm getflags failed with %#x\n", result); } printf("TEST SUCCEEDED\n"); return 0; diff --git a/tests/tpm_lite/tlcl_tests.h b/tests/tpm_lite/tlcl_tests.h index 7b0d295c..db0999cd 100644 --- a/tests/tpm_lite/tlcl_tests.h +++ b/tests/tpm_lite/tlcl_tests.h @@ -19,8 +19,8 @@ uint32_t _result = (tpm_command); \ uint32_t _exp = (expected_result); \ if (_result != _exp) { \ - printf("TEST FAILED: line %d: " #tpm_command ": 0x%x" \ - " (expecting 0x%x)\n", __LINE__, _result, _exp); \ + printf("TEST FAILED: line %d: " #tpm_command ": %#x" \ + " (expecting %#x)\n", __LINE__, _result, _exp); \ return _result; \ } \ } while (0) diff --git a/tests/tpm_lite/tpmtest_timing.c b/tests/tpm_lite/tpmtest_timing.c index d86b4eee..1ec14a2e 100644 --- a/tests/tpm_lite/tpmtest_timing.c +++ b/tests/tpm_lite/tpmtest_timing.c @@ -28,7 +28,7 @@ gettimeofday(&before, NULL); \ __result = op; \ if (__result != TPM_SUCCESS) { \ - printf(#op ": error 0x%x\n", __result); \ + printf(#op ": error %#x\n", __result); \ errors++; \ } \ gettimeofday(&after, NULL); \ diff --git a/tests/tpm_lite/tpmtest_writelimit.c b/tests/tpm_lite/tpmtest_writelimit.c index 75bae9f1..05e4a178 100644 --- a/tests/tpm_lite/tpmtest_writelimit.c +++ b/tests/tpm_lite/tpmtest_writelimit.c @@ -43,7 +43,7 @@ int main(int argc, char** argv) { "MAX_NV_WRITES_NOOWNER reached"); break; default: - VB2_DEBUG("unexpected error code %d (0x%x)\n", + VB2_DEBUG("unexpected error code %d (%#x)\n", result, result); exit(1); } diff --git a/tests/vboot_api_kernel_tests.c b/tests/vboot_api_kernel_tests.c index 8c57dee6..5452f1d3 100644 --- a/tests/vboot_api_kernel_tests.c +++ b/tests/vboot_api_kernel_tests.c @@ -364,7 +364,7 @@ vb2_error_t VbExDiskGetInfo(VbDiskInfo **infos_ptr, uint32_t *count, mock_disks[num_disks].handle = (VbExDiskHandle_t) t->disks_to_provide[i].diskname; VB2_DEBUG(" mock_disk[%d] %" PRIu64 " %" PRIu64 - " 0x%x %s\n", i, + " %#x %s\n", i, mock_disks[num_disks].bytes_per_lba, mock_disks[num_disks].lba_count, mock_disks[num_disks].flags, @@ -384,7 +384,7 @@ vb2_error_t VbExDiskGetInfo(VbDiskInfo **infos_ptr, uint32_t *count, *count = num_disks; VB2_DEBUG(" *count=%" PRIu32 "\n", *count); - VB2_DEBUG(" return 0x%x\n", t->diskgetinfo_return_val); + VB2_DEBUG(" return %#x\n", t->diskgetinfo_return_val); return t->diskgetinfo_return_val; } @@ -416,7 +416,7 @@ void vb2_nv_set(struct vb2_context *c, { if (param != VB2_NV_RECOVERY_REQUEST) return; - VB2_DEBUG("%s(): got_recovery_request_val = %d (0x%x)\n", __FUNCTION__, + VB2_DEBUG("%s(): got_recovery_request_val = %d (%#x)\n", __FUNCTION__, value, value); got_recovery_request_val = value; } diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c index ade3abd9..8d134e46 100644 --- a/tests/vboot_detach_menu_tests.c +++ b/tests/vboot_detach_menu_tests.c @@ -220,7 +220,7 @@ vb2_error_t VbDisplayScreen(struct vb2_context *c, uint32_t screen, int force, { if (screens_count < ARRAY_SIZE(screens_displayed)) screens_displayed[screens_count++] = screen; - printf("VbDisplayScreen: screens_displayed[%d] = 0x%x\n", + printf("VbDisplayScreen: screens_displayed[%d] = %#x\n", screens_count - 1, screen); return VB2_SUCCESS; } @@ -232,8 +232,8 @@ vb2_error_t VbDisplayMenu(struct vb2_context *c, uint32_t screen, int force, screens_displayed[screens_count++] = screen; else printf("Ran out of screens_displayed entries!\n"); - printf("VbDisplayMenu: screens_displayed[%d] = 0x%x," - " selected_index = %u, disabled_idx_mask = 0x%x\n", + printf("VbDisplayMenu: screens_displayed[%d] = %#x," + " selected_index = %u, disabled_idx_mask = %#x\n", screens_count - 1, screen, selected_index, disabled_idx_mask); |