fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- torture_comment(tctx, "Failed to open %s\n", fname);
+ torture_result(tctx, TORTURE_FAIL, "Failed to open %s", fname);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.basic_info.out.write_time));
written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
if (written != 1) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
+ torture_result(tctx, TORTURE_FAIL,
+ "write failed - wrote %d bytes (%s)\n",
+ (int)written, __location__);
return false;
}
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time (wrong!)");
ret = false;
}
fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- torture_comment(tctx, "Failed to open %s\n", fname);
+ torture_result(tctx, TORTURE_FAIL, "Failed to open %s", fname);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.all_info.out.write_time));
written = smbcli_smbwrite(cli->tree, fnum1, "x", 1024, 0);
if (written != 0) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
+ torture_result(tctx, TORTURE_FAIL,
+ "write failed - wrote %d bytes (%s)\n",
+ (int)written, __location__);
return false;
}
}
if (finfo2.all_info.out.size != 1024) {
- DEBUG(0, ("file not truncated, size = %u (should be 1024)\n",
- (unsigned int)finfo2.all_info.out.size));
+ torture_result(tctx, TORTURE_FAIL,
+ "file not truncated, size = %u (should be 1024)",
+ (unsigned int)finfo2.all_info.out.size);
ret = false;
break;
}
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time (wrong!)");
ret = false;
}
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
if (written != 1) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
+ torture_result(tctx, TORTURE_FAIL,
+ "write failed - wrote %d bytes (%s)",
+ (int)written, __location__);
return false;
}
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
- torture_comment(tctx, "Server updated write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server updated write time (wrong!)");
ret = false;
}
fnum1 = -1;
status = smb_raw_pathinfo(cli->tree, tctx, &pinfo4);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("pathinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "pathinfo failed");
if (finfo3.all_info.out.write_time == pinfo4.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time on close (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time on close (wrong!)");
ret = false;
} else if (finfo3.all_info.out.write_time < pinfo4.all_info.out.write_time) {
torture_comment(tctx, "Server updated write time on close (correct)\n");
fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- torture_comment(tctx, "Failed to open %s\n", fname);
+ torture_result(tctx, TORTURE_FAIL, "Failed to open %s", fname);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.all_info.out.write_time));
written = smbcli_smbwrite(cli->tree, fnum1, "x", 10240, 0);
if (written != 0) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
+ torture_result(tctx, TORTURE_FAIL, "write failed - wrote %d bytes (%s)",
(int)written, __location__);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
+ torture_result(tctx, TORTURE_FAIL, "fileinfo failed: %s",
+ nt_errstr(status));
ret = false;
break;
}
if (finfo2.all_info.out.size != 10240) {
- DEBUG(0, ("file not truncated, size = %u (should be 10240)\n",
- (unsigned int)finfo2.all_info.out.size));
+ torture_result(tctx, TORTURE_FAIL,
+ "file not truncated, size = %u (should be 10240)",
+ (unsigned int)finfo2.all_info.out.size);
ret = false;
break;
}
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time (wrong!)");
ret = false;
}
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
- if (written != 1) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
- return false;
- }
+ torture_assert_int_equal(tctx, written, 1,
+ "unexpected number of bytes written");
start = timeval_current();
end = timeval_add(&start, (10*sec), 0);
status = smb_raw_fileinfo(cli->tree, tctx, &finfo3);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
+ torture_result(tctx, TORTURE_FAIL, "fileinfo failed: %s\n",
+ nt_errstr(status));
ret = false;
break;
}
if (finfo3.all_info.out.size != 10240) {
- DEBUG(0, ("file not truncated, size = %u (should be 10240)\n",
- (unsigned int)finfo3.all_info.out.size));
+ torture_result(tctx, TORTURE_FAIL,
+ "file not truncated, size = %u (should be 10240)",
+ (unsigned int)finfo3.all_info.out.size);
ret = false;
break;
}
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
- torture_comment(tctx, "Server updated write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server updated write time (wrong!)");
ret = false;
}
fnum1 = -1;
status = smb_raw_pathinfo(cli->tree, tctx, &pinfo4);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("pathinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "pathinfo failed");
if (finfo3.all_info.out.write_time == pinfo4.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time on close (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time on close (wrong!)");
ret = false;
} else if (finfo3.all_info.out.write_time < pinfo4.all_info.out.write_time) {
torture_comment(tctx, "Server updated write time on close (correct)\n");
fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- torture_comment(tctx, "Failed to open %s\n", fname);
+ torture_result(tctx, TORTURE_FAIL, "Failed to open %s", fname);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.all_info.out.write_time));
/* Do a SET_END_OF_FILE_INFO call to truncate. */
status = smbcli_ftruncate(cli->tree, fnum1, (uint64_t)10240);
- if (!NT_STATUS_IS_OK(status)) {
- torture_comment(tctx, "SET_END_OF_FILE failed (%s)\n",
- nt_errstr(status));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "SET_END_OF_FILE failed");
start = timeval_current();
end = timeval_add(&start, (120*sec), 0);
}
if (finfo2.all_info.out.size != 10240) {
- DEBUG(0, ("file not truncated (size = %u, should be 10240)\n",
- (unsigned int)finfo2.all_info.out.size ));
+ torture_result(tctx, TORTURE_FAIL,
+ "file not truncated (size = %u, should be 10240)",
+ (unsigned int)finfo2.all_info.out.size );
ret = false;
break;
}
if (finfo1.all_info.out.write_time != finfo2.all_info.out.write_time) {
double diff = timeval_elapsed(&start);
if (diff > (0.25 * sec * 0.75)) { /* 0.75 to cope with vmware timing */
- torture_comment(tctx, "After SET_END_OF_FILE truncate "
+ torture_result(tctx, TORTURE_FAIL,
+ "After SET_END_OF_FILE truncate "
"server updated write_time after %.2f seconds"
- "(1 sec == %.2f)(wrong!)\n",
+ "(1 sec == %.2f)(wrong!)",
diff, sec);
ret = false;
break;
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time (wrong!)");
ret = false;
}
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
- if (written != 1) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
- return false;
- }
+ torture_assert_int_equal(tctx, written, 1,
+ "unexpected number of bytes written");
start = timeval_current();
end = timeval_add(&start, (10*sec), 0);
status = smb_raw_fileinfo(cli->tree, tctx, &finfo3);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
+ torture_result(tctx, TORTURE_FAIL,
+ "fileinfo failed: %s", nt_errstr(status));
ret = false;
break;
}
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
- torture_comment(tctx, "Server updated write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL, "Server updated write time (wrong!)\n");
ret = false;
}
fnum1 = -1;
status = smb_raw_pathinfo(cli->tree, tctx, &pinfo4);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("pathinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "pathinfo failed");
if (finfo3.all_info.out.write_time == pinfo4.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time on close (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL, "Server did not update write time on close (wrong!)\n");
ret = false;
} else if (finfo3.all_info.out.write_time < pinfo4.all_info.out.write_time) {
torture_comment(tctx, "Server updated write time on close (correct)\n");
fnum1 = smbcli_open(cli->tree, fname, O_RDWR|O_CREAT, DENY_NONE);
if (fnum1 == -1) {
- torture_comment(tctx, "Failed to open %s\n", fname);
+ torture_result(tctx, TORTURE_FAIL, "Failed to open %s", fname);
return false;
}
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.all_info.out.write_time));
parms.allocation_info.in.file.fnum = fnum1;
parms.allocation_info.in.alloc_size = 0;
- status = smb_raw_setfileinfo(cli->tree, &parms);
+ status = smb_raw_setfileinfo(cli->tree, &parms);
- if (!NT_STATUS_IS_OK(status)) {
- torture_comment(tctx, "RAW_SFILEINFO_ALLOCATION_INFO failed (%s)\n",
- nt_errstr(status));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status,
+ "RAW_SFILEINFO_ALLOCATION_INFO failed");
start = timeval_current();
end = timeval_add(&start, (120*sec), 0);
status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
+ torture_result(tctx, TORTURE_FAIL, "fileinfo failed: %s",
+ nt_errstr(status));
ret = false;
break;
}
if (finfo2.all_info.out.size != 0) {
- DEBUG(0, ("file not truncated (size = %u, should be 10240)\n",
- (unsigned int)finfo2.all_info.out.size ));
+ torture_result(tctx, TORTURE_FAIL,
+ "file not truncated (size = %u, should be 10240)",
+ (unsigned int)finfo2.all_info.out.size);
ret = false;
break;
}
}
if (finfo1.all_info.out.write_time == finfo2.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server did not update write time (wrong!)");
ret = false;
}
/* Do a non-zero length SMBwrite and make sure it doesn't update the write time. */
written = smbcli_smbwrite(cli->tree, fnum1, "x", 0, 1);
-
- if (written != 1) {
- torture_comment(tctx, "write failed - wrote %d bytes (%s)\n",
- (int)written, __location__);
- return false;
- }
+ torture_assert_int_equal(tctx, written, 1,
+ "Unexpected number of bytes written");
start = timeval_current();
end = timeval_add(&start, (10*sec), 0);
status = smb_raw_fileinfo(cli->tree, tctx, &finfo3);
if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
+ torture_result(tctx, TORTURE_FAIL, "fileinfo failed: %s",
+ nt_errstr(status));
ret = false;
break;
}
if (finfo3.all_info.out.size != 1) {
- DEBUG(0, ("file not expanded\n"));
+ torture_result(tctx, TORTURE_FAIL, "file not expanded");
ret = false;
break;
}
}
if (finfo2.all_info.out.write_time != finfo3.all_info.out.write_time) {
- torture_comment(tctx, "Server updated write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL,
+ "Server updated write time (wrong!)");
ret = false;
}
fnum1 = -1;
status = smb_raw_pathinfo(cli->tree, tctx, &pinfo4);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("pathinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "pathinfo failed");
if (finfo3.all_info.out.write_time == pinfo4.all_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time on close (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL, "Server did not update write time on close (wrong!)\n");
ret = false;
} else if (finfo3.all_info.out.write_time < pinfo4.all_info.out.write_time) {
torture_comment(tctx, "Server updated write time on close (correct)\n");
status = smb_raw_fileinfo(cli->tree, tctx, &finfo1);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("fileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "fileinfo failed");
torture_comment(tctx, "Initial write time %s\n",
nt_time_string(tctx, finfo1.basic_info.out.write_time));
status = smb_raw_setfileinfo(cli->tree, &sfinfo);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0, ("sfileinfo failed: %s\n", nt_errstr(status)));
- return false;
- }
+ torture_assert_ntstatus_ok(tctx, status, "sfileinfo failed");
}
finfo2.basic_info.in.file.path = fname;
if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) {
torture_comment(tctx, "Server updated write_time (correct)\n");
} else {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL, "Server did not update write time (wrong!)\n");
ret = false;
}
}
if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
- torture_comment(tctx, "Server did not update write time (wrong!)\n");
+ torture_result(tctx, TORTURE_FAIL, "Server did not update write time (wrong!)\n");
ret = false;
}
torture_suite_add_2smb_test(suite, "finfo update on close", test_finfo_after_write);
torture_suite_add_1smb_test(suite, "delayed update of write time", test_delayed_write_update);
- torture_suite_add_1smb_test(suite, "update of write time and SMBwrite truncate ", test_delayed_write_update1);
+ torture_suite_add_1smb_test(suite, "update of write time and SMBwrite truncate", test_delayed_write_update1);
torture_suite_add_1smb_test(suite, "update of write time and SMBwrite truncate expand", test_delayed_write_update1a);
torture_suite_add_1smb_test(suite, "update of write time using SET_END_OF_FILE", test_delayed_write_update1b);
torture_suite_add_1smb_test(suite, "update of write time using SET_ALLOCATION_SIZE", test_delayed_write_update1c);