summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-04 12:41:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:00 -0500
commit5f475b80ee038085449647164069e8e70d37cf5d (patch)
treeac5bb5ddf1965def9dc1b946854b074bd1b7d9ae /source4/torture
parentaa95279b81f5d3f687d6ce84ea3882294553d1f5 (diff)
downloadsamba-5f475b80ee038085449647164069e8e70d37cf5d.tar.gz
samba-5f475b80ee038085449647164069e8e70d37cf5d.tar.bz2
samba-5f475b80ee038085449647164069e8e70d37cf5d.zip
r22670: changed the RAW-NOTIFY test to support clustered testing (two nodes)
(This used to be commit 12ce85aea16379b9946851806c1782272ee1c48f)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/raw/notify.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index e59c97c263..c75dbf0931 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -55,7 +55,8 @@
/*
basic testing of change notify on directories
*/
-static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+static BOOL test_notify_dir(struct smbcli_state *cli, struct smbcli_state *cli2,
+ TALLOC_CTX *mem_ctx)
{
BOOL ret = True;
NTSTATUS status;
@@ -110,7 +111,7 @@ static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing notify mkdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -122,7 +123,7 @@ static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing notify rmdir\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
- smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -132,10 +133,10 @@ static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
printf("testing notify mkdir - rmdir - mkdir - rmdir\n");
- smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
- smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
- smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
- smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+ smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name");
+ smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
+ smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name");
+ smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
req = smb_raw_changenotify_send(cli->tree, &notify);
status = smb_raw_changenotify_recv(req, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -174,11 +175,14 @@ static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
notify.nttrans.in.file.fnum = fnum;
req = smb_raw_changenotify_send(cli->tree, &notify);
+ status = smbcli_unlink(cli->tree, BASEDIR "\\nonexistant.txt");
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
/* (1st unlink) as the 2nd notify directly returns,
this unlink is only seen by the 1st notify and
the 3rd notify (later) */
printf("testing notify on unlink for the first file\n");
- status = smbcli_unlink(cli->tree, BASEDIR "\\test0.txt");
+ status = smbcli_unlink(cli2->tree, BASEDIR "\\test0.txt");
CHECK_STATUS(status, NT_STATUS_OK);
/* receive the reply from the 2nd notify */
@@ -186,24 +190,27 @@ static BOOL test_notify_dir(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(notify.nttrans.out.num_changes, count);
- for (i=1;i<notify.nttrans.out.num_changes;i++) {
+ for (i=1;i<count;i++) {
CHECK_VAL(notify.nttrans.out.changes[i].action, NOTIFY_ACTION_ADDED);
}
CHECK_WSTR(notify.nttrans.out.changes[0].name, "test0.txt", STR_UNICODE);
- /* and now from the 1st notify */
+ printf("and now from the 1st notify\n");
status = smb_raw_changenotify_recv(req2, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(notify.nttrans.out.num_changes, 1);
CHECK_VAL(notify.nttrans.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WSTR(notify.nttrans.out.changes[0].name, "test0.txt", STR_UNICODE);
- /* (3rd notify) this notify will only see the 1st unlink */
+ printf("(3rd notify) this notify will only see the 1st unlink\n");
req = smb_raw_changenotify_send(cli->tree, &notify);
+ status = smbcli_unlink(cli->tree, BASEDIR "\\nonexistant.txt");
+ CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
+
printf("testing notify on wildcard unlink for %d files\n", count-1);
/* (2nd unlink) do a wildcard unlink */
- status = smbcli_unlink(cli->tree, BASEDIR "\\test*.txt");
+ status = smbcli_unlink(cli2->tree, BASEDIR "\\test*.txt");
CHECK_STATUS(status, NT_STATUS_OK);
/* receive the 3rd notify */
@@ -1149,13 +1156,16 @@ done:
*/
BOOL torture_raw_notify(struct torture_context *torture)
{
- struct smbcli_state *cli;
+ struct smbcli_state *cli, *cli2;
BOOL ret = True;
TALLOC_CTX *mem_ctx;
if (!torture_open_connection(&cli, 0)) {
return False;
}
+ if (!torture_open_connection(&cli2, 0)) {
+ return False;
+ }
mem_ctx = talloc_init("torture_raw_notify");
@@ -1163,7 +1173,7 @@ BOOL torture_raw_notify(struct torture_context *torture)
return False;
}
- ret &= test_notify_dir(cli, mem_ctx);
+ ret &= test_notify_dir(cli, cli2, mem_ctx);
ret &= test_notify_mask(cli, mem_ctx);
ret &= test_notify_recursive(cli, mem_ctx);
ret &= test_notify_file(cli, mem_ctx);
@@ -1177,6 +1187,7 @@ BOOL torture_raw_notify(struct torture_context *torture)
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
torture_close_connection(cli);
+ torture_close_connection(cli2);
talloc_free(mem_ctx);
return ret;
}