You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "Colin Patrick McCabe (JIRA)" <ji...@apache.org> on 2014/06/12 22:15:03 UTC
[jira] [Commented] (HADOOP-10636) Native Hadoop Client:add unit
test case for call&client_id
[ https://issues.apache.org/jira/browse/HADOOP-10636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14029731#comment-14029731 ]
Colin Patrick McCabe commented on HADOOP-10636:
-----------------------------------------------
{{hrpc_call_deliver_err_test_cb}} should free the error message (that's the convention for callbacks).
{code}
+ call = (struct hrpc_call *)malloc(sizeof(*call));
{code}
No need for {{malloc}} here. Just create this on the stack. Similarly with {{payload.base}}.
{code}
+int test_hrpc_client_id(void)
+{
+ struct hrpc_client_id *id, *id1;
+ char str[36];
+ void *bytes;
+
+ id = (struct hrpc_client_id *)malloc(sizeof(*id));
+ id1 = (struct hrpc_client_id *)malloc(sizeof(*id1));
+ bytes = (void *)malloc(10);
{code}
You don't need malloc here. Just create a structure of type {{hrpc_client}}. You can still use {{memset}} to zero it. Similarly with {{bytes}}.
{code}
+ EXPECT_NO_HADOOP_ERR(hrpc_client_id_from_bytes(bytes, 16, id));
{code}
Should use {{HRPC_CLIENT_ID_LEN}} here (and in variable declaration).
{code}
+ EXPECT_STR_EQ("00000000-00000000-00000000-00000000"
+ ,hrpc_client_id_to_str(id, str, 36));
{code}
Should use {{sizeof(str)}}.
> Native Hadoop Client:add unit test case for call&client_id
> ----------------------------------------------------------
>
> Key: HADOOP-10636
> URL: https://issues.apache.org/jira/browse/HADOOP-10636
> Project: Hadoop Common
> Issue Type: Sub-task
> Affects Versions: HADOOP-10388
> Reporter: Wenwu Peng
> Assignee: Wenwu Peng
> Attachments: HADOOP-10636-pnative.001.patch, HADOOP-10636-pnative.002.patch, HADOOP-10636-pnative.003.patch, HADOOP-10636-pnative.004.patch
>
>
--
This message was sent by Atlassian JIRA
(v6.2#6252)