#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
- printf("(%s) Incorrect status %s - should be %s\n", \
- __location__, nt_errstr(status), nt_errstr(correct)); \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) Incorrect status %s - should be %s\n", \
+ __location__, nt_errstr(status), nt_errstr(correct)); \
ret = false; \
goto done; \
}} while (0)
#define CHECK_VALUE(v, correct) do { \
if ((v) != (correct)) { \
- printf("(%s) Incorrect %s %d - should be %d\n", \
- __location__, #v, (int)v, (int)correct); \
+ torture_result(tctx, TORTURE_FAIL, \
+ "(%s) Incorrect %s %d - should be %d\n", \
+ __location__, #v, (int)v, (int)correct); \
ret = false; \
}} while (0)
union smb_fileinfo finfo;
union smb_open op;
- printf("Testing SMBmv\n");
+ torture_comment(tctx, "Testing SMBmv\n");
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
- printf("Trying simple rename\n");
+ torture_comment(tctx, "Trying simple rename\n");
op.generic.level = RAW_OPEN_NTCREATEX;
op.ntcreatex.in.root_fid = 0;
io.rename.in.pattern2 = fname2;
io.rename.in.attrib = 0;
- printf("trying rename while first file open\n");
+ torture_comment(tctx, "trying rename while first file open\n");
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_SHARING_VIOLATION);
CHECK_STATUS(status, NT_STATUS_OK);
fnum = op.ntcreatex.out.file.fnum;
- printf("trying rename while first file open with SHARE_ACCESS_DELETE\n");
+ torture_comment(tctx, "trying rename while first file open with SHARE_ACCESS_DELETE\n");
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("Trying case-changing rename\n");
+ torture_comment(tctx, "Trying case-changing rename\n");
io.rename.in.pattern1 = fname1;
io.rename.in.pattern2 = Fname1;
status = smb_raw_rename(cli->tree, &io);
status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
if (strcmp(finfo.all_info.out.fname.s, Fname1) != 0) {
- printf("(%s) Incorrect filename [%s] after case-changing "
+ torture_warning(tctx, "(%s) Incorrect filename [%s] after case-changing "
"rename, should be [%s]\n", __location__,
finfo.all_info.out.fname.s, Fname1);
}
io.rename.in.pattern1 = fname1;
io.rename.in.pattern2 = fname2;
- printf("trying rename while not open\n");
+ torture_comment(tctx, "trying rename while not open\n");
smb_raw_exit(cli->session);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("Trying self rename\n");
+ torture_comment(tctx, "Trying self rename\n");
io.rename.in.pattern1 = fname2;
io.rename.in.pattern2 = fname2;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
- printf("trying wildcard rename\n");
+ torture_comment(tctx, "trying wildcard rename\n");
io.rename.in.pattern1 = BASEDIR "\\*.txt";
io.rename.in.pattern2 = fname1;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("and again\n");
+ torture_comment(tctx, "and again\n");
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("Trying extension change\n");
+ torture_comment(tctx, "Trying extension change\n");
io.rename.in.pattern1 = BASEDIR "\\*.txt";
io.rename.in.pattern2 = BASEDIR "\\*.bak";
status = smb_raw_rename(cli->tree, &io);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_NO_SUCH_FILE);
- printf("Checking attrib handling\n");
+ torture_comment(tctx, "Checking attrib handling\n");
torture_set_file_attribute(cli->tree, BASEDIR "\\test1.bak", FILE_ATTRIBUTE_HIDDEN);
io.rename.in.pattern1 = BASEDIR "\\test1.bak";
io.rename.in.pattern2 = BASEDIR "\\*.txt";
union smb_fileinfo finfo;
union smb_open op;
- printf("\nTesting OSX Rename\n");
+ torture_comment(tctx, "\nTesting OSX Rename\n");
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
* If we find one and both the output and input are same case,
* delete it. */
- printf("Checking os X rename (case changing)\n");
+ torture_comment(tctx, "Checking os X rename (case changing)\n");
finfo.generic.level = RAW_FILEINFO_ALL_INFO;
finfo.all_info.in.file.path = FNAME1;
- printf("Looking for file %s \n",FNAME1);
+ torture_comment(tctx, "Looking for file %s \n",FNAME1);
status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
if (NT_STATUS_EQUAL(status, NT_STATUS_OK)) {
- printf("Name of the file found %s \n", finfo.all_info.out.fname.s);
+ torture_comment(tctx, "Name of the file found %s \n", finfo.all_info.out.fname.s);
if (strcmp(finfo.all_info.out.fname.s, finfo.all_info.in.file.path) == 0) {
/* If file is found with the same case delete it */
- printf("Deleting File %s \n", finfo.all_info.out.fname.s);
+ torture_comment(tctx, "Deleting File %s \n", finfo.all_info.out.fname.s);
io_un.unlink.in.pattern = finfo.all_info.out.fname.s;
io_un.unlink.in.attrib = 0;
status = smb_raw_unlink(cli->tree, &io_un);
finfo.all_info.in.file.path = fname1;
status = smb_raw_pathinfo(cli->tree, tctx, &finfo);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("File name after rename %s \n",finfo.all_info.out.fname.s);
+ torture_comment(tctx, "File name after rename %s \n",finfo.all_info.out.fname.s);
done:
smbcli_close(cli->tree, fnum);
const char *fname2 = BASEDIR "\\test2.txt";
union smb_fileinfo finfo;
- printf("Testing SMBntrename\n");
+ torture_comment(tctx, "Testing SMBntrename\n");
if (!torture_setup_dir(cli, BASEDIR)) {
return false;
}
- printf("Trying simple rename\n");
+ torture_comment(tctx, "Trying simple rename\n");
fnum = create_complex_file(cli, tctx, fname1);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("Trying self rename\n");
+ torture_comment(tctx, "Trying self rename\n");
io.ntrename.in.old_name = fname2;
io.ntrename.in.new_name = fname2;
status = smb_raw_rename(cli->tree, &io);
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
- printf("trying wildcard rename\n");
+ torture_comment(tctx, "trying wildcard rename\n");
io.ntrename.in.old_name = BASEDIR "\\*.txt";
io.ntrename.in.new_name = fname1;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OBJECT_PATH_SYNTAX_BAD);
- printf("Checking attrib handling\n");
+ torture_comment(tctx, "Checking attrib handling\n");
torture_set_file_attribute(cli->tree, fname2, FILE_ATTRIBUTE_HIDDEN);
io.ntrename.in.old_name = fname2;
io.ntrename.in.new_name = fname1;
torture_set_file_attribute(cli->tree, fname1, FILE_ATTRIBUTE_NORMAL);
- printf("Checking hard link\n");
+ torture_comment(tctx, "Checking hard link\n");
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
CHECK_VALUE(finfo.all_info.out.nlink, 1);
CHECK_VALUE(finfo.all_info.out.attrib, FILE_ATTRIBUTE_NORMAL);
- printf("Checking copy\n");
+ torture_comment(tctx, "Checking copy\n");
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(finfo.all_info.out.nlink, 1);
- printf("Checking invalid flags\n");
+ torture_comment(tctx, "Checking invalid flags\n");
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
- printf("Checking unknown field\n");
+ torture_comment(tctx, "Checking unknown field\n");
io.ntrename.in.old_name = fname1;
io.ntrename.in.new_name = fname2;
io.ntrename.in.attrib = 0;
status = smb_raw_rename(cli->tree, &io);
CHECK_STATUS(status, NT_STATUS_OK);
- printf("Trying RENAME_FLAG_MOVE_CLUSTER_INFORMATION\n");
+ torture_comment(tctx, "Trying RENAME_FLAG_MOVE_CLUSTER_INFORMATION\n");
io.ntrename.in.old_name = fname2;
io.ntrename.in.new_name = fname1;
io.ntrename.in.cluster_size = i;
status = smb_raw_rename(cli->tree, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_INVALID_PARAMETER)) {
- printf("i=%d status=%s\n", i, nt_errstr(status));
+ torture_warning(tctx, "i=%d status=%s\n", i, nt_errstr(status));
}
}
#endif
- printf("Checking other flags\n");
+ torture_comment(tctx, "Checking other flags\n");
for (i=0;i<0xFFF;i++) {
if (i == RENAME_FLAG_RENAME ||
io.ntrename.in.cluster_size = 0;
status = smb_raw_rename(cli->tree, &io);
if (!NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
- printf("flags=0x%x status=%s\n", i, nt_errstr(status));
+ torture_warning(tctx, "flags=0x%x status=%s\n", i, nt_errstr(status));
}
}
bool ret = true;
int fnum = -1;
- printf("Checking rename on a directory containing an open file.\n");
+ torture_comment(tctx, "Checking rename on a directory containing an open file.\n");
if (!torture_setup_dir(cli, BASEDIR)) {
return false;