summaryrefslogtreecommitdiff
path: root/test/host_command.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/host_command.c')
-rw-r--r--test/host_command.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/test/host_command.c b/test/host_command.c
index ba1d4dcd96..e88ddc852c 100644
--- a/test/host_command.c
+++ b/test/host_command.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -8,6 +8,7 @@
#include "common.h"
#include "console.h"
#include "host_command.h"
+#include "printf.h"
#include "task.h"
#include "test_util.h"
#include "timer.h"
@@ -177,6 +178,7 @@ static int test_hostcmd_reuse_response_buffer(void)
struct ec_host_request *h = (struct ec_host_request *)resp_buf;
struct ec_params_hello *d =
(struct ec_params_hello *)(resp_buf + sizeof(*h));
+ char str_buf[hex_str_buf_size(BUFFER_SIZE)];
h->struct_version = 3;
h->checksum = 0;
@@ -201,16 +203,18 @@ static int test_hostcmd_reuse_response_buffer(void)
h->checksum = calculate_checksum(resp_buf, pkt.request_size);
- ccprintf("\nBuffer contents before process 0x%ph\n",
- HEX_BUF(resp_buf, BUFFER_SIZE));
+ snprintf_hex_buffer(str_buf, sizeof(str_buf),
+ HEX_BUF(resp_buf, BUFFER_SIZE));
+ ccprintf("\nBuffer contents before process 0x%s\n", str_buf);
host_packet_receive(&pkt);
task_wait_event(-1);
- ccprintf("\nBuffer contents after process 0x%ph\n",
- HEX_BUF(resp_buf, BUFFER_SIZE));
+ snprintf_hex_buffer(str_buf, sizeof(str_buf),
+ HEX_BUF(resp_buf, BUFFER_SIZE));
+ ccprintf("\nBuffer contents after process 0x%s\n", str_buf);
- TEST_EQ(calculate_checksum(resp_buf,
- sizeof(*resp) + resp->data_len), 0, "%d");
+ TEST_EQ(calculate_checksum(resp_buf, sizeof(*resp) + resp->data_len), 0,
+ "%d");
TEST_EQ(resp->result, EC_RES_SUCCESS, "%d");
TEST_EQ(r->out_data, 0x12243648, "0x%x");
@@ -239,6 +243,7 @@ static void hostcmd_fill_chip_info(void)
static int test_hostcmd_clears_unused_data(void)
{
int i, found_null;
+ char str_buf[hex_str_buf_size(BUFFER_SIZE)];
/* Set the buffer to junk and ensure that is gets cleared */
memset(resp_buf, 0xAA, BUFFER_SIZE);
@@ -246,11 +251,12 @@ static int test_hostcmd_clears_unused_data(void)
hostcmd_send();
- ccprintf("\nBuffer contents 0x%ph\n",
- HEX_BUF(resp_buf, BUFFER_SIZE));
+ snprintf_hex_buffer(str_buf, sizeof(str_buf),
+ HEX_BUF(resp_buf, BUFFER_SIZE));
+ ccprintf("\nBuffer contents 0x%s\n", str_buf);
- TEST_EQ(calculate_checksum(resp_buf,
- sizeof(*resp) + resp->data_len), 0, "%d");
+ TEST_EQ(calculate_checksum(resp_buf, sizeof(*resp) + resp->data_len), 0,
+ "%d");
TEST_EQ(resp->result, EC_RES_SUCCESS, "%d");
/* Ensure partial strings have 0s after the NULL byte */
@@ -300,7 +306,7 @@ static int test_hostcmd_clears_unused_data(void)
return EC_SUCCESS;
}
-void run_test(int argc, char **argv)
+void run_test(int argc, const char **argv)
{
wait_for_task_started();
test_reset();