summaryrefslogtreecommitdiff
path: root/source4/torture/raw
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-02-02 17:30:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:44:31 -0500
commitfe5aad78b0724ad5d51ce94aeb4b75aa40d7a7f7 (patch)
tree23c5d15641f7adc71a9969f9f50034fa375450e1 /source4/torture/raw
parent9df5d5e31fb962f2350459a5b0bddc94d6fab8d0 (diff)
downloadsamba-fe5aad78b0724ad5d51ce94aeb4b75aa40d7a7f7.tar.gz
samba-fe5aad78b0724ad5d51ce94aeb4b75aa40d7a7f7.tar.bz2
samba-fe5aad78b0724ad5d51ce94aeb4b75aa40d7a7f7.zip
r21125: Tridge, please check this closely if this relaxed notify test is
acceptable. In Samba3 with inotify we have the problem that the MODIFIED action is sent second. I think this could also happen in Samba4, depending on the order when the different sockets (unix domain dgram / inotify) are looked at by the events system. This patch accepts the NEW/OLD/MODIFIED entries in any order. Comments welcome! Volker (This used to be commit 72a7771b757c3aca637eb632abebab60bdd2da9f)
Diffstat (limited to 'source4/torture/raw')
-rw-r--r--source4/torture/raw/notify.c76
1 files changed, 55 insertions, 21 deletions
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 7e1f601638..e59c97c263 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -252,6 +252,39 @@ done:
return ret;
}
+/*
+ * Check notify reply for a rename action. Not sure if this is a valid thing
+ * to do, but depending on timing between inotify and messaging we get the
+ * add/remove/modify in any order. This routines tries to find the action/name
+ * pair in any of the three following notify_changes.
+ */
+
+static BOOL check_rename_reply(struct smbcli_state *cli,
+ int line,
+ struct notify_changes *actions,
+ uint32_t action, const char *name)
+{
+ int i;
+
+ for (i=0; i<3; i++) {
+ if (actions[i].action == action) {
+ if ((actions[i].name.s == NULL)
+ || (strcmp(actions[i].name.s, name) != 0)
+ || (wire_bad_flags(&actions[i].name, STR_UNICODE,
+ cli))) {
+ printf("(%d) name [%s] != %s\n", line,
+ actions[i].name.s, name);
+ return False;
+ }
+ return True;
+ }
+ }
+
+ printf("(%d) expected action %d, not found\n", line, action);
+ return False;
+}
+
+
/*
testing of recursive change notify
@@ -344,29 +377,30 @@ static BOOL test_notify_recursive(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
CHECK_VAL(notify.nttrans.out.changes[4].action, NOTIFY_ACTION_NEW_NAME);
CHECK_WSTR(notify.nttrans.out.changes[4].name, "subdir-name\\subname1-r", STR_UNICODE);
- /* the remove/add between directories is acceptable in either order */
- if (notify.nttrans.out.changes[5].action == NOTIFY_ACTION_ADDED) {
- CHECK_VAL(notify.nttrans.out.changes[6].action, NOTIFY_ACTION_REMOVED);
- CHECK_WSTR(notify.nttrans.out.changes[6].name, "subdir-name\\subname2", STR_UNICODE);
- CHECK_VAL(notify.nttrans.out.changes[5].action, NOTIFY_ACTION_ADDED);
- CHECK_WSTR(notify.nttrans.out.changes[5].name, "subname2-r", STR_UNICODE);
- } else {
- CHECK_VAL(notify.nttrans.out.changes[5].action, NOTIFY_ACTION_REMOVED);
- CHECK_WSTR(notify.nttrans.out.changes[5].name, "subdir-name\\subname2", STR_UNICODE);
- CHECK_VAL(notify.nttrans.out.changes[6].action, NOTIFY_ACTION_ADDED);
- CHECK_WSTR(notify.nttrans.out.changes[6].name, "subname2-r", STR_UNICODE);
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[5],
+ NOTIFY_ACTION_ADDED, "subname2-r");
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[5],
+ NOTIFY_ACTION_REMOVED, "subdir-name\\subname2");
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[5],
+ NOTIFY_ACTION_MODIFIED, "subname2-r");
+
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[8],
+ NOTIFY_ACTION_OLD_NAME, "subname2-r");
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[8],
+ NOTIFY_ACTION_NEW_NAME, "subname3-r");
+ ret &= check_rename_reply(
+ cli, __LINE__, &notify.nttrans.out.changes[8],
+ NOTIFY_ACTION_MODIFIED, "subname3-r");
+
+ if (!ret) {
+ goto done;
}
- CHECK_VAL(notify.nttrans.out.changes[7].action, NOTIFY_ACTION_MODIFIED);
- CHECK_WSTR(notify.nttrans.out.changes[7].name, "subname2-r", STR_UNICODE);
-
- CHECK_VAL(notify.nttrans.out.changes[8].action, NOTIFY_ACTION_OLD_NAME);
- CHECK_WSTR(notify.nttrans.out.changes[8].name, "subname2-r", STR_UNICODE);
- CHECK_VAL(notify.nttrans.out.changes[9].action, NOTIFY_ACTION_NEW_NAME);
- CHECK_WSTR(notify.nttrans.out.changes[9].name, "subname3-r", STR_UNICODE);
- CHECK_VAL(notify.nttrans.out.changes[10].action, NOTIFY_ACTION_MODIFIED);
- CHECK_WSTR(notify.nttrans.out.changes[10].name, "subname3-r", STR_UNICODE);
-
status = smb_raw_changenotify_recv(req2, mem_ctx, &notify);
CHECK_STATUS(status, NT_STATUS_OK);