hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Colin Patrick McCabe (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-10636) Native Hadoop Client:add unit test case for call&client_id
Date Tue, 17 Jun 2014 04:45:02 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-10636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14033430#comment-14033430
] 

Colin Patrick McCabe commented on HADOOP-10636:
-----------------------------------------------

{code}
    uv_sem_t sem, sem1;
{code}
It seems a bit confusing to have both a sem and sem1.  Maybe name them 1 and 2, or just use
the same sem throughout?

{code}
void hrpc_call_deliver_resp_test_cb(struct hrpc_response *resp,                          
     
                            struct hadoop_err *err, void *cb_data)                       
     
{
    uv_sem_t *sem = cb_data;                                                             
     
    EXPECT_NONNULL(resp);                                                                
     
    EXPECT_NULL(err);                                                                    
     
    free(resp->base);                                                                 
        
    uv_sem_post(sem);                                                                    
     
}
{code}
We can't use {{EXPECT_NONNULL}} here, since it tries to return if the condition is wrong,
and this function is declared {{void}}.  One easy way around this is doing something like
this:

{code}
void hrpc_call_deliver_resp_test_cb(struct hrpc_response *resp,                          
     
                            struct hadoop_err *err, void *cb_data)
{
    if resp_test_cb(resp, err, data) {
        abort();
    }
}

static int resp_test_cb(struct hrpc_response *resp,                                
                            struct hadoop_err *err, void *cb_data)
{
do EXPECT, etc.
}
{code}

You could also set an error code from the callback (like you'd do in "real code") that you
check in {{main}}.  But this way is a little simpler, maybe.

Looks good aside from that.

> 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, HADOOP-10636-pnative.005.patch,
HADOOP-10636-pnative.006.patch
>
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message