s4:torture:raw:notify: remove superfluous conditional goto
[kai/samba-autobuild/.git] / source4 / torture / raw / notify.c
index 3f14ccc103022a4abef533bdb5947c09c0cd84f1..023ce5c8e1b94988bb16eab87d50a8d3e30f9d18 100644 (file)
 
 #define BASEDIR "\\test_notify"
 
-#define CHECK_WSTR(field, value, flags) do { \
-       if (!field.s || strcmp(field.s, value) || wire_bad_flags(&field, flags, cli->transport)) { \
-               printf("(%d) %s [%s] != %s\n",  __LINE__, #field, field.s, value); \
-                       ret = false; \
-               goto done; \
-       }} while (0)
-
-#define CHECK_WSTR2(tctx, field, value, flags) \
+#define CHECK_WSTR(tctx, field, value, flags) \
 do { \
-       if (!field.s || strcmp(field.s, value) || \
-           wire_bad_flags(&field, flags, cli->transport)) { \
-               torture_result(tctx, TORTURE_FAIL, \
-                   "(%d) %s [%s] != %s\n",  __LINE__, #field, field.s, value); \
-       } \
+       torture_assert_str_equal(tctx, field.s, value, "values don't match"); \
+       torture_assert(tctx, \
+                      !wire_bad_flags(&field, STR_UNICODE, cli->transport), \
+                      "wire_bad_flags"); \
 } while (0)
 
 /* 
@@ -60,10 +52,9 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
        extern int torture_numops;
 
        printf("TESTING CHANGE NOTIFY ON DIRECTORIES\n");
-               
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /*
          get a handle on the directory
@@ -123,7 +114,8 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("Testing notify rmdir\n");
 
@@ -139,7 +131,8 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("Testing notify mkdir - rmdir - mkdir - rmdir\n");
 
@@ -158,22 +151,26 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[1].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[1].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[1].name, "subdir-name",
+                  STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[2].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[2].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[2].name, "subdir-name",
+                  STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[3].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[3].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[3].name, "subdir-name",
+                  STR_UNICODE);
 
        count = torture_numops;
        printf("Testing buffered notify on create of %d files\n", count);
@@ -228,7 +225,8 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                        NOTIFY_ACTION_ADDED, ret, done,
                                        "wrong action (exp: ADDED)");
        }
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "test0.txt", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "test0.txt",
+                  STR_UNICODE);
 
        printf("and now from the 1st notify\n");
        status = smb_raw_changenotify_recv(req2, mem_ctx, &notify);
@@ -240,7 +238,8 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "test0.txt", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "test0.txt",
+                  STR_UNICODE);
 
        printf("(3rd notify) this notify will only see the 1st unlink\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
@@ -267,7 +266,8 @@ static bool test_notify_dir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "test0.txt", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "test0.txt",
+                  STR_UNICODE);
 
        /* and we now see the rest of the unlink calls on both directory handles */
        notify.nttrans.in.file.fnum = fnum;
@@ -331,7 +331,8 @@ done:
  * pair in any of the three following notify_changes.
  */
 
-static bool check_rename_reply(struct smbcli_state *cli,
+static bool check_rename_reply(struct torture_context *tctx,
+                              struct smbcli_state *cli,
                               int line,
                               struct notify_changes *actions,
                               uint32_t action, const char *name)
@@ -340,19 +341,14 @@ static bool check_rename_reply(struct smbcli_state *cli,
 
        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->transport))) {
-                               printf("(%d) name [%s] != %s\n", line,
-                                      actions[i].name.s, name);
-                               return false;
-                       }
+                       CHECK_WSTR(tctx, actions[i].name, name, STR_UNICODE);
                        return true;
                }
        }
 
-       printf("(%d) expected action %d, not found\n", line, action);
+       torture_result(tctx, TORTURE_FAIL,
+                      __location__": (%d) expected action %d, not found\n",
+                      line, action);
        return false;
 }
 
@@ -371,10 +367,9 @@ static bool test_notify_recursive(struct torture_context *mem_ctx,
        struct smbcli_request *req1, *req2;
 
        printf("TESTING CHANGE NOTIFY WITH RECURSION\n");
-               
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /*
          get a handle on the directory
@@ -461,45 +456,50 @@ static bool test_notify_recursive(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[1].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[1].name, "subdir-name\\subname1", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[1].name,
+                  "subdir-name\\subname1", STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[2].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[2].name, "subdir-name\\subname2", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[2].name,
+                  "subdir-name\\subname2", STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[3].action,
                                      NOTIFY_ACTION_OLD_NAME, ret, done,
                                      "wrong action (exp: OLD_NAME)");
-       CHECK_WSTR(notify.nttrans.out.changes[3].name, "subdir-name\\subname1", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[3].name,
+                  "subdir-name\\subname1", STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[4].action,
                                      NOTIFY_ACTION_NEW_NAME, ret, done,
                                      "wrong action (exp: NEW_NAME)");
-       CHECK_WSTR(notify.nttrans.out.changes[4].name, "subdir-name\\subname1-r", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[4].name,
+                  "subdir-name\\subname1-r", STR_UNICODE);
 
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[5],
                NOTIFY_ACTION_ADDED, "subname2-r");
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[5],
                NOTIFY_ACTION_REMOVED, "subdir-name\\subname2");
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[5],
                NOTIFY_ACTION_MODIFIED, "subname2-r");
                
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[8],
                NOTIFY_ACTION_OLD_NAME, "subname2-r");
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[8],
                NOTIFY_ACTION_NEW_NAME, "subname3-r");
-       ret &= check_rename_reply(
+       ret &= check_rename_reply(mem_ctx,
                cli, __LINE__, &notify.nttrans.out.changes[8],
                NOTIFY_ACTION_MODIFIED, "subname3-r");
 
@@ -517,17 +517,20 @@ static bool test_notify_recursive(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name\\subname1-r", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name,
+                  "subdir-name\\subname1-r", STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[1].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[1].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[1].name, "subdir-name",
+                  STR_UNICODE);
        torture_assert_int_equal_goto(mem_ctx,
                                      notify.nttrans.out.changes[2].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[2].name, "subname3-r", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[2].name, "subname3-r",
+                  STR_UNICODE);
 
 done:
        smb_raw_exit(cli->session);
@@ -550,9 +553,8 @@ static bool test_notify_mask_change(struct torture_context *mem_ctx,
 
        printf("TESTING CHANGE NOTIFY WITH MASK CHANGE\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /*
          get a handle on the directory
@@ -621,7 +623,8 @@ static bool test_notify_mask_change(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_MODIFIED, ret, done,
                                      "wrong action (exp: MODIFIED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "tname1", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "tname1",
+                  STR_UNICODE);
 
        /* Now try and change the mask to include other events.
         * This should not work - once the mask is set on a directory
@@ -656,7 +659,8 @@ static bool test_notify_mask_change(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_MODIFIED, ret, done,
                                      "wrong action (exp: MODIFIED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subname2-r", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subname2-r",
+                  STR_UNICODE);
 
        status = smb_raw_changenotify_recv(req2, mem_ctx, &notify);
        torture_assert_ntstatus_ok_goto(mem_ctx, status, ret, done,
@@ -668,11 +672,8 @@ static bool test_notify_mask_change(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_MODIFIED, ret, done,
                                      "wrong action (exp: MODIFIED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subname3-r", STR_UNICODE);
-
-       if (!ret) {
-               goto done;
-       }
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subname3-r",
+                  STR_UNICODE);
 
 done:
        smb_raw_exit(cli->session);
@@ -702,9 +703,8 @@ static bool test_notify_mask(struct torture_context *tctx,
 
        printf("TESTING CHANGE NOTIFY COMPLETION FILTERS\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        tv = timeval_current_ofs(1000, 0);
        t = timeval_to_nttime(&tv);
@@ -946,9 +946,8 @@ static bool test_notify_file(struct torture_context *mem_ctx,
 
        printf("TESTING CHANGE NOTIFY ON FILES\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        io.generic.level = RAW_OPEN_NTCREATEX;
        io.ntcreatex.in.root_fid.fnum = 0;
@@ -1017,13 +1016,11 @@ static bool test_notify_tdis(struct torture_context *tctx,
 
        printf("TESTING CHANGE NOTIFY FOLLOWED BY TDIS\n");
 
-       if (!torture_setup_dir(cli1, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
-       if (!torture_open_connection(&cli, tctx, 0)) {
-               return false;
-       }
+       torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
+                      "Failed to open connection.");
 
        /*
          get a handle on the directory
@@ -1089,13 +1086,11 @@ static bool test_notify_exit(struct torture_context *tctx,
 
        printf("TESTING CHANGE NOTIFY FOLLOWED BY EXIT\n");
 
-       if (!torture_setup_dir(cli1, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
-       if (!torture_open_connection(&cli, tctx, 0)) {
-               return false;
-       }
+       torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
+                      "Failed to open connection.");
 
        /*
          get a handle on the directory
@@ -1160,13 +1155,11 @@ static bool test_notify_ulogoff(struct torture_context *tctx,
 
        printf("TESTING CHANGE NOTIFY FOLLOWED BY ULOGOFF\n");
 
-       if (!torture_setup_dir(cli1, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
-       if (!torture_open_connection(&cli, tctx, 0)) {
-               return false;
-       }
+       torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
+                      "Failed to open connection.");
 
        /*
          get a handle on the directory
@@ -1238,13 +1231,11 @@ static bool test_notify_tcp_dis(struct torture_context *tctx,
 
        printf("TESTING CHANGE NOTIFY FOLLOWED BY TCP DISCONNECT\n");
 
-       if (!torture_setup_dir(cli1, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli1, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
-       if (!torture_open_connection(&cli, tctx, 0)) {
-               return false;
-       }
+       torture_assert(tctx, torture_open_connection(&cli, tctx, 0),
+                      "Failed to open connection.");
 
        /*
          get a handle on the directory
@@ -1305,10 +1296,10 @@ static bool test_notify_double(struct torture_context *mem_ctx,
        struct smbcli_request *req1, *req2;
 
        printf("TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
-               
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
+
        /*
          get a handle on the directory
        */
@@ -1348,7 +1339,8 @@ static bool test_notify_double(struct torture_context *mem_ctx,
                                        "smb_raw_changenotify_recv");
        torture_assert_int_equal_goto(mem_ctx, notify.nttrans.out.num_changes,
                                      1, ret, done, "wrong number of changes");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name2");
 
@@ -1357,7 +1349,8 @@ static bool test_notify_double(struct torture_context *mem_ctx,
                                        "smb_raw_changenotify_recv");
        torture_assert_int_equal_goto(mem_ctx, notify.nttrans.out.num_changes,
                                      1, ret, done, "wrong number of changes");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name2", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subdir-name2",
+                  STR_UNICODE);
 
 done:
        smb_raw_exit(cli->session);
@@ -1413,9 +1406,8 @@ static bool test_notify_tree(struct torture_context *mem_ctx,
 
        printf("TESTING CHANGE NOTIFY FOR DIFFERENT DEPTHS\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        io.generic.level = RAW_OPEN_NTCREATEX;
        io.ntcreatex.in.root_fid.fnum = 0;
@@ -1532,9 +1524,8 @@ static bool test_notify_overflow(struct torture_context *mem_ctx,
 
        printf("TESTING CHANGE NOTIFY EVENT OVERFLOW\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1620,9 +1611,8 @@ static bool test_notify_basedir(struct torture_context *mem_ctx,
 
        printf("TESTING CHANGE NOTIFY BASEDIR EVENTS\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(mem_ctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1674,7 +1664,8 @@ static bool test_notify_basedir(struct torture_context *mem_ctx,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_MODIFIED, ret, done,
                                      "wrong action (exp: MODIFIED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "tname1", STR_UNICODE);
+       CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "tname1",
+                  STR_UNICODE);
 
 done:
        smb_raw_exit(cli->session);
@@ -1736,10 +1727,9 @@ static bool test_notify_tcon(struct torture_context *torture,
        struct smbcli_tree *tree = NULL;
                
        printf("TESTING SIMPLE CHANGE NOTIFY\n");
-               
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+
+       torture_assert(torture, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /*
          get a handle on the directory
@@ -1788,7 +1778,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
@@ -1803,7 +1794,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("SIMPLE CHANGE NOTIFY OK\n");
 
@@ -1824,7 +1816,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
@@ -1839,7 +1832,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("CHANGE NOTIFY WITH TCON OK\n");
 
@@ -1863,7 +1857,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_ADDED, ret, done,
                                      "wrong action (exp: ADDED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("Testing notify rmdir\n");
        req = smb_raw_changenotify_send(cli->tree, &notify);
@@ -1878,7 +1873,8 @@ static bool test_notify_tcon(struct torture_context *torture,
                                      notify.nttrans.out.changes[0].action,
                                      NOTIFY_ACTION_REMOVED, ret, done,
                                      "wrong action (exp: REMOVED)");
-       CHECK_WSTR(notify.nttrans.out.changes[0].name, "subdir-name", STR_UNICODE);
+       CHECK_WSTR(torture, notify.nttrans.out.changes[0].name, "subdir-name",
+                  STR_UNICODE);
 
        printf("CHANGE NOTIFY WITH TDIS OK\n");
 done:
@@ -1909,9 +1905,8 @@ static bool test_notify_alignment(struct torture_context *tctx,
 
        torture_comment(tctx, "TESTING CHANGE NOTIFY REPLY ALIGNMENT\n");
 
-       if (!torture_setup_dir(cli, BASEDIR)) {
-               return false;
-       }
+       torture_assert(tctx, torture_setup_dir(cli, BASEDIR),
+                      "Failed to setup up test directory: " BASEDIR);
 
        /* get a handle on the directory */
        io.generic.level = RAW_OPEN_NTCREATEX;
@@ -1929,7 +1924,7 @@ static bool test_notify_alignment(struct torture_context *tctx,
        io.ntcreatex.in.fname = BASEDIR;
 
        status = smb_raw_open(cli->tree, tctx, &io);
-       torture_assert_ntstatus_ok(tctx, status, "");
+       torture_assert_ntstatus_ok(tctx, status, "smb_raw_open");
        fnum = io.ntcreatex.out.file.fnum;
 
        /* ask for a change notify, on file creation */
@@ -1947,7 +1942,7 @@ static bool test_notify_alignment(struct torture_context *tctx,
        smbcli_close(cli->tree, fnum2);
 
        status = smb_raw_changenotify_recv(req, tctx, &notify);
-       torture_assert_ntstatus_ok(tctx, status, "");
+       torture_assert_ntstatus_ok(tctx, status, "smb_raw_changenotify_recv");
 
        /* create 4 files that will cause CHANGE_NOTIFY_INFO structures
         * to be returned in the same packet with all possible 4-byte padding
@@ -1967,14 +1962,14 @@ static bool test_notify_alignment(struct torture_context *tctx,
         * 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, "");
+       torture_assert_ntstatus_ok(tctx, status, "smb_raw_changenotify_recv");
 
        /* 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_WSTR2(tctx, notify.nttrans.out.changes[i].name, fnames[i],
+               CHECK_WSTR(tctx, notify.nttrans.out.changes[i].name, fnames[i],
                    STR_UNICODE);
        }