s4:torture/raw: test_notify_tcp_dis trigger idle event every 0.25s
[vlendec/samba-autobuild/.git] / source4 / torture / raw / notify.c
index 7b2eded823c15b2edd34e796d044926a82c1b248..fa32c6b5e21886c0c062a0ca7db4701affc06d67 100644 (file)
@@ -24,6 +24,7 @@
 #include "system/filesys.h"
 #include "torture/util.h"
 #include "torture/raw/proto.h"
+#include "lib/events/events.h"
 
 #define BASEDIR "\\test_notify"
 
@@ -35,6 +36,8 @@ do { \
                       "wire_bad_flags"); \
 } while (0)
 
+#define BASEDIR_CN1_DIR BASEDIR "_CN1_DIR"
+
 /* 
    basic testing of change notify on directories
 */
@@ -51,10 +54,10 @@ static bool test_notify_dir(struct torture_context *tctx,
        struct smbcli_request *req, *req2;
        extern int torture_numops;
 
-       printf("TESTING CHANGE NOTIFY ON DIRECTORIES\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY ON DIRECTORIES\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_DIR),
+                      "Failed to setup up test directory: " BASEDIR_CN1_DIR);
 
        /*
          get a handle on the directory
@@ -70,7 +73,7 @@ static bool test_notify_dir(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_DIR;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -90,7 +93,7 @@ static bool test_notify_dir(struct torture_context *tctx,
        notify.nttrans.in.file.fnum = fnum;
        notify.nttrans.in.recursive = true;
 
-       printf("Testing notify cancel\n");
+       torture_comment(tctx, "Testing notify cancel\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
        smb_raw_ntcancel(req);
@@ -99,10 +102,10 @@ static bool test_notify_dir(struct torture_context *tctx,
                                           ret, done,
                                           "smb_raw_changenotify_recv");
 
-       printf("Testing notify mkdir\n");
+       torture_comment(tctx, "Testing notify mkdir\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -117,10 +120,10 @@ static bool test_notify_dir(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("Testing notify rmdir\n");
+       torture_comment(tctx, "Testing notify rmdir\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
+       smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -134,12 +137,12 @@ static bool test_notify_dir(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("Testing notify mkdir - rmdir - mkdir - rmdir\n");
+       torture_comment(tctx, "Testing notify mkdir - rmdir - mkdir - rmdir\n");
 
-       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");
+       smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
+       smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
+       smbcli_mkdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
+       smbcli_rmdir(cli2->tree, BASEDIR_CN1_DIR "\\subdir-name");
        smb_msleep(200);
        req = smb_raw_changenotify_send(cli->tree, &notify);
        status = smb_raw_changenotify_recv(req, tctx, &notify);
@@ -173,9 +176,11 @@ static bool test_notify_dir(struct torture_context *tctx,
                   STR_UNICODE);
 
        count = torture_numops;
-       printf("Testing buffered notify on create of %d files\n", count);
+       torture_comment(tctx, "Testing buffered notify on create of %d files\n", count);
        for (i=0;i<count;i++) {
-               char *fname = talloc_asprintf(cli, BASEDIR "\\test%d.txt", i);
+               char *fname = talloc_asprintf(cli,
+                               BASEDIR_CN1_DIR "\\test%d.txt",
+                               i);
                int fnum3 = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
                torture_assert_int_not_equal_goto(tctx, fnum3, -1, ret, done,
                        talloc_asprintf(tctx, "Failed to create %s - %s",
@@ -194,7 +199,7 @@ static bool test_notify_dir(struct torture_context *tctx,
        notify.nttrans.in.file.fnum = fnum;
        req = smb_raw_changenotify_send(cli->tree, &notify);
 
-       status = smbcli_unlink(cli->tree, BASEDIR "\\nonexistent.txt");
+       status = smbcli_unlink(cli->tree, BASEDIR_CN1_DIR "\\nonexistent.txt");
        torture_assert_ntstatus_equal_goto(tctx, status,
                                           NT_STATUS_OBJECT_NAME_NOT_FOUND,
                                           ret, done,
@@ -203,8 +208,8 @@ static bool test_notify_dir(struct torture_context *tctx,
        /* (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(cli2->tree, BASEDIR "\\test0.txt");
+       torture_comment(tctx, "Testing notify on unlink for the first file\n");
+       status = smbcli_unlink(cli2->tree, BASEDIR_CN1_DIR "\\test0.txt");
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "smbcli_unlink");
 
@@ -225,7 +230,7 @@ static bool test_notify_dir(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "test0.txt",
                   STR_UNICODE);
 
-       printf("and now from the 1st notify\n");
+       torture_comment(tctx, "and now from the 1st notify\n");
        status = smb_raw_changenotify_recv(req2, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "smb_raw_changenotify_recv");
@@ -238,18 +243,18 @@ static bool test_notify_dir(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "test0.txt",
                   STR_UNICODE);
 
-       printf("(3rd notify) this notify will only see the 1st unlink\n");
+       torture_comment(tctx, "(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 "\\nonexistent.txt");
+       status = smbcli_unlink(cli->tree, BASEDIR_CN1_DIR "\\nonexistent.txt");
        torture_assert_ntstatus_equal_goto(tctx, status,
                                           NT_STATUS_OBJECT_NAME_NOT_FOUND,
                                           ret, done,
                                           "smbcli_unlink");
 
-       printf("Testing notify on wildcard unlink for %d files\n", count-1);
+       torture_comment(tctx, "Testing notify on wildcard unlink for %d files\n", count-1);
        /* (2nd unlink) do a wildcard unlink */
-       status = smbcli_unlink(cli2->tree, BASEDIR "\\test*.txt");
+       status = smbcli_unlink(cli2->tree, BASEDIR_CN1_DIR "\\test*.txt");
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "smb_raw_changenotify_recv");
 
@@ -297,7 +302,7 @@ static bool test_notify_dir(struct torture_context *tctx,
                                        "wrong action (exp: REMOVED)");
        }
 
-       printf("Testing if a close() on the dir handle triggers the notify reply\n");
+       torture_comment(tctx, "Testing if a close() on the dir handle triggers the notify reply\n");
 
        notify.nttrans.in.file.fnum = fnum;
        req = smb_raw_changenotify_send(cli->tree, &notify);
@@ -317,7 +322,7 @@ static bool test_notify_dir(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_DIR);
        return ret;
 }
 
@@ -352,6 +357,9 @@ static bool check_rename_reply(struct torture_context *tctx,
 /* 
    testing of recursive change notify
 */
+
+#define BASEDIR_CN1_RECUR BASEDIR "_CN1_RECUR"
+
 static bool test_notify_recursive(struct torture_context *tctx,
                                  struct smbcli_state *cli,
                                  struct smbcli_state *cli2)
@@ -363,10 +371,10 @@ static bool test_notify_recursive(struct torture_context *tctx,
        int fnum;
        struct smbcli_request *req1, *req2;
 
-       printf("TESTING CHANGE NOTIFY WITH RECURSION\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY WITH RECURSION\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_RECUR),
+                      "Failed to setup up test directory: " BASEDIR_CN1_RECUR);
 
        /*
          get a handle on the directory
@@ -382,7 +390,7 @@ static bool test_notify_recursive(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_RECUR;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -421,25 +429,30 @@ static bool test_notify_recursive(struct torture_context *tctx,
         * Make notifies a bit more interesting in a cluster by doing
         * the changes against different nodes with --unclist
         */
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
-       smbcli_mkdir(cli2->tree, BASEDIR "\\subdir-name\\subname1");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_RECUR "\\subdir-name");
+       smbcli_mkdir(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1");
        smbcli_close(cli->tree, 
-                    smbcli_open(cli->tree, BASEDIR "\\subdir-name\\subname2", O_CREAT, 0));
-       smbcli_rename(cli2->tree, BASEDIR "\\subdir-name\\subname1",
-                     BASEDIR "\\subdir-name\\subname1-r");
-       smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname2", BASEDIR "\\subname2-r");
-       smbcli_rename(cli2->tree, BASEDIR "\\subname2-r",
-                     BASEDIR "\\subname3-r");
+                    smbcli_open(cli->tree,
+                               BASEDIR_CN1_RECUR "\\subdir-name\\subname2",
+                               O_CREAT, 0));
+       smbcli_rename(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1",
+                     BASEDIR_CN1_RECUR "\\subdir-name\\subname1-r");
+       smbcli_rename(cli->tree,
+               BASEDIR_CN1_RECUR "\\subdir-name\\subname2",
+               BASEDIR_CN1_RECUR "\\subname2-r");
+       smbcli_rename(cli2->tree, BASEDIR_CN1_RECUR "\\subname2-r",
+                     BASEDIR_CN1_RECUR "\\subname3-r");
 
        notify.nttrans.in.completion_filter = 0;
        notify.nttrans.in.recursive = true;
        smb_msleep(200);
        req1 = smb_raw_changenotify_send(cli->tree, &notify);
 
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name\\subname1-r");
-       smbcli_rmdir(cli2->tree, BASEDIR "\\subdir-name");
-       smbcli_unlink(cli->tree, BASEDIR "\\subname3-r");
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_RECUR "\\subdir-name\\subname1-r");
+       smbcli_rmdir(cli2->tree, BASEDIR_CN1_RECUR "\\subdir-name");
+       smbcli_unlink(cli->tree, BASEDIR_CN1_RECUR "\\subname3-r");
 
+       smb_msleep(200);
        notify.nttrans.in.recursive = false;
        req2 = smb_raw_changenotify_send(cli->tree, &notify);
 
@@ -531,13 +544,16 @@ static bool test_notify_recursive(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_RECUR);
        return ret;
 }
 
 /* 
    testing of change notify mask change
 */
+
+#define BASEDIR_CN1_CNMC BASEDIR "_CN1_CNMC"
+
 static bool test_notify_mask_change(struct torture_context *tctx,
                                    struct smbcli_state *cli)
 {
@@ -548,10 +564,10 @@ static bool test_notify_mask_change(struct torture_context *tctx,
        int fnum;
        struct smbcli_request *req1, *req2;
 
-       printf("TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_CNMC),
+                      "Failed to setup up test directory: " BASEDIR_CN1_CNMC);
 
        /*
          get a handle on the directory
@@ -567,7 +583,7 @@ static bool test_notify_mask_change(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_CNMC;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -606,9 +622,11 @@ static bool test_notify_mask_change(struct torture_context *tctx,
        req1 = smb_raw_changenotify_send(cli->tree, &notify);
 
        /* Set to hidden then back again. */
-       smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));
-       smbcli_setatr(cli->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);
-       smbcli_unlink(cli->tree, BASEDIR "\\tname1");
+       smbcli_close(cli->tree,
+               smbcli_open(cli->tree,BASEDIR_CN1_CNMC "\\tname1", O_CREAT, 0));
+       smbcli_setatr(cli->tree, BASEDIR_CN1_CNMC "\\tname1",
+               FILE_ATTRIBUTE_HIDDEN, 0);
+       smbcli_unlink(cli->tree, BASEDIR_CN1_CNMC "\\tname1");
 
        status = smb_raw_changenotify_recv(req1, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -634,17 +652,25 @@ static bool test_notify_mask_change(struct torture_context *tctx,
        notify.nttrans.in.recursive = false;
        req2 = smb_raw_changenotify_send(cli->tree, &notify);
 
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name\\subname1");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name\\subname1");
        smbcli_close(cli->tree, 
-                    smbcli_open(cli->tree, BASEDIR "\\subdir-name\\subname2", O_CREAT, 0));
-       smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname1", BASEDIR "\\subdir-name\\subname1-r");
-       smbcli_rename(cli->tree, BASEDIR "\\subdir-name\\subname2", BASEDIR "\\subname2-r");
-       smbcli_rename(cli->tree, BASEDIR "\\subname2-r", BASEDIR "\\subname3-r");
-
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name\\subname1-r");
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
-       smbcli_unlink(cli->tree, BASEDIR "\\subname3-r");
+                    smbcli_open(cli->tree,
+                       BASEDIR_CN1_CNMC "\\subdir-name\\subname2",
+                       O_CREAT, 0));
+       smbcli_rename(cli->tree,
+                       BASEDIR_CN1_CNMC "\\subdir-name\\subname1",
+                       BASEDIR_CN1_CNMC "\\subdir-name\\subname1-r");
+       smbcli_rename(cli->tree,
+                       BASEDIR_CN1_CNMC "\\subdir-name\\subname2",
+                       BASEDIR_CN1_CNMC "\\subname2-r");
+       smbcli_rename(cli->tree,
+                       BASEDIR_CN1_CNMC "\\subname2-r",
+                       BASEDIR_CN1_CNMC "\\subname3-r");
+
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name\\subname1-r");
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_CNMC "\\subdir-name");
+       smbcli_unlink(cli->tree, BASEDIR_CN1_CNMC "\\subname3-r");
 
        status = smb_raw_changenotify_recv(req1, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -674,7 +700,7 @@ static bool test_notify_mask_change(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_CNMC);
        return ret;
 }
 
@@ -682,6 +708,9 @@ done:
 /* 
    testing of mask bits for change notify
 */
+
+#define BASEDIR_CN1_NOTM BASEDIR "_CN1_NOTM"
+
 static bool test_notify_mask(struct torture_context *tctx,
                             struct smbcli_state *cli,
                             struct smbcli_state *cli2)
@@ -698,10 +727,10 @@ static bool test_notify_mask(struct torture_context *tctx,
        struct timeval tv;
        NTTIME t;
 
-       printf("TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NOTM),
+                      "Failed to setup up test directory: " BASEDIR_CN1_NOTM);
 
        tv = timeval_current_ofs(1000, 0);
        t = timeval_to_nttime(&tv);
@@ -720,7 +749,7 @@ static bool test_notify_mask(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_NOTM;
 
        notify.nttrans.level = RAW_NOTIFY_NTTRANS;
        notify.nttrans.in.buffer_size = 1000;
@@ -755,7 +784,7 @@ static bool test_notify_mask(struct torture_context *tctx,
                    notify.nttrans.out.changes[0].action == NOTIFY_ACTION_MODIFIED && \
                    ((expected) & FILE_NOTIFY_CHANGE_ATTRIBUTES) && \
                    Action == NOTIFY_ACTION_OLD_NAME) { \
-                       printf("(rename file special handling OK)\n"); \
+                       torture_comment(tctx, "(rename file special handling OK)\n"); \
                } else { \
                        torture_assert_int_equal_goto(tctx, \
                                notify.nttrans.out.num_changes,\
@@ -793,147 +822,184 @@ static bool test_notify_mask(struct torture_context *tctx,
        if ((expected) != mask) { \
                torture_assert_int_not_equal_goto(tctx, ((expected) & ~mask), \
                                0, ret, done, "Too few bits"); \
-               printf("WARNING: trigger on too many bits. mask=0x%08x expected=0x%08x\n", \
+               torture_comment(tctx, "WARNING: trigger on too many bits. mask=0x%08x expected=0x%08x\n", \
                       mask, expected); \
        } \
        } while (0);
 
-       printf("Testing mkdir\n");
+       torture_comment(tctx, "Testing mkdir\n");
        NOTIFY_MASK_TEST("Testing mkdir",;,
-                        smbcli_mkdir(cli->tree, BASEDIR "\\tname1");,
-                        smbcli_rmdir(cli2->tree, BASEDIR "\\tname1");,
+                        smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");,
+                        smbcli_rmdir(cli2->tree, BASEDIR_CN1_NOTM "\\tname1");,
                         NOTIFY_ACTION_ADDED,
                         FILE_NOTIFY_CHANGE_DIR_NAME, 1);
 
-       printf("Testing create file\n");
+       torture_comment(tctx, "Testing create file\n");
        NOTIFY_MASK_TEST("Testing create file",;,
-                        smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));,
-                        smbcli_unlink(cli2->tree, BASEDIR "\\tname1");,
+                        smbcli_close(cli->tree,
+                               smbcli_open(cli->tree,
+                                       BASEDIR_CN1_NOTM "\\tname1",
+                                       O_CREAT, 0));,
+                        smbcli_unlink(cli2->tree,
+                               BASEDIR_CN1_NOTM "\\tname1");,
                         NOTIFY_ACTION_ADDED,
                         FILE_NOTIFY_CHANGE_FILE_NAME, 1);
 
-       printf("Testing unlink\n");
+       torture_comment(tctx, "Testing unlink\n");
        NOTIFY_MASK_TEST("Testing unlink",
-                        smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));,
-                        smbcli_unlink(cli2->tree, BASEDIR "\\tname1");,
+                        smbcli_close(cli->tree,
+                               smbcli_open(cli->tree,
+                                       BASEDIR_CN1_NOTM "\\tname1",
+                                       O_CREAT, 0));,
+                        smbcli_unlink(cli2->tree,
+                               BASEDIR_CN1_NOTM "\\tname1");,
                         ;,
                         NOTIFY_ACTION_REMOVED,
                         FILE_NOTIFY_CHANGE_FILE_NAME, 1);
 
-       printf("Testing rmdir\n");
+       torture_comment(tctx, "Testing rmdir\n");
        NOTIFY_MASK_TEST("Testing rmdir",
-                        smbcli_mkdir(cli->tree, BASEDIR "\\tname1");,
-                        smbcli_rmdir(cli2->tree, BASEDIR "\\tname1");,
+                        smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");,
+                        smbcli_rmdir(cli2->tree, BASEDIR_CN1_NOTM "\\tname1");,
                         ;,
                         NOTIFY_ACTION_REMOVED,
                         FILE_NOTIFY_CHANGE_DIR_NAME, 1);
 
-       printf("Testing rename file\n");
+       torture_comment(tctx, "Testing rename file\n");
        NOTIFY_MASK_TEST("Testing rename file",
-                        smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));,
-                        smbcli_rename(cli2->tree, BASEDIR "\\tname1", BASEDIR "\\tname2");,
-                        smbcli_unlink(cli->tree, BASEDIR "\\tname2");,
+                        smbcli_close(cli->tree,
+                               smbcli_open(cli->tree,
+                                       BASEDIR_CN1_NOTM "\\tname1",
+                                       O_CREAT, 0));,
+                        smbcli_rename(cli2->tree,
+                               BASEDIR_CN1_NOTM "\\tname1",
+                               BASEDIR_CN1_NOTM "\\tname2");,
+                        smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname2");,
                         NOTIFY_ACTION_OLD_NAME,
                         FILE_NOTIFY_CHANGE_FILE_NAME|FILE_NOTIFY_CHANGE_ATTRIBUTES|FILE_NOTIFY_CHANGE_CREATION, 2);
 
-       printf("Testing rename dir\n");
+       torture_comment(tctx, "Testing rename dir\n");
        NOTIFY_MASK_TEST("Testing rename dir",
-               smbcli_mkdir(cli->tree, BASEDIR "\\tname1");,
-               smbcli_rename(cli2->tree, BASEDIR "\\tname1", BASEDIR "\\tname2");,
-               smbcli_rmdir(cli->tree, BASEDIR "\\tname2");,
+               smbcli_mkdir(cli->tree, BASEDIR_CN1_NOTM "\\tname1");,
+               smbcli_rename(cli2->tree,
+                       BASEDIR_CN1_NOTM "\\tname1",
+                       BASEDIR_CN1_NOTM "\\tname2");,
+               smbcli_rmdir(cli->tree, BASEDIR_CN1_NOTM "\\tname2");,
                NOTIFY_ACTION_OLD_NAME,
                FILE_NOTIFY_CHANGE_DIR_NAME, 2);
 
-       printf("Testing set path attribute\n");
+       torture_comment(tctx, "Testing set path attribute\n");
        NOTIFY_MASK_TEST("Testing set path attribute",
-               smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));,
-               smbcli_setatr(cli2->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);,
-               smbcli_unlink(cli->tree, BASEDIR "\\tname1");,
+               smbcli_close(cli->tree,
+                       smbcli_open(cli->tree,
+                               BASEDIR_CN1_NOTM "\\tname1", O_CREAT, 0));,
+               smbcli_setatr(cli2->tree,
+                       BASEDIR_CN1_NOTM "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);,
+               smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1");,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
 
-       printf("Testing set path write time\n");
+       torture_comment(tctx, "Testing set path write time\n");
        NOTIFY_MASK_TEST("Testing set path write time",
-               smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1", O_CREAT, 0));,
-               smbcli_setatr(cli2->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_NORMAL, 1000);,
-               smbcli_unlink(cli->tree, BASEDIR "\\tname1");,
+               smbcli_close(cli->tree, smbcli_open(cli->tree,
+                       BASEDIR_CN1_NOTM "\\tname1", O_CREAT, 0));,
+               smbcli_setatr(cli2->tree,
+                       BASEDIR_CN1_NOTM "\\tname1",
+                       FILE_ATTRIBUTE_NORMAL, 1000);,
+               smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1");,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_LAST_WRITE, 1);
 
-       printf("Testing set file attribute\n");
+       torture_comment(tctx, "Testing set file attribute\n");
        NOTIFY_MASK_TEST("Testing set file attribute",
-               fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli2, tctx,
+                       BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_fsetatr(cli2->tree, fnum2, FILE_ATTRIBUTE_HIDDEN, 0, 0, 0, 0);,
-               (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli2->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli2->tree, fnum2),
+               smbcli_unlink(cli2->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
 
        if (torture_setting_bool(tctx, "samba3", false)) {
-               printf("Samba3 does not yet support create times "
+               torture_comment(tctx, "Samba3 does not yet support create times "
                       "everywhere\n");
        }
        else {
-               printf("Testing set file create time\n");
+               torture_comment(tctx, "Testing set file create time\n");
                NOTIFY_MASK_TEST("Testing set file create time",
                        fnum2 = create_complex_file(cli, tctx,
-                                                   BASEDIR "\\tname1");,
+                                           BASEDIR_CN1_NOTM "\\tname1");,
                        smbcli_fsetatr(cli->tree, fnum2, 0, t, 0, 0, 0);,
                        (smbcli_close(cli->tree, fnum2),
-                        smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
+                        smbcli_unlink(cli->tree,
+                                       BASEDIR_CN1_NOTM "\\tname1"));,
                        NOTIFY_ACTION_MODIFIED,
                        FILE_NOTIFY_CHANGE_CREATION, 1);
        }
 
-       printf("Testing set file access time\n");
+       torture_comment(tctx, "Testing set file access time\n");
        NOTIFY_MASK_TEST("Testing set file access time",
-               fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli, tctx,
+                               BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_fsetatr(cli->tree, fnum2, 0, 0, t, 0, 0);,
-               (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli->tree, fnum2),
+                       smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_LAST_ACCESS, 1);
 
-       printf("Testing set file write time\n");
+       torture_comment(tctx, "Testing set file write time\n");
        NOTIFY_MASK_TEST("Testing set file write time",
-               fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli, tctx,
+                       BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, t, 0);,
-               (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli->tree, fnum2),
+               smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_LAST_WRITE, 1);
 
-       printf("Testing set file change time\n");
+       torture_comment(tctx, "Testing set file change time\n");
        NOTIFY_MASK_TEST("Testing set file change time",
-               fnum2 = create_complex_file(cli, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli, tctx,
+                       BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_fsetatr(cli->tree, fnum2, 0, 0, 0, 0, t);,
-               (smbcli_close(cli->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli->tree, fnum2),
+               smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                0, 1);
 
 
-       printf("Testing write\n");
+       torture_comment(tctx, "Testing write\n");
        NOTIFY_MASK_TEST("Testing write",
-               fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli2, tctx,
+                       BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_write(cli2->tree, fnum2, 1, &c, 10000, 1);,
-               (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli2->tree, fnum2),
+                       smbcli_unlink(cli->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                0, 1);
 
-       printf("Testing truncate\n");
+       torture_comment(tctx, "Testing truncate\n");
        NOTIFY_MASK_TEST("Testing truncate",
-               fnum2 = create_complex_file(cli2, tctx, BASEDIR "\\tname1");,
+               fnum2 = create_complex_file(cli2, tctx,
+                       BASEDIR_CN1_NOTM "\\tname1");,
                smbcli_ftruncate(cli2->tree, fnum2, 10000);,
-               (smbcli_close(cli2->tree, fnum2), smbcli_unlink(cli2->tree, BASEDIR "\\tname1"));,
+               (smbcli_close(cli2->tree, fnum2),
+               smbcli_unlink(cli2->tree, BASEDIR_CN1_NOTM "\\tname1"));,
                NOTIFY_ACTION_MODIFIED,
                FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_ATTRIBUTES, 1);
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_NOTM);
        return ret;
 }
 
 /*
   basic testing of change notify on files
 */
+
+#define BASEDIR_CN1_FILE BASEDIR "_CN1_FILE"
+
 static bool test_notify_file(struct torture_context *tctx,
                             struct smbcli_state *cli)
 {
@@ -944,12 +1010,12 @@ static bool test_notify_file(struct torture_context *tctx,
        union smb_notify notify;
        struct smbcli_request *req;
        int fnum;
-       const char *fname = BASEDIR "\\file.txt";
+       const char *fname = BASEDIR_CN1_FILE "\\file.txt";
 
-       printf("TESTING CHANGE NOTIFY ON FILES\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY ON FILES\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_FILE),
+                      "Failed to setup up test directory: " BASEDIR_CN1_FILE);
 
        io.generic.level = RAW_OPEN_NTCREATEX;
        io.ntcreatex.in.root_fid.fnum = 0;
@@ -976,7 +1042,7 @@ static bool test_notify_file(struct torture_context *tctx,
        notify.nttrans.in.completion_filter = FILE_NOTIFY_CHANGE_STREAM_NAME;
        notify.nttrans.in.recursive = false;
 
-       printf("Testing if notifies on file handles are invalid (should be)\n");
+       torture_comment(tctx, "Testing if notifies on file handles are invalid (should be)\n");
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
        status = smb_raw_changenotify_recv(req, tctx, &notify);
@@ -998,13 +1064,15 @@ static bool test_notify_file(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_FILE);
        return ret;
 }
 
 /*
   basic testing of change notifies followed by a tdis
 */
+#define BASEDIR_CN1_TDIS BASEDIR "_CN1_TDIS"
+
 static bool test_notify_tdis(struct torture_context *tctx,
                             struct smbcli_state *cli1)
 {
@@ -1016,10 +1084,10 @@ static bool test_notify_tdis(struct torture_context *tctx,
        struct smbcli_request *req;
        struct smbcli_state *cli = NULL;
 
-       printf("TESTING CHANGE NOTIFY FOLLOWED BY TDIS\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY TDIS\n");
 
-       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_TDIS),
+                      "Failed to setup up test directory: " BASEDIR_CN1_TDIS);
 
        torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
                       "Failed to open connection.");
@@ -1038,7 +1106,7 @@ static bool test_notify_tdis(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_TDIS;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1068,13 +1136,16 @@ static bool test_notify_tdis(struct torture_context *tctx,
 
 done:
        torture_close_connection(cli);
-       smbcli_deltree(cli1->tree, BASEDIR);
+       smbcli_deltree(cli1->tree, BASEDIR_CN1_TDIS);
        return ret;
 }
 
 /*
   basic testing of change notifies followed by a exit
 */
+
+#define BASEDIR_CN1_EX BASEDIR "_CN1_EX"
+
 static bool test_notify_exit(struct torture_context *tctx,
                             struct smbcli_state *cli1)
 {
@@ -1086,10 +1157,10 @@ static bool test_notify_exit(struct torture_context *tctx,
        struct smbcli_request *req;
        struct smbcli_state *cli = NULL;
 
-       printf("TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n");
 
-       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_EX),
+                      "Failed to setup up test directory: " BASEDIR_CN1_EX);
 
        torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
                       "Failed to open connection.");
@@ -1108,7 +1179,7 @@ static bool test_notify_exit(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_EX;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1137,13 +1208,16 @@ static bool test_notify_exit(struct torture_context *tctx,
 
 done:
        torture_close_connection(cli);
-       smbcli_deltree(cli1->tree, BASEDIR);
+       smbcli_deltree(cli1->tree, BASEDIR_CN1_EX);
        return ret;
 }
 
 /*
   basic testing of change notifies followed by a ulogoff
 */
+
+#define BASEDIR_CN1_UL BASEDIR "_CN1_UL"
+
 static bool test_notify_ulogoff(struct torture_context *tctx,
                                struct smbcli_state *cli1)
 {
@@ -1155,10 +1229,10 @@ static bool test_notify_ulogoff(struct torture_context *tctx,
        struct smbcli_request *req;
        struct smbcli_state *cli = NULL;
 
-       printf("TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
 
-       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_UL),
+                      "Failed to setup up test directory: " BASEDIR_CN1_UL);
 
        torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
                       "Failed to open connection.");
@@ -1177,7 +1251,7 @@ static bool test_notify_ulogoff(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_UL;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1206,7 +1280,7 @@ static bool test_notify_ulogoff(struct torture_context *tctx,
 
 done:
        torture_close_connection(cli);
-       smbcli_deltree(cli1->tree, BASEDIR);
+       smbcli_deltree(cli1->tree, BASEDIR_CN1_UL);
        return ret;
 }
 
@@ -1220,6 +1294,9 @@ static void tcp_dis_handler(struct smbcli_transport *t, void *p)
 /*
   basic testing of change notifies followed by tcp disconnect
 */
+
+#define BASEDIR_CN1_TCPDIS BASEDIR "_CN1_TCPDIS"
+
 static bool test_notify_tcp_dis(struct torture_context *tctx,
                                struct smbcli_state *cli1)
 {
@@ -1231,10 +1308,11 @@ static bool test_notify_tcp_dis(struct torture_context *tctx,
        struct smbcli_request *req;
        struct smbcli_state *cli = NULL;
 
-       printf("TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n");
 
-       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR_CN1_TCPDIS),
+                      "Failed to setup up test directory: "
+                       BASEDIR_CN1_TCPDIS);
 
        torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
                       "Failed to open connection.");
@@ -1253,7 +1331,7 @@ static bool test_notify_tcp_dis(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_TCPDIS;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1270,7 +1348,7 @@ static bool test_notify_tcp_dis(struct torture_context *tctx,
 
        req = smb_raw_changenotify_send(cli->tree, &notify);
 
-       smbcli_transport_idle_handler(cli->transport, tcp_dis_handler, 250, cli);
+       smbcli_transport_idle_handler(cli->transport, tcp_dis_handler, 250000, cli);
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_equal_goto(tctx, status,
@@ -1280,13 +1358,16 @@ static bool test_notify_tcp_dis(struct torture_context *tctx,
 
 done:
        torture_close_connection(cli);
-       smbcli_deltree(cli1->tree, BASEDIR);
+       smbcli_deltree(cli1->tree, BASEDIR_CN1_TCPDIS);
        return ret;
 }
 
 /* 
    test setting up two change notify requests on one handle
 */
+
+#define BASEDIR_CN1_DBL BASEDIR "_CN1_DBL"
+
 static bool test_notify_double(struct torture_context *tctx,
                               struct smbcli_state *cli)
 {
@@ -1297,10 +1378,10 @@ static bool test_notify_double(struct torture_context *tctx,
        int fnum;
        struct smbcli_request *req1, *req2;
 
-       printf("TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_DBL),
+                      "Failed to setup up test directory: " BASEDIR_CN1_DBL);
 
        /*
          get a handle on the directory
@@ -1316,7 +1397,7 @@ static bool test_notify_double(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_DBL;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1334,7 +1415,7 @@ static bool test_notify_double(struct torture_context *tctx,
        req1 = smb_raw_changenotify_send(cli->tree, &notify);
        req2 = smb_raw_changenotify_send(cli->tree, &notify);
 
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_DBL "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req1, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1344,7 +1425,7 @@ static bool test_notify_double(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name2");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_DBL "\\subdir-name2");
 
        status = smb_raw_changenotify_recv(req2, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1356,7 +1437,7 @@ static bool test_notify_double(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_DBL);
        return ret;
 }
 
@@ -1364,6 +1445,9 @@ done:
 /* 
    test multiple change notifies at different depths and with/without recursion
 */
+
+#define BASEDIR_CN1_TNT BASEDIR "_CN1_TNT"
+
 static bool test_notify_tree(struct torture_context *tctx,
                             struct smbcli_state *cli,
                             struct smbcli_state *cli2)
@@ -1381,35 +1465,135 @@ static bool test_notify_tree(struct torture_context *tctx,
                int fnum;
                int counted;
        } dirs[] = {
-               {BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 30 },
-               {BASEDIR "\\zqy",               true, FILE_NOTIFY_CHANGE_NAME, 8 },
-               {BASEDIR "\\atsy",              true, FILE_NOTIFY_CHANGE_NAME, 4 },
-               {BASEDIR "\\abc\\foo",          true,  FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\abc\\blah",         true,  FILE_NOTIFY_CHANGE_NAME, 13 },
-               {BASEDIR "\\abc\\blah",         false, FILE_NOTIFY_CHANGE_NAME, 7 },
-               {BASEDIR "\\abc\\blah\\a",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\abc\\blah\\b",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\abc\\blah\\c",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\abc\\fooblah",      true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\zqy\\xx",           true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\zqy\\yyy",          true, FILE_NOTIFY_CHANGE_NAME, 2 },
-               {BASEDIR "\\zqy\\..",           true, FILE_NOTIFY_CHANGE_NAME, 40 },
-               {BASEDIR,                       true, FILE_NOTIFY_CHANGE_NAME, 40 },
-               {BASEDIR,                       false,FILE_NOTIFY_CHANGE_NAME, 6 },
-               {BASEDIR "\\atsy",              false,FILE_NOTIFY_CHANGE_NAME, 4 },
-               {BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 24 },
-               {BASEDIR "\\abc",               false,FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
-               {BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_FILE_NAME, 0 },
-               {BASEDIR "\\abc",               true, FILE_NOTIFY_CHANGE_NAME, 24 },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 30,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\zqy",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 8,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\atsy",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 4,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\foo",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\blah",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 13,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\blah",
+                       .recursive = false,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 7,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\blah\\a",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\blah\\b",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\blah\\c",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc\\fooblah",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\zqy\\xx",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\zqy\\yyy",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 2,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\zqy\\..",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 40,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT,
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 40,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT,
+                       .recursive = false,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 6,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\atsy",
+                       .recursive = false,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 4,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 24,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc",
+                       .recursive = false,
+                       .filter    = FILE_NOTIFY_CHANGE_FILE_NAME,
+                       .expected  = 0,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_FILE_NAME,
+                       .expected  = 0,
+               },
+               {
+                       .path      = BASEDIR_CN1_TNT "\\abc",
+                       .recursive = true,
+                       .filter    = FILE_NOTIFY_CHANGE_NAME,
+                       .expected  = 24,
+               },
        };
        int i;
        NTSTATUS status;
        bool all_done = false;
 
-       printf("TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_TNT),
+                      "Failed to setup up test directory: " BASEDIR_CN1_TNT);
 
        io.generic.level = RAW_OPEN_NTCREATEX;
        io.ntcreatex.in.root_fid.fnum = 0;
@@ -1461,7 +1645,7 @@ static bool test_notify_tree(struct torture_context *tctx,
                talloc_free(path);
        }
 
-       /* give a bit of time for the events to propogate */
+       /* give a bit of time for the events to propagate */
        tv = timeval_current();
 
        do {
@@ -1484,7 +1668,7 @@ static bool test_notify_tree(struct torture_context *tctx,
                }
        } while (!all_done && timeval_elapsed(&tv) < 20);
 
-       printf("took %.4f seconds to propogate all events\n", timeval_elapsed(&tv));
+       torture_comment(tctx, "took %.4f seconds to propagate all events\n", timeval_elapsed(&tv));
 
        for (i=0;i<ARRAY_SIZE(dirs);i++) {
                torture_assert_int_equal_goto(tctx,
@@ -1504,7 +1688,7 @@ static bool test_notify_tree(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_TNT);
        return ret;
 }
 
@@ -1512,6 +1696,9 @@ done:
    Test response when cached server events exceed single NT NOTFIY response
    packet size.
 */
+
+#define BASEDIR_CN1_NO BASEDIR "_CN1_NO"
+
 static bool test_notify_overflow(struct torture_context *tctx,
                                 struct smbcli_state *cli)
 {
@@ -1524,10 +1711,10 @@ static bool test_notify_overflow(struct torture_context *tctx,
        struct smbcli_request *req1;
        int i;
 
-       printf("TESTING CHANGE NOTIFY EVENT OVERFLOW\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY EVENT OVERFLOW\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NO),
+                      "Failed to setup up test directory: " BASEDIR_CN1_NO);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1542,7 +1729,7 @@ static bool test_notify_overflow(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_NO;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1567,10 +1754,11 @@ static bool test_notify_overflow(struct torture_context *tctx,
                                           "smb_raw_changenotify_recv");
 
        /* open a lot of files, filling up the server side notify buffer */
-       printf("Testing overflowed buffer notify on create of %d files\n",
+       torture_comment(tctx, "Testing overflowed buffer notify on create of %d files\n",
               count);
        for (i=0;i<count;i++) {
-               char *fname = talloc_asprintf(cli, BASEDIR "\\test%d.txt", i);
+               char *fname = talloc_asprintf(cli,
+                               BASEDIR_CN1_NO "\\test%d.txt", i);
                int fnum2 = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR,
                                        DENY_NONE);
                torture_assert_int_not_equal_goto(tctx, fnum2, -1, ret, done,
@@ -1590,7 +1778,7 @@ static bool test_notify_overflow(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_NO);
        return ret;
 }
 
@@ -1598,6 +1786,9 @@ done:
    Test if notifications are returned for changes to the base directory.
    They shouldn't be.
 */
+
+#define BASEDIR_CN1_NBASE BASEDIR "_CN1_NBASE"
+
 static bool test_notify_basedir(struct torture_context *tctx,
                                struct smbcli_state *cli)
 {
@@ -1608,10 +1799,10 @@ static bool test_notify_basedir(struct torture_context *tctx,
        int fnum;
        struct smbcli_request *req1;
 
-       printf("TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
+       torture_comment(tctx, "TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NBASE),
+                      "Failed to setup up test directory: " BASEDIR_CN1_NBASE);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1626,7 +1817,7 @@ static bool test_notify_basedir(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_NBASE;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1634,7 +1825,8 @@ static bool test_notify_basedir(struct torture_context *tctx,
        fnum = io.ntcreatex.out.file.fnum;
 
        /* create a test file that will also be modified */
-       smbcli_close(cli->tree, smbcli_open(cli->tree, BASEDIR "\\tname1",
+       smbcli_close(cli->tree, smbcli_open(cli->tree,
+                               BASEDIR_CN1_NBASE "\\tname1",
                                            O_CREAT, 0));
 
        /* ask for a change notify, on attribute changes. */
@@ -1647,10 +1839,11 @@ static bool test_notify_basedir(struct torture_context *tctx,
        req1 = smb_raw_changenotify_send(cli->tree, &notify);
 
        /* set attribute on the base dir */
-       smbcli_setatr(cli->tree, BASEDIR, FILE_ATTRIBUTE_HIDDEN, 0);
+       smbcli_setatr(cli->tree, BASEDIR_CN1_NBASE, FILE_ATTRIBUTE_HIDDEN, 0);
 
        /* set attribute on a file to assure we receive a notification */
-       smbcli_setatr(cli->tree, BASEDIR "\\tname1", FILE_ATTRIBUTE_HIDDEN, 0);
+       smbcli_setatr(cli->tree, BASEDIR_CN1_NBASE "\\tname1",
+                       FILE_ATTRIBUTE_HIDDEN, 0);
        smb_msleep(200);
 
        /* check how many responses were given, expect only 1 for the file */
@@ -1668,7 +1861,7 @@ static bool test_notify_basedir(struct torture_context *tctx,
 
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_NBASE);
        return ret;
 }
 
@@ -1677,6 +1870,7 @@ done:
   create a secondary tree connect - used to test for a bug in Samba3 messaging
   with change notify
 */
+
 static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli, 
                                          struct torture_context *tctx)
 {
@@ -1688,7 +1882,7 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
        share = torture_setting_string(tctx, "share", NULL);
        host  = torture_setting_string(tctx, "host", NULL);
        
-       printf("create a second tree context on the same session\n");
+       torture_comment(tctx, "create a second tree context on the same session\n");
        tree = smbcli_tree_init(cli->session, tctx, false);
 
        tcon.generic.level = RAW_TCON_TCONX;
@@ -1699,12 +1893,12 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
        status = smb_raw_tcon(tree, tctx, &tcon);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(tree);
-               printf("Failed to create secondary tree\n");
+               torture_comment(tctx, "Failed to create secondary tree\n");
                return NULL;
        }
 
        tree->tid = tcon.tconx.out.tid;
-       printf("tid1=%d tid2=%d\n", cli->tree->tid, tree->tid);
+       torture_comment(tctx, "tid1=%d tid2=%d\n", cli->tree->tid, tree->tid);
 
        return tree;
 }
@@ -1713,6 +1907,9 @@ static struct smbcli_tree *secondary_tcon(struct smbcli_state *cli,
 /* 
    very simple change notify test
 */
+
+#define BASEDIR_CN1_NTCON BASEDIR "_CN1_NTCON"
+
 static bool test_notify_tcon(struct torture_context *tctx,
                             struct smbcli_state *cli)
 {
@@ -1725,10 +1922,10 @@ static bool test_notify_tcon(struct torture_context *tctx,
        extern int torture_numops;
        struct smbcli_tree *tree = NULL;
                
-       printf("TESTING SIMPLE CHANGE NOTIFY\n");
+       torture_comment(tctx, "TESTING SIMPLE CHANGE NOTIFY\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NTCON),
+                      "Failed to setup up test directory: " BASEDIR_CN1_NTCON);
 
        /*
          get a handle on the directory
@@ -1744,7 +1941,7 @@ static bool test_notify_tcon(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_NTCON;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1763,9 +1960,9 @@ static bool test_notify_tcon(struct torture_context *tctx,
        notify.nttrans.in.file.fnum = fnum;
        notify.nttrans.in.recursive = true;
 
-       printf("Testing notify mkdir\n");
+       torture_comment(tctx, "Testing notify mkdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1780,9 +1977,9 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("Testing notify rmdir\n");
+       torture_comment(tctx, "Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1796,16 +1993,16 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("SIMPLE CHANGE NOTIFY OK\n");
+       torture_comment(tctx, "SIMPLE CHANGE NOTIFY OK\n");
 
-       printf("TESTING WITH SECONDARY TCON\n");
+       torture_comment(tctx, "TESTING WITH SECONDARY TCON\n");
        tree = secondary_tcon(cli, tctx);
        torture_assert_not_null_goto(tctx, tree, ret, done,
                                     "failed to create secondary tcon");
 
-       printf("Testing notify mkdir\n");
+       torture_comment(tctx, "Testing notify mkdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1820,9 +2017,9 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("Testing notify rmdir\n");
+       torture_comment(tctx, "Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1836,17 +2033,17 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("CHANGE NOTIFY WITH TCON OK\n");
+       torture_comment(tctx, "CHANGE NOTIFY WITH TCON OK\n");
 
-       printf("Disconnecting secondary tree\n");
+       torture_comment(tctx, "Disconnecting secondary tree\n");
        status = smb_tree_disconnect(tree);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
                                        "smb_tree_disconnect");
        talloc_free(tree);
 
-       printf("Testing notify mkdir\n");
+       torture_comment(tctx, "Testing notify mkdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_mkdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1861,9 +2058,9 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("Testing notify rmdir\n");
+       torture_comment(tctx, "Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
-       smbcli_rmdir(cli->tree, BASEDIR "\\subdir-name");
+       smbcli_rmdir(cli->tree, BASEDIR_CN1_NTCON "\\subdir-name");
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
@@ -1877,37 +2074,60 @@ static bool test_notify_tcon(struct torture_context *tctx,
        CHECK_WSTR(tctx, notify.nttrans.out.changes[0].name, "subdir-name",
                   STR_UNICODE);
 
-       printf("CHANGE NOTIFY WITH TDIS OK\n");
+       torture_comment(tctx, "CHANGE NOTIFY WITH TDIS OK\n");
 done:
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_NTCON);
        return ret;
 }
 
+struct cb_data {
+       struct smbcli_request *req;
+       bool timed_out;
+};
+
+static void timeout_cb(struct tevent_context *ev,
+                       struct tevent_timer *te,
+                       struct timeval current_time,
+                       void *private_data)
+{
+       struct cb_data *cbp = (struct cb_data *)private_data;
+       cbp->req->state = SMBCLI_REQUEST_ERROR;
+       cbp->timed_out = true;
+}
 
 /*
    testing alignment of multiple change notify infos
 */
+
+#define BASEDIR_CN1_NALIGN BASEDIR "_CN1_NALIGN"
+
 static bool test_notify_alignment(struct torture_context *tctx,
                                  struct smbcli_state *cli)
 {
        NTSTATUS status;
        union smb_notify notify;
        union smb_open io;
-       int i, fnum, fnum2;
+       int fnum, fnum2;
        struct smbcli_request *req;
-       const char *fname = BASEDIR "\\starter";
+       const char *fname = BASEDIR_CN1_NALIGN "\\starter";
        const char *fnames[] = { "a",
                                 "ab",
                                 "abc",
                                 "abcd" };
-       int num_names = ARRAY_SIZE(fnames);
+       bool fnames_received[] = {false,
+                                 false,
+                                 false,
+                                 false};
+       size_t total_names_received = 0;
+       size_t num_names = ARRAY_SIZE(fnames);
+       size_t i;
        char *fpath = NULL;
 
        torture_comment(tctx, "TESTING CHANGE NOTIFY REPLY ALIGNMENT\n");
 
-       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
-                      "Failed to setup up test directory: " BASEDIR);
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR_CN1_NALIGN),
+               "Failed to setup up test directory: " BASEDIR_CN1_NALIGN);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1922,7 +2142,7 @@ static bool test_notify_alignment(struct torture_context *tctx,
        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN;
        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
        io.ntcreatex.in.security_flags = 0;
-       io.ntcreatex.in.fname = BASEDIR;
+       io.ntcreatex.in.fname = BASEDIR_CN1_NALIGN;
 
        status = smb_raw_open(cli->tree, tctx, &io);
        torture_assert_ntstatus_ok(tctx, status, "smb_raw_open");
@@ -1951,7 +2171,8 @@ static bool test_notify_alignment(struct torture_context *tctx,
         * 4-byte aligned. */
 
        for (i = 0; i < num_names; i++) {
-               fpath = talloc_asprintf(tctx, "%s\\%s", BASEDIR, fnames[i]);
+               fpath = talloc_asprintf(tctx, "%s\\%s",
+                               BASEDIR_CN1_NALIGN, fnames[i]);
                fnum2 = smbcli_open(cli->tree, fpath,
                    O_CREAT|O_RDWR, DENY_NONE);
                torture_assert(tctx, fnum2 != -1, smbcli_errstr(cli->tree));
@@ -1959,23 +2180,95 @@ static bool test_notify_alignment(struct torture_context *tctx,
                talloc_free(fpath);
        }
 
-       /* We send a notify packet, and let smb_raw_changenotify_recv() do
-        * the alignment checking for us. */
-       req = smb_raw_changenotify_send(cli->tree, &notify);
-       status = smb_raw_changenotify_recv(req, tctx, &notify);
-       torture_assert_ntstatus_ok(tctx, status, "smb_raw_changenotify_recv");
+       /*
+        * Slow cloud filesystems mean we might
+        * not get everything in one go. Keep going
+        * until we get them all.
+        */
+       while (total_names_received < num_names) {
+               struct tevent_timer *te = NULL;
+               struct cb_data to_data = {0};
 
-       /* Do basic checking for correctness. */
-       torture_assert(tctx, notify.nttrans.out.num_changes == num_names, "");
-       for (i = 0; i < num_names; i++) {
-               torture_assert(tctx, notify.nttrans.out.changes[i].action ==
-                   NOTIFY_ACTION_ADDED, "");
-               CHECK_WSTR(tctx, notify.nttrans.out.changes[i].name, fnames[i],
-                   STR_UNICODE);
+               /*
+                * We send a notify packet, and let
+                * smb_raw_changenotify_recv() do
+                * the alignment checking for us.
+                */
+               req = smb_raw_changenotify_send(cli->tree, &notify);
+               torture_assert(tctx,
+                       req != NULL,
+                       "smb_raw_changenotify_send failed\n");
+
+               /* Ensure we don't wait more than 30 seconds. */
+               to_data.req = req;
+               to_data.timed_out = false;
+
+               te = tevent_add_timer(tctx->ev,
+                               req,
+                               tevent_timeval_current_ofs(30, 0),
+                               timeout_cb,
+                               &to_data);
+               if (te == NULL) {
+                       torture_fail(tctx, "tevent_add_timer fail\n");
+               }
+
+               status = smb_raw_changenotify_recv(req, tctx, &notify);
+               if (!NT_STATUS_IS_OK(status)) {
+                       if (to_data.timed_out == true) {
+                               torture_fail(tctx, "smb_raw_changenotify_recv "
+                                       "timed out\n");
+                       }
+               }
+
+               torture_assert_ntstatus_ok(tctx, status,
+                       "smb_raw_changenotify_recv");
+
+               for (i = 0; i < notify.nttrans.out.num_changes; i++) {
+                       size_t j;
+
+                       /* Ensure it was an 'add'. */
+                       torture_assert(tctx,
+                               notify.nttrans.out.changes[i].action ==
+                                       NOTIFY_ACTION_ADDED,
+                               "");
+
+                       for (j = 0; j < num_names; j++) {
+                               if (strcmp(notify.nttrans.out.changes[i].name.s,
+                                               fnames[j]) == 0) {
+                                       if (fnames_received[j] == true) {
+                                               const char *err =
+                                                       talloc_asprintf(tctx,
+                                                               "Duplicate "
+                                                               "name %s\n",
+                                                               fnames[j]);
+                                               if (err == NULL) {
+                                                       torture_fail(tctx,
+                                                               "talloc "
+                                                               "fail\n");
+                                               }
+                                               /* already got this. */
+                                               torture_fail(tctx, err);
+                                       }
+                                       fnames_received[j] = true;
+                                       break;
+                               }
+                       }
+                       if (j == num_names) {
+                               /* No name match. */
+                               const char *err = talloc_asprintf(tctx,
+                                       "Unexpected name %s\n",
+                                       notify.nttrans.out.changes[i].name.s);
+                               if (err == NULL) {
+                                       torture_fail(tctx, "talloc fail\n");
+                               }
+                               torture_fail(tctx, err);
+                       }
+                       total_names_received++;
+               }
        }
 
        smb_raw_exit(cli->session);
-       smbcli_deltree(cli->tree, BASEDIR);
+       smbcli_deltree(cli->tree, BASEDIR_CN1_NALIGN);
        return true;
 }