Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/lib/messaging/tests/irpc.c

    r414 r745  
    2424#include "lib/messaging/irpc.h"
    2525#include "librpc/gen_ndr/ndr_echo.h"
     26#include "librpc/gen_ndr/ndr_echo_c.h"
    2627#include "torture/torture.h"
    2728#include "cluster/cluster.h"
     
    5859{
    5960        struct irpc_message *irpc = talloc_get_type(private_data, struct irpc_message);
    60         struct echo_EchoData *r = irpc->data;
    61         r->out.out_data = talloc_memdup(r, r->in.in_data, r->in.len);
     61        struct echo_EchoData *r = (struct echo_EchoData *)irpc->data;
     62        r->out.out_data = (uint8_t *)talloc_memdup(r, r->in.in_data, r->in.len);
    6263        if (r->out.out_data == NULL) {
    6364                irpc_send_reply(irpc, NT_STATUS_NO_MEMORY);
     
    8990        const struct irpc_test_data *data = (const struct irpc_test_data *)_data;
    9091        uint32_t value = *(const uint32_t *)_value;
     92        struct dcerpc_binding_handle *irpc_handle;
     93
     94        irpc_handle = irpc_binding_handle(test, data->msg_ctx1,
     95                                          cluster_id(0, MSG_ID2),
     96                                          &ndr_table_rpcecho);
     97        torture_assert(test, irpc_handle, "no memory");
    9198
    9299        /* make the call */
     
    94101
    95102        test_debug = true;
    96         status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2),
    97                            rpcecho, ECHO_ADDONE, &r, test);
     103        status = dcerpc_echo_AddOne_r(irpc_handle, test, &r);
    98104        test_debug = false;
    99105        torture_assert_ntstatus_ok(test, status, "AddOne failed");
     
    118124        const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data;
    119125        TALLOC_CTX *mem_ctx = tctx;
     126        struct dcerpc_binding_handle *irpc_handle;
     127
     128        irpc_handle = irpc_binding_handle(mem_ctx, data->msg_ctx1,
     129                                          cluster_id(0, MSG_ID2),
     130                                          &ndr_table_rpcecho);
     131        torture_assert(tctx, irpc_handle, "no memory");
    120132
    121133        /* make the call */
     
    123135        r.in.len = strlen((char *)r.in.in_data);
    124136
    125         status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2),
    126                            rpcecho, ECHO_ECHODATA, &r,
    127                            mem_ctx);
     137        status = dcerpc_echo_EchoData_r(irpc_handle, mem_ctx, &r);
    128138        torture_assert_ntstatus_ok(tctx, status, "EchoData failed");
    129139
     
    142152}
    143153
    144 
    145 static void irpc_callback(struct irpc_request *irpc)
    146 {
    147         struct echo_AddOne *r = (struct echo_AddOne *)irpc->r;
    148         int *pong_count = (int *)irpc->async.private_data;
    149         NTSTATUS status = irpc_call_recv(irpc);
     154struct irpc_callback_state {
     155        struct echo_AddOne r;
     156        int *pong_count;
     157};
     158
     159static void irpc_callback(struct tevent_req *subreq)
     160{
     161        struct irpc_callback_state *s =
     162                tevent_req_callback_data(subreq,
     163                struct irpc_callback_state);
     164        NTSTATUS status;
     165
     166        status = dcerpc_echo_AddOne_r_recv(subreq, s);
     167        TALLOC_FREE(subreq);
    150168        if (!NT_STATUS_IS_OK(status)) {
    151169                printf("irpc call failed - %s\n", nt_errstr(status));
    152170        }
    153         if (*r->out.out_data != r->in.in_data + 1) {
     171        if (*s->r.out.out_data != s->r.in.in_data + 1) {
    154172                printf("AddOne wrong answer - %u + 1 = %u should be %u\n",
    155                        r->in.in_data, *r->out.out_data, r->in.in_data+1);
    156         }
    157         (*pong_count)++;
     173                       s->r.in.in_data, *s->r.out.out_data, s->r.in.in_data+1);
     174        }
     175        (*s->pong_count)++;
    158176}
    159177
     
    169187        const struct irpc_test_data *data = (const struct irpc_test_data *)tcase_data;
    170188        struct timeval tv;
    171         struct echo_AddOne r;
    172189        TALLOC_CTX *mem_ctx = tctx;
    173190        int timelimit = torture_setting_int(tctx, "timelimit", 10);
     191        struct dcerpc_binding_handle *irpc_handle;
     192
     193        irpc_handle = irpc_binding_handle(mem_ctx, data->msg_ctx1,
     194                                          cluster_id(0, MSG_ID2),
     195                                          &ndr_table_rpcecho);
     196        torture_assert(tctx, irpc_handle, "no memory");
    174197
    175198        tv = timeval_current();
    176 
    177         r.in.in_data = 0;
    178199
    179200        torture_comment(tctx, "Sending echo for %d seconds\n", timelimit);
    180201        while (timeval_elapsed(&tv) < timelimit) {
    181                 struct irpc_request *irpc;
    182 
    183                 irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(0, MSG_ID2),
    184                                       rpcecho, ECHO_ADDONE,
    185                                       &r, mem_ctx);
    186                 torture_assert(tctx, irpc != NULL, "AddOne send failed");
    187 
    188                 irpc->async.fn = irpc_callback;
    189                 irpc->async.private_data = &pong_count;
     202                struct tevent_req *subreq;
     203                struct irpc_callback_state *s;
     204
     205                s = talloc_zero(mem_ctx, struct irpc_callback_state);
     206                torture_assert(tctx, s != NULL, "no mem");
     207
     208                s->pong_count = &pong_count;
     209
     210                subreq = dcerpc_echo_AddOne_r_send(mem_ctx,
     211                                                   tctx->ev,
     212                                                   irpc_handle,
     213                                                   &s->r);
     214                torture_assert(tctx, subreq != NULL, "AddOne send failed");
     215
     216                tevent_req_set_callback(subreq, irpc_callback, s);
    190217
    191218                ping_count++;
     
    216243        *_data = data = talloc(tctx, struct irpc_test_data);
    217244
    218         lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
     245        lpcfg_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
    219246
    220247        data->ev = tctx->ev;
    221248        torture_assert(tctx, data->msg_ctx1 =
    222249                       messaging_init(tctx,
    223                                       lp_messaging_path(tctx, tctx->lp_ctx),
     250                                      lpcfg_messaging_path(tctx, tctx->lp_ctx),
    224251                                      cluster_id(0, MSG_ID1),
    225                                       lp_iconv_convenience(tctx->lp_ctx),
    226252                                      data->ev),
    227253                       "Failed to init first messaging context");
     
    229255        torture_assert(tctx, data->msg_ctx2 =
    230256                       messaging_init(tctx,
    231                                       lp_messaging_path(tctx, tctx->lp_ctx),
     257                                      lpcfg_messaging_path(tctx, tctx->lp_ctx),
    232258                                      cluster_id(0, MSG_ID2),
    233                                       lp_iconv_convenience(tctx->lp_ctx),
    234259                                      data->ev),
    235260                       "Failed to init second messaging context");
     
    247272struct torture_suite *torture_local_irpc(TALLOC_CTX *mem_ctx)
    248273{
    249         struct torture_suite *suite = torture_suite_create(mem_ctx, "IRPC");
     274        struct torture_suite *suite = torture_suite_create(mem_ctx, "irpc");
    250275        struct torture_tcase *tcase = torture_suite_add_tcase(suite, "irpc");
    251276        int i;
  • trunk/server/source4/lib/messaging/tests/messaging.c

    r414 r745  
    6868        uint32_t msg_ping, msg_exit;
    6969
    70         lp_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
     70        lpcfg_set_cmdline(tctx->lp_ctx, "pid directory", "piddir.tmp");
    7171
    7272        ev = tctx->ev;
    7373
    7474        msg_server_ctx = messaging_init(tctx,
    75                                         lp_messaging_path(tctx, tctx->lp_ctx),
    76                                         cluster_id(0, 1),
    77                                         lp_iconv_convenience(tctx->lp_ctx),
     75                                        lpcfg_messaging_path(tctx, tctx->lp_ctx), cluster_id(0, 1),
    7876                                        ev);
    7977       
     
    8482
    8583        msg_client_ctx = messaging_init(tctx,
    86                                         lp_messaging_path(tctx, tctx->lp_ctx),
     84                                        lpcfg_messaging_path(tctx, tctx->lp_ctx),
    8785                                        cluster_id(0, 2),
    88                                         lp_iconv_convenience(tctx->lp_ctx),
    8986                                        ev);
    9087
     
    140137struct torture_suite *torture_local_messaging(TALLOC_CTX *mem_ctx)
    141138{
    142         struct torture_suite *s = torture_suite_create(mem_ctx, "MESSAGING");
     139        struct torture_suite *s = torture_suite_create(mem_ctx, "messaging");
    143140        torture_suite_add_simple_test(s, "ping_speed", test_ping_speed);
    144141        return s;
Note: See TracChangeset for help on using the changeset viewer.