summaryrefslogtreecommitdiff
path: root/common/test_util.c
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-06-19 00:29:08 +0800
committerChromeBot <chrome-bot@google.com>2013-07-11 04:26:10 -0700
commit62f2a33ff2ff37ad8226fd854712206f3ccd745e (patch)
tree7c4e226ce5269b37d61c6f7d6a5fbda0c5482d3a /common/test_util.c
parentb3f1d0d0593a430a5fb7605e5fc4337ae0a8833c (diff)
downloadchrome-ec-62f2a33ff2ff37ad8226fd854712206f3ccd745e.tar.gz
Add flash host read command test
This checks the correctness of data returned by flash read host command. BUG=chrome-os-partner:19236 TEST=Pass all tests. BRANCH=None Change-Id: I3b97addb9b14922e9f33a71b865000ae9a8d40a8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60963 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/test_util.c')
-rw-r--r--common/test_util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/test_util.c b/common/test_util.c
index c133ac9d24..10e718399f 100644
--- a/common/test_util.c
+++ b/common/test_util.c
@@ -70,6 +70,7 @@ int test_send_host_command(int command, int version, const void *params,
int params_size, void *resp, int resp_size)
{
struct host_cmd_handler_args args;
+ int rv;
args.version = version;
args.command = command;
@@ -79,7 +80,12 @@ int test_send_host_command(int command, int version, const void *params,
args.response_max = resp_size;
args.response_size = 0;
- return host_command_process(&args);
+ rv = host_command_process(&args);
+
+ if (args.response != resp)
+ memcpy(resp, args.response, args.response_size);
+
+ return rv;
}
#endif /* TASK_HAS_HOSTCMD */