From 01774d65c28facb0721978fd10391acd15b0dc1d Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Tue, 28 Feb 2012 14:19:49 +0100 Subject: s4:torture: avoid reporting error on failure of smb2.getinfo test Signed-off-by: Stefan Metzmacher --- source4/torture/smb2/getinfo.c | 86 ++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 54 deletions(-) diff --git a/source4/torture/smb2/getinfo.c b/source4/torture/smb2/getinfo.c index 166c3f694f..2e3019031f 100644 --- a/source4/torture/smb2/getinfo.c +++ b/source4/torture/smb2/getinfo.c @@ -84,16 +84,12 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree int i; status = torture_smb2_testfile(tree, FNAME, &hfile); - if (!NT_STATUS_IS_OK(status)) { - printf(__location__ " Unable to create test file '%s' - %s\n", FNAME, nt_errstr(status)); - goto failed; - } + torture_assert_ntstatus_ok(tctx, status, "Unable to create test file " + FNAME "\n"); status = torture_smb2_testdir(tree, DNAME, &hdir); - if (!NT_STATUS_IS_OK(status)) { - printf(__location__ " Unable to create test directory '%s' - %s\n", DNAME, nt_errstr(status)); - goto failed; - } + torture_assert_ntstatus_ok(tctx, status, "Unable to create test dir " + DNAME "\n"); printf("Testing file info levels\n"); torture_smb2_all_info(tree, hfile); @@ -105,40 +101,33 @@ static bool torture_smb2_fileinfo(struct torture_context *tctx, struct smb2_tree file_levels[i].dinfo.query_secdesc.in.secinfo_flags = 0x7; } if (file_levels[i].level == RAW_FILEINFO_SMB2_ALL_EAS) { - file_levels[i].finfo.all_eas.in.continue_flags = + file_levels[i].finfo.all_eas.in.continue_flags = SMB2_CONTINUE_FLAG_RESTART; - file_levels[i].dinfo.all_eas.in.continue_flags = + file_levels[i].dinfo.all_eas.in.continue_flags = SMB2_CONTINUE_FLAG_RESTART; } file_levels[i].finfo.generic.level = file_levels[i].level; file_levels[i].finfo.generic.in.file.handle = hfile; file_levels[i].fstatus = smb2_getinfo_file(tree, tree, &file_levels[i].finfo); - if (!NT_STATUS_IS_OK(file_levels[i].fstatus)) { - printf("(%s) %s failed on file - %s\n", __location__, - file_levels[i].name, nt_errstr(file_levels[i].fstatus)); - goto failed; - } + torture_assert_ntstatus_ok(tctx, file_levels[i].fstatus, + talloc_asprintf(tctx, "%s on file", + file_levels[i].name)); file_levels[i].dinfo.generic.level = file_levels[i].level; file_levels[i].dinfo.generic.in.file.handle = hdir; file_levels[i].dstatus = smb2_getinfo_file(tree, tree, &file_levels[i].dinfo); - if (!NT_STATUS_IS_OK(file_levels[i].dstatus)) { - printf("(%s) %s failed on dir - %s\n", __location__, - file_levels[i].name, nt_errstr(file_levels[i].dstatus)); - goto failed; - } + torture_assert_ntstatus_ok(tctx, file_levels[i].dstatus, + talloc_asprintf(tctx, "%s on dir", + file_levels[i].name)); } return true; - -failed: - return false; } /* test fsinfo levels */ -static bool torture_smb2_fsinfo(struct smb2_tree *tree) +static bool torture_smb2_fsinfo(struct torture_context *tctx, struct smb2_tree *tree) { int i; NTSTATUS status; @@ -146,19 +135,14 @@ static bool torture_smb2_fsinfo(struct smb2_tree *tree) printf("Testing fsinfo levels\n"); status = smb2_util_roothandle(tree, &handle); - if (!NT_STATUS_IS_OK(status)) { - printf(__location__ " Unable to create root handle - %s\n", nt_errstr(status)); - return false; - } + torture_assert_ntstatus_ok(tctx, status, "Unable to create root handle"); for (i=0;i