mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
Add a quick test of wb_trans_send/recv
This commit is contained in:
parent
4df681abf4
commit
1b328d9820
@ -930,6 +930,7 @@ SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/uta
|
||||
|
||||
SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) \
|
||||
$(LIBSMB_OBJ) $(KRBCLIENT_OBJ) $(LIB_NONSMBD_OBJ) \
|
||||
lib/wb_reqtrans.o lib/wbclient.o \
|
||||
$(LIBNDR_GEN_OBJ0)
|
||||
|
||||
MASKTEST_OBJ = torture/masktest.o $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \
|
||||
|
@ -5493,6 +5493,70 @@ static bool run_local_memcache(int dummy)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void wbclient_done(struct async_req *req)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct winbindd_response *wb_resp;
|
||||
int *i = (int *)req->async.priv;
|
||||
|
||||
status = wb_trans_recv(req, req, &wb_resp);
|
||||
TALLOC_FREE(req);
|
||||
*i += 1;
|
||||
d_printf("wb_trans_recv %d returned %s\n", *i, nt_errstr(status));
|
||||
}
|
||||
|
||||
static bool run_local_wbclient(int dummy)
|
||||
{
|
||||
struct event_context *ev;
|
||||
struct wb_context **wb_ctx;
|
||||
struct winbindd_request wb_req;
|
||||
bool result = false;
|
||||
int i, j;
|
||||
|
||||
BlockSignals(True, SIGPIPE);
|
||||
|
||||
ev = event_context_init(talloc_tos());
|
||||
if (ev == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
wb_ctx = TALLOC_ARRAY(ev, struct wb_context *, torture_numops);
|
||||
if (wb_ctx == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ZERO_STRUCT(wb_req);
|
||||
wb_req.cmd = WINBINDD_PING;
|
||||
|
||||
for (i=0; i<torture_numops; i++) {
|
||||
wb_ctx[i] = wb_context_init(ev);
|
||||
if (wb_ctx[i] == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
for (j=0; j<5; j++) {
|
||||
struct async_req *req;
|
||||
req = wb_trans_send(ev, ev, wb_ctx[i],
|
||||
(j % 2) == 0, &wb_req);
|
||||
if (req == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
req->async.fn = wbclient_done;
|
||||
req->async.priv = &i;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
||||
while (i < 5 * torture_numops) {
|
||||
event_loop_once(ev);
|
||||
}
|
||||
|
||||
result = true;
|
||||
fail:
|
||||
TALLOC_FREE(ev);
|
||||
return result;
|
||||
}
|
||||
|
||||
static double create_procs(bool (*fn)(int), bool *result)
|
||||
{
|
||||
int i, status;
|
||||
@ -5652,6 +5716,7 @@ static struct {
|
||||
{ "LOCAL-RBTREE", run_local_rbtree, 0},
|
||||
{ "LOCAL-MEMCACHE", run_local_memcache, 0},
|
||||
{ "LOCAL-STREAM-NAME", run_local_stream_name, 0},
|
||||
{ "LOCAL-WBCLIENT", run_local_wbclient, 0},
|
||||
{NULL, NULL, 0}};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user