mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
torture3: Reproducer for bug 10284
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Nov 26 22:53:04 CET 2013 on sn-devel-104
This commit is contained in:
parent
6b6920b029
commit
ebc157961a
@ -64,6 +64,7 @@ tests = ["FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7"
|
||||
"CLEANUP1",
|
||||
"CLEANUP2",
|
||||
"CLEANUP4",
|
||||
"LOCAL-MSG2",
|
||||
"BAD-NBT-SESSION"]
|
||||
|
||||
for t in tests:
|
||||
|
@ -107,6 +107,7 @@ bool run_cleanup3(int dummy);
|
||||
bool run_cleanup4(int dummy);
|
||||
bool run_ctdb_conn(int dummy);
|
||||
bool run_msg_test(int dummy);
|
||||
bool run_msg_test2(int dummy);
|
||||
bool run_notify_bench2(int dummy);
|
||||
bool run_notify_bench3(int dummy);
|
||||
bool run_dbwrap_watch1(int dummy);
|
||||
|
@ -129,3 +129,89 @@ bool run_msg_test(int dummy)
|
||||
TALLOC_FREE(ev);
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reproducer for bug 10284
|
||||
*/
|
||||
|
||||
static void msg_callback(struct tevent_req *subreq);
|
||||
|
||||
struct msg_test2_state {
|
||||
struct tevent_context *ev;
|
||||
struct messaging_context *msg;
|
||||
struct msg_channel *channel;
|
||||
struct messaging_rec *rec;
|
||||
struct tevent_req *req;
|
||||
};
|
||||
|
||||
bool run_msg_test2(int dummy)
|
||||
{
|
||||
struct msg_test2_state s;
|
||||
NTSTATUS status;
|
||||
int i, ret;
|
||||
|
||||
s.ev = samba_tevent_context_init(talloc_tos());
|
||||
if (s.ev == NULL) {
|
||||
fprintf(stderr, "tevent_context_init failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
s.msg = messaging_init(s.ev, s.ev);
|
||||
if (s.msg == NULL) {
|
||||
fprintf(stderr, "messaging_init failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = msg_channel_init(s.ev, s.msg, MSG_PING, &s.channel);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "msg_channel_init returned %s\n",
|
||||
strerror(ret));
|
||||
return false;
|
||||
}
|
||||
|
||||
status = messaging_send(s.msg, messaging_server_id(s.msg), MSG_PING,
|
||||
&data_blob_null);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
fprintf(stderr, "messaging_send returned %s\n",
|
||||
nt_errstr(status));
|
||||
return false;
|
||||
}
|
||||
|
||||
ret = tevent_loop_once(s.ev);
|
||||
if (ret == -1) {
|
||||
fprintf(stderr, "tevent_loop_once failed: %s\n",
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
s.req = msg_read_send(s.ev, s.ev, s.channel);
|
||||
if (s.req == NULL) {
|
||||
fprintf(stderr, "msg_read_send failed\n");
|
||||
return false;
|
||||
}
|
||||
tevent_req_set_callback(s.req, msg_callback, &s);
|
||||
|
||||
status = messaging_send(s.msg, messaging_server_id(s.msg), MSG_PING,
|
||||
&data_blob_null);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
fprintf(stderr, "messaging_send returned %s\n",
|
||||
nt_errstr(status));
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
tevent_loop_once(s.ev);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void msg_callback(struct tevent_req *subreq)
|
||||
{
|
||||
struct msg_test2_state *s = _tevent_req_callback_data(subreq);
|
||||
struct messaging_rec *rec;
|
||||
msg_read_recv(subreq, NULL, &rec);
|
||||
TALLOC_FREE(subreq);
|
||||
subreq = msg_read_send(s->ev, s->ev, s->channel);
|
||||
tevent_req_set_callback(subreq, msg_callback, s);
|
||||
}
|
||||
|
@ -9573,6 +9573,7 @@ static struct {
|
||||
{ "LOCAL-TALLOC-DICT", run_local_talloc_dict, 0},
|
||||
{ "LOCAL-CTDB-CONN", run_ctdb_conn, 0},
|
||||
{ "LOCAL-MSG", run_msg_test, 0},
|
||||
{ "LOCAL-MSG2", run_msg_test2, 0},
|
||||
{ "LOCAL-DBWRAP-WATCH1", run_dbwrap_watch1, 0 },
|
||||
{ "LOCAL-BASE64", run_local_base64, 0},
|
||||
{ "LOCAL-RBTREE", run_local_rbtree, 0},
|
||||
|
Loading…
Reference in New Issue
Block a user