for (i=0;i<count;i++) {
char *fname = talloc_asprintf(cli, BASEDIR "\\test%d.txt", i);
int fnum3 = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
- if (fnum3 == -1) {
- printf("Failed to create %s - %s\n",
- fname, smbcli_errstr(cli->tree));
- ret = false;
- goto done;
- }
+ torture_assert_int_not_equal_goto(mem_ctx, fnum3, -1, ret, done,
+ talloc_asprintf(mem_ctx, "Failed to create %s - %s",
+ fname, smbcli_errstr(cli->tree)));
talloc_free(fname);
smbcli_close(cli->tree, fnum3);
}
CHECK_WSTR(mem_ctx, notify.nttrans.out.changes[0].name, "subname3-r",
STR_UNICODE);
- if (!ret) {
- goto done;
- }
-
done:
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);
#define NOTIFY_MASK_TEST(test_name, setup, op, cleanup, Action, expected, nchanges) \
do { \
smbcli_getatr(cli->tree, test_name, NULL, NULL, NULL); \
- do { for (mask=i=0;i<32;i++) { \
+ for (mask=i=0;i<32;i++) { \
struct smbcli_request *req; \
status = smb_raw_open(cli->tree, tctx, &io); \
torture_assert_ntstatus_ok_goto(tctx, status, ret, done, \
((expected) & FILE_NOTIFY_CHANGE_ATTRIBUTES) && \
Action == NOTIFY_ACTION_OLD_NAME) { \
printf("(rename file special handling OK)\n"); \
- } else if (nchanges != notify.nttrans.out.num_changes) { \
- printf("ERROR: nchanges=%d expected=%d action=%d filter=0x%08x\n", \
- notify.nttrans.out.num_changes, \
- nchanges, \
- notify.nttrans.out.changes[0].action, \
- notify.nttrans.in.completion_filter); \
- ret = false; \
- } else if (notify.nttrans.out.changes[0].action != Action) { \
- printf("ERROR: nchanges=%d action=%d expectedAction=%d filter=0x%08x\n", \
- notify.nttrans.out.num_changes, \
- notify.nttrans.out.changes[0].action, \
- Action, \
- notify.nttrans.in.completion_filter); \
- ret = false; \
- } else if (strcmp(notify.nttrans.out.changes[0].name.s, "tname1") != 0) { \
- printf("ERROR: nchanges=%d action=%d filter=0x%08x name=%s\n", \
- notify.nttrans.out.num_changes, \
- notify.nttrans.out.changes[0].action, \
- notify.nttrans.in.completion_filter, \
- notify.nttrans.out.changes[0].name.s); \
- ret = false; \
+ } else { \
+ torture_assert_int_equal_goto(tctx, \
+ notify.nttrans.out.num_changes,\
+ nchanges, ret, done, \
+ talloc_asprintf(tctx, \
+ "nchanges=%d expected=%d action=%d " \
+ "filter=0x%08x\n", \
+ notify.nttrans.out.num_changes, \
+ nchanges, \
+ notify.nttrans.out.changes[0].action, \
+ notify.nttrans.in.completion_filter)); \
+ torture_assert_int_equal_goto(tctx, \
+ notify.nttrans.out.changes[0].action, \
+ Action, ret, done, \
+ talloc_asprintf(tctx, \
+ "nchanges=%d action=%d " \
+ "expectedAction=%d filter=0x%08x\n", \
+ notify.nttrans.out.num_changes, \
+ notify.nttrans.out.changes[0].action, \
+ Action, \
+ notify.nttrans.in.completion_filter)); \
+ torture_assert_str_equal_goto(tctx, \
+ notify.nttrans.out.changes[0].name.s, \
+ "tname1", ret, done, \
+ talloc_asprintf(tctx, \
+ "nchanges=%d action=%d filter=0x%08x " \
+ "name=%s expected_name=tname1\n", \
+ notify.nttrans.out.num_changes, \
+ notify.nttrans.out.changes[0].action, \
+ notify.nttrans.in.completion_filter, \
+ notify.nttrans.out.changes[0].name.s));\
} \
mask |= (1<<i); \
} \
if ((expected) != mask) { \
- if (((expected) & ~mask) != 0) { \
- printf("ERROR: trigger on too few bits. mask=0x%08x expected=0x%08x\n", \
- mask, expected); \
- ret = false; \
- } else { \
- printf("WARNING: trigger on too many bits. mask=0x%08x expected=0x%08x\n", \
- mask, expected); \
- } \
+ 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", \
+ mask, expected); \
} \
- } while (0); \
} while (0);
printf("Testing mkdir\n");
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
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
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
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
printf("took %.4f seconds to propogate all events\n", timeval_elapsed(&tv));
for (i=0;i<ARRAY_SIZE(dirs);i++) {
- if (dirs[i].counted != dirs[i].expected) {
- printf("ERROR: i=%d expected %d got %d for '%s'\n",
- i, dirs[i].expected, dirs[i].counted, dirs[i].path);
- ret = false;
- }
+ torture_assert_int_equal_goto(mem_ctx,
+ dirs[i].counted, dirs[i].expected, ret, done,
+ talloc_asprintf(mem_ctx,
+ "unexpected number of events for '%s'",
+ dirs[i].path));
}
/*
char *fname = talloc_asprintf(cli, BASEDIR "\\test%d.txt", i);
int fnum2 = smbcli_open(cli->tree, fname, O_CREAT|O_RDWR,
DENY_NONE);
- if (fnum2 == -1) {
- printf("Failed to create %s - %s\n",
- fname, smbcli_errstr(cli->tree));
- ret = false;
- goto done;
- }
+ torture_assert_int_not_equal_goto(mem_ctx, fnum2, -1, ret, done,
+ talloc_asprintf(mem_ctx, "Failed to create %s - %s",
+ fname, smbcli_errstr(cli->tree)));
talloc_free(fname);
smbcli_close(cli->tree, fnum2);
}