svn commit: samba r14444 - in
branches/SAMBA_4_0/source/torture/raw: .
metze at samba.org
metze at samba.org
Wed Mar 15 13:02:37 GMT 2006
Author: metze
Date: 2006-03-15 13:02:37 +0000 (Wed, 15 Mar 2006)
New Revision: 14444
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14444
Log:
- make clear that a canceled notify directly returns without any other event
- test mkdir - rmdir - mkdir - rmdir sequence, this gets 4 notify events back
- add some comments to the multiple directory handle and buffered cases
metze
Modified:
branches/SAMBA_4_0/source/torture/raw/notify.c
Changeset:
Modified: branches/SAMBA_4_0/source/torture/raw/notify.c
===================================================================
--- branches/SAMBA_4_0/source/torture/raw/notify.c 2006-03-15 12:23:09 UTC (rev 14443)
+++ branches/SAMBA_4_0/source/torture/raw/notify.c 2006-03-15 13:02:37 UTC (rev 14444)
@@ -106,6 +106,13 @@
notify.notify.in.file.fnum = fnum;
notify.notify.in.recursive = True;
+ printf("testing notify cancel\n");
+
+ req = smb_raw_changenotify_send(cli->tree, ¬ify);
+ smb_raw_ntcancel(req);
+ status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
+ CHECK_STATUS(status, NT_STATUS_CANCELLED);
+
printf("testing notify mkdir\n");
req = smb_raw_changenotify_send(cli->tree, ¬ify);
@@ -129,13 +136,24 @@
CHECK_VAL(notify.notify.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WSTR(notify.notify.out.changes[0].name, "subdir-name", STR_UNICODE);
- printf("testing notify cancel\n");
+ 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");
req = smb_raw_changenotify_send(cli->tree, ¬ify);
- smb_raw_ntcancel(req);
- smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
- CHECK_STATUS(status, NT_STATUS_CANCELLED);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(notify.notify.out.num_changes, 4);
+ CHECK_VAL(notify.notify.out.changes[0].action, NOTIFY_ACTION_ADDED);
+ CHECK_WSTR(notify.notify.out.changes[0].name, "subdir-name", STR_UNICODE);
+ CHECK_VAL(notify.notify.out.changes[1].action, NOTIFY_ACTION_REMOVED);
+ CHECK_WSTR(notify.notify.out.changes[1].name, "subdir-name", STR_UNICODE);
+ CHECK_VAL(notify.notify.out.changes[2].action, NOTIFY_ACTION_ADDED);
+ CHECK_WSTR(notify.notify.out.changes[2].name, "subdir-name", STR_UNICODE);
+ CHECK_VAL(notify.notify.out.changes[3].action, NOTIFY_ACTION_REMOVED);
+ CHECK_WSTR(notify.notify.out.changes[3].name, "subdir-name", STR_UNICODE);
count = torture_numops;
printf("testing buffered notify on create of %d files\n", count);
@@ -152,16 +170,20 @@
smbcli_close(cli->tree, fnum3);
}
- /* setup a new notify on a different directory handle. This
- new notify won't see the events above. */
+ /* (1st notify) setup a new notify on a different directory handle.
+ This new notify won't see the events above. */
notify.notify.in.file.fnum = fnum2;
req2 = smb_raw_changenotify_send(cli->tree, ¬ify);
- /* whereas this notify will see the above buffered events as
- well */
+ /* (2nd notify) whereas this notify will see the above buffered events,
+ and it directly returns the buffered events */
notify.notify.in.file.fnum = fnum;
req = smb_raw_changenotify_send(cli->tree, ¬ify);
+ /* (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");
CHECK_STATUS(status, NT_STATUS_OK);
@@ -169,31 +191,36 @@
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
CHECK_STATUS(status, NT_STATUS_OK);
- CHECK_VAL(notify.notify.out.num_changes, count+1);
- for (i=0;i<notify.notify.out.num_changes;i++) {
+ CHECK_VAL(notify.notify.out.num_changes, count);
+ for (i=1;i<notify.notify.out.num_changes;i++) {
CHECK_VAL(notify.notify.out.changes[i].action, NOTIFY_ACTION_ADDED);
}
- CHECK_WSTR(notify.notify.out.changes[0].name, "subdir-name", STR_UNICODE);
+ CHECK_WSTR(notify.notify.out.changes[0].name, "test0.txt", STR_UNICODE);
/* and now from the 1st notify */
status = smb_raw_changenotify_recv(req2, mem_ctx, ¬ify);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VAL(notify.notify.out.num_changes, 1);
+ CHECK_VAL(notify.notify.out.changes[0].action, NOTIFY_ACTION_REMOVED);
+ CHECK_WSTR(notify.notify.out.changes[0].name, "test0.txt", STR_UNICODE);
- printf("testing notify on wildcard unlink for %d files\n", count);
+ /* (3rd notify) this notify will only see the 1st unlink */
+ req = smb_raw_changenotify_send(cli->tree, ¬ify);
- req = smb_raw_changenotify_send(cli->tree, ¬ify);
+ 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");
CHECK_STATUS(status, NT_STATUS_OK);
+ /* recev the 3rd notify */
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
CHECK_STATUS(status, NT_STATUS_OK);
-
CHECK_VAL(notify.notify.out.num_changes, 1);
CHECK_VAL(notify.notify.out.changes[0].action, NOTIFY_ACTION_REMOVED);
CHECK_WSTR(notify.notify.out.changes[0].name, "test0.txt", STR_UNICODE);
- /* and we now see the rest of the unlink calls */
+ /* and we now see the rest of the unlink calls on both directory handles */
+ notify.notify.in.file.fnum = fnum;
req = smb_raw_changenotify_send(cli->tree, ¬ify);
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
CHECK_STATUS(status, NT_STATUS_OK);
@@ -201,7 +228,6 @@
for (i=0;i<notify.notify.out.num_changes;i++) {
CHECK_VAL(notify.notify.out.changes[i].action, NOTIFY_ACTION_REMOVED);
}
-
notify.notify.in.file.fnum = fnum2;
req = smb_raw_changenotify_send(cli->tree, ¬ify);
status = smb_raw_changenotify_recv(req, mem_ctx, ¬ify);
More information about the samba-cvs
mailing list