[PATCH] Replace CHECK_STATUS with torture macros

Anoop C S anoopcs at redhat.com
Thu Oct 29 17:37:32 UTC 2015


On Tue, 2015-10-27 at 17:06 +0100, Michael Adam wrote:
> On 2015-10-27 at 18:43 +0530, Anoop C S wrote:
> > On Tue, 2015-10-27 at 12:00 +0100, Michael Adam wrote:
> > > On 2015-10-27 at 11:54 +0530, Anoop C S wrote:
> > > > On Mon, 2015-10-26 at 11:26 +0100, Michael Adam wrote:
> > > > > Hi Anoop,
> > > > > 
> > > > > The patch looks clean now.
> > > > > But I have one more request:
> > > > > 
> > > > > Just as you split the addition of torture_asserts for
> > > > > the smb2_unlink calls (that had no assert with them
> > > > > before) into a patch of their own, could you do the
> > > > > same with the smb2_util_close calls?
> > > > > I just would like the patch that is called
> > > > > "Replace CHECK_STATUS with torture_assert macros"
> > > > > to do that and not more (adding checks where there
> > > > > were none before). You could do a third patch or
> > > > > add add these hunks to the patch with the unlink part.
> > > > > It is up to you.
> > > > > 
> > > > 
> > > > Attaching 3 patches as per Michael's comments.
> > > 
> > > Thanks!
> > > 
> > > This looks much cleaner now.
> > > 
> > > Just one more remark (sorry..):
> > > 
> > 
> > No problem.
> > 
> > > In the first patch (replacing CHECK_STATUS by torture asserts),
> > > when you are not checking for STATUS_OK, then your messages
> > > 'smb2_foobar failed' are misleading. In those few cases, you
> > > should rather utter a message like 'smb2_foobar gave unexpected
> > > result' or similar..
> > > 
> > > 
> > > Example:
> > > 
> > > > diff --git a/source4/torture/smb2/session.c
> > > > b/source4/torture/smb2/session.c
> > > > index 798230b..92f404c 100644
> > > > --- a/source4/torture/smb2/session.c
> > > > +++ b/source4/torture/smb2/session.c
> > > > @@ -105,7 +98,10 @@ bool test_session_reconnect1(struct
> > > > torture_context *tctx, struct smb2_tree *tre
> > > >  	qfinfo.generic.level =
> > > > RAW_FILEINFO_POSITION_INFORMATION;
> > > >  	qfinfo.generic.in.file.handle = _h1;
> > > >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > > > -	CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
> > > > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > > > +					  
> > > >  NT_STATUS_USER_SESSION_DELETED,
> > > > +					   ret, done,
> > > > +					   "smb2_getinfo_file
> > > > failed");
> > > 
> > > Here failure of smb2_getinfo_file is expected and succes
> > > of the function call would actually be a failure of the test
> > > just any status code other than NT_STATUS_USER_SESSION_DELETED
> > > would be.
> > > 
> > 
> > I have made necessary changes. Please let me know if I am missing
> > some
> > parts.
> 
> This looks good.
> 
> patch #1: reviewed-by me
> patch #3: reviewed-by me
> 
> patch #2: there is one concern:
>   Most of the unlink calls are at the beginning of the test case.
>   The purpose of these calls was to make sure that the file does
>   not exist in the share for the remainder of the test, so we can
>   start from scratch. The file could in theory exist in the share.
> 
>   So I think the omission of asserts/checks was intentional
>   in those cases. So we should possibly better omit them?
> 
>   I spotted at least one unlink in the middle of a test case
>   that validly gets an assert.

Removed all other torture asserts except the one mentioned above.
Reattaching all 3 patches again.

> Cheers - Michael
> 
> > > Cheers - Michael
> 
> > From 327b40dfc8903587289bd885ae0a4ae3facc0fe4 Mon Sep 17 00:00:00
> > 2001
> > From: Anoop C S <anoopcs at redhat.com>
> > Date: Thu, 8 Oct 2015 19:02:06 +0530
> > Subject: [PATCH 1/4] s4.torture.smb2/session : Replace CHECK_STATUS
> > with
> >  torture macros
> > 
> > Signed-off-by: Anoop C S <anoopcs at redhat.com>
> > ---
> >  source4/torture/smb2/session.c | 217 +++++++++++++++++++++++++++--
> > ------------
> >  1 file changed, 145 insertions(+), 72 deletions(-)
> > 
> > diff --git a/source4/torture/smb2/session.c
> > b/source4/torture/smb2/session.c
> > index 798230b..f1d3b7f 100644
> > --- a/source4/torture/smb2/session.c
> > +++ b/source4/torture/smb2/session.c
> > @@ -38,14 +38,6 @@
> >  		ret = false; \
> >  	}} while (0)
> >  
> > -#define CHECK_STATUS(status, correct) do { \
> > -	if (!NT_STATUS_EQUAL(status, correct)) { \
> > -		torture_result(tctx, TORTURE_FAIL, __location__":
> > Incorrect status %s - should be %s", \
> > -		       nt_errstr(status), nt_errstr(correct)); \
> > -		ret = false; \
> > -		goto done; \
> > -	}} while (0)
> > -
> >  #define CHECK_CREATED(__io, __created, __attribute)		
> > 	\
> >  	do {							
> > 	\
> >  		CHECK_VAL((__io)->out.create_action,
> > NTCREATEX_ACTION_ ## __created); \
> > @@ -85,7 +77,8 @@ bool test_session_reconnect1(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -105,7 +98,10 @@ bool test_session_reconnect1(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					  
> >  NT_STATUS_USER_SESSION_DELETED,
> > +					   ret, done,
> > "smb2_getinfo_file "
> > +					   "returned unexpected
> > status");
> >  	h1 = NULL;
> >  
> >  	smb2_oplock_create_share(&io2, fname,
> > @@ -113,7 +109,9 @@ bool test_session_reconnect1(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree2, mem_ctx, &io2);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> > +
> >  	CHECK_CREATED(&io2, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
> >  	CHECK_VAL(io2.out.oplock_level,
> > smb2_util_oplock_level("b"));
> >  	_h2 = io2.out.file.handle;
> > @@ -168,7 +166,8 @@ bool test_session_reconnect2(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  	io1.in.create_options |=
> > NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -187,7 +186,10 @@ bool test_session_reconnect2(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					  
> >  NT_STATUS_USER_SESSION_DELETED,
> > +					   ret, done,
> > "smb2_getinfo_file "
> > +					   "returned unexpected
> > status");
> >  	h1 = NULL;
> >  
> >  done:
> > @@ -225,7 +227,8 @@ bool test_session_reauth1(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -234,7 +237,8 @@ bool test_session_reauth1(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -242,12 +246,14 @@ bool test_session_reauth1(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -255,7 +261,8 @@ bool test_session_reauth1(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  done:
> >  	if (h1 != NULL) {
> > @@ -294,7 +301,8 @@ bool test_session_reauth2(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -308,7 +316,8 @@ bool test_session_reauth2(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   anon_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -316,14 +325,16 @@ bool test_session_reauth2(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	/* re-authenticate as original user again */
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -331,7 +342,8 @@ bool test_session_reauth2(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  done:
> >  	if (h1 != NULL) {
> > @@ -378,7 +390,8 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -393,7 +406,9 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> > +
> >  	/* re-authenticate as anonymous */
> >  
> >  	anon_creds = cli_credentials_init_anon(mem_ctx);
> > @@ -402,7 +417,8 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   anon_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -413,14 +429,16 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	/* re-authenticate as original user again */
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to access the file via the old handle */
> >  
> > @@ -431,7 +449,8 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  done:
> >  	if (h1 != NULL) {
> > @@ -482,7 +501,8 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -497,7 +517,8 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	sd1 = qfinfo.query_secdesc.out.sd;
> >  
> > @@ -509,7 +530,8 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   anon_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* give full access on the file to anonymous */
> >  
> > @@ -522,7 +544,8 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	ace.trustee = *extra_sid;
> >  
> >  	status = security_descriptor_dacl_add(sd1, &ace);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"security_descriptor_dacl_
> > add failed");
> >  
> >  	ZERO_STRUCT(sfinfo);
> >  	sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
> > @@ -531,14 +554,16 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.set_secdesc.in.sd = sd1;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_setinfo_file
> > failed");
> >  
> >  	/* re-authenticate as original user again */
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* re-get the security descriptor */
> >  
> > @@ -549,7 +574,8 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	ret = true;
> >  
> > @@ -607,7 +633,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	CHECK_VAL(ok, true);
> >  
> >  	status = torture_smb2_testdir(tree, dname, &_dh1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"torture_smb2_testdir
> > failed");
> >  	dh1 = &_dh1;
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> > @@ -615,7 +642,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -630,7 +658,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	f_sd1 = qfinfo.query_secdesc.out.sd;
> >  
> > @@ -642,7 +671,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   anon_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to rename the file: fails */
> >  
> > @@ -657,14 +687,18 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.rename_information.in.new_name = fname2;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					  
> >  NT_STATUS_ACCESS_DENIED,
> > +					   ret, done,
> > "smb2_setinfo_file "
> > +					   "returned unexpected
> > status");
> >  
> >  	/* re-authenticate as original user again */
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* give full access on the file to anonymous */
> >  
> > @@ -677,7 +711,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	ace.trustee = *extra_sid;
> >  
> >  	status = security_descriptor_dacl_add(f_sd1, &ace);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"security_descriptor_dacl_
> > add failed");
> >  
> >  	ZERO_STRUCT(sfinfo);
> >  	sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
> > @@ -686,7 +721,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.set_secdesc.in.sd = f_sd1;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_setinfo_file
> > failed");
> >  
> >  	/* re-get the security descriptor */
> >  
> > @@ -697,7 +733,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	/* re-authenticate as anonymous - again */
> >  
> > @@ -707,7 +744,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   anon_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* try to rename the file: fails */
> >  
> > @@ -718,7 +756,10 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.rename_information.in.new_name = fname2;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					  
> >  NT_STATUS_ACCESS_DENIED,
> > +					   ret, done,
> > "smb2_setinfo_file "
> > +					   "returned unexpected
> > status");
> >  
> >  	/* give full access on the parent dir to anonymous */
> >  
> > @@ -729,7 +770,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	d_sd1 = qfinfo.query_secdesc.out.sd;
> >  
> > @@ -740,7 +782,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	ace.trustee = *extra_sid;
> >  
> >  	status = security_descriptor_dacl_add(d_sd1, &ace);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"security_descriptor_dacl_
> > add failed");
> >  
> >  	ZERO_STRUCT(sfinfo);
> >  	sfinfo.set_secdesc.level = RAW_SFILEINFO_SEC_DESC;
> > @@ -750,7 +793,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.set_secdesc.in.sd = d_sd1;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_setinfo_file
> > failed");
> >  
> >  	ZERO_STRUCT(qfinfo);
> >  
> > @@ -759,7 +803,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	smb2_util_close(tree, _dh1);
> >  	dh1 = NULL;
> > @@ -773,14 +818,18 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.rename_information.in.new_name = fname2;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_ACCESS_DENIED,
> > +					ret, done,
> > "smb2_setinfo_file "
> > +					"returned unexpected
> > status");
> >  
> >  	/* re-authenticate as original user - again */
> >  
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* rename the file - for verification that it works */
> >  
> > @@ -791,7 +840,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	sfinfo.rename_information.in.new_name = fname2;
> >  
> >  	status = smb2_setinfo_file(tree, &sfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_setinfo_file
> > failed");
> >  
> >  	/* closs the file, check it is gone and reopen under the
> > new name */
> >  
> > @@ -808,7 +858,10 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				  0 /* leasekey */, 0 /*
> > leasestate */);
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done, "smb2_create "
> > +					"returned unexpected
> > status");
> >  
> >  	ZERO_STRUCT(io1);
> >  
> > @@ -821,7 +874,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				  0 /* leasekey */, 0 /*
> > leasestate */);
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, EXISTED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -836,7 +890,8 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	qfinfo.query_secdesc.in.secinfo_flags = secinfo_flags;
> >  
> >  	status = smb2_getinfo_file(tree, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  done:
> >  	if (dh1 != NULL) {
> > @@ -896,7 +951,8 @@ bool test_session_reauth6(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	io1.in.create_options |=
> > NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -922,7 +978,10 @@ bool test_session_reauth6(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	status = smb2_session_setup_spnego(tree->session,
> >  					   broken_creds,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_LOGON_FAILURE);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_LOGON_FAILURE,
> > ret, done,
> > +					"smb2_session_setup_spnego
> > "
> > +					"returned unexpected
> > status");
> >  
> >  	torture_comment(tctx, "did failed reauth\n");
> >  	/*
> > @@ -940,7 +999,9 @@ bool test_session_reauth6(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree, mem_ctx, &io1);
> > -	CHECK_STATUS(status, expected);
> > +	torture_assert_ntstatus_equal_goto(tctx, status, expected,
> > +					ret, done, "smb2_create "
> > +					"returned unexpected
> > status");
> >  
> >  done:
> >  	if (h1 != NULL) {
> > @@ -1014,7 +1075,8 @@ static bool test_session_expire1(struct
> > torture_context *tctx)
> >  	io1.in.create_options |=
> > NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
> >  
> >  	status = smb2_create(tree, tctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -1032,7 +1094,8 @@ static bool test_session_expire1(struct
> > torture_context *tctx)
> >  
> >  		ZERO_STRUCT(qfinfo.access_information.out);
> >  		status = smb2_getinfo_file(tree, tctx, &qfinfo);
> > -		CHECK_STATUS(status, NT_STATUS_OK);
> > +		torture_assert_ntstatus_ok_goto(tctx, status, ret,
> > done,
> > +						"smb2_getinfo_file
> > failed");
> >  
> >  		torture_comment(tctx, "sleep 5 seconds\n");
> >  		smb_msleep(5*1000);
> > @@ -1040,7 +1103,10 @@ static bool test_session_expire1(struct
> > torture_context *tctx)
> >  		torture_comment(tctx, "query info => EXPIRED\n");
> >  		ZERO_STRUCT(qfinfo.access_information.out);
> >  		status = smb2_getinfo_file(tree, tctx, &qfinfo);
> > -		CHECK_STATUS(status,
> > NT_STATUS_NETWORK_SESSION_EXPIRED);
> > +		torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_NETWORK_SESSION_
> > EXPIRED,
> > +					ret, done,
> > "smb2_getinfo_file "
> > +					"returned unexpected
> > status");
> >  
> >  		/*
> >  		 * the krb5 library may not handle expired creds
> > @@ -1052,12 +1118,14 @@ static bool test_session_expire1(struct
> > torture_context *tctx)
> >  		status = smb2_session_setup_spnego(tree->session,
> >  						   credentials,
> >  						   0 /*
> > previous_session_id */);
> > -		CHECK_STATUS(status, NT_STATUS_OK);
> > +		torture_assert_ntstatus_ok_goto(tctx, status, ret,
> > done,
> > +					"smb2_session_seutup_spneg
> > o failed");
> >  	}
> >  
> >  	ZERO_STRUCT(qfinfo.access_information.out);
> >  	status = smb2_getinfo_file(tree, tctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	ret = true;
> >  done:
> > @@ -1108,7 +1176,8 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  				 smb2_util_oplock_level("b"));
> >  
> >  	status = smb2_create(tree1, mem_ctx, &io1);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_create failed");
> >  	_h1 = io1.out.file.handle;
> >  	h1 = &_h1;
> >  	CHECK_CREATED(&io1, CREATED, FILE_ATTRIBUTE_ARCHIVE);
> > @@ -1143,7 +1212,8 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  	status = smb2_session_setup_spnego(session1_2,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	/* use the 1st connection, 1st session */
> >  	ZERO_STRUCT(qfinfo);
> > @@ -1151,7 +1221,8 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	tree1->session = session1_1;
> >  	status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	/* use the 2nd connection, 1st session */
> >  	ZERO_STRUCT(qfinfo);
> > @@ -1159,7 +1230,8 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  	qfinfo.generic.in.file.handle = _h1;
> >  	tree1->session = session1_2;
> >  	status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_getinfo_file
> > failed");
> >  
> >  	tree1->session = session1_1;
> >  	smb2_util_close(tree1, *h1);
> > @@ -1177,12 +1249,13 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  	status = smb2_session_setup_spnego(session2_1,
> >  					   cmdline_credentials,
> >  					   0 /*
> > previous_session_id */);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_session_setup_spnego
> > failed");
> >  
> >  	tree2->session = session2_1;
> >  	status = smb2_util_unlink(tree2, fname);
> > -	CHECK_STATUS(status, NT_STATUS_OK);
> > -
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_unlink
> > failed");
> >  	ret = true;
> >  done:
> >  	talloc_free(tree2);
> > -- 
> > 2.4.3
> > 
> 
> > From 545f6330b357400e26d14bef13fa6abc7a3085d0 Mon Sep 17 00:00:00
> > 2001
> > From: Anoop C S <anoopcs at redhat.com>
> > Date: Sat, 17 Oct 2015 14:54:12 +0530
> > Subject: [PATCH 2/4] s4.torture.smb2/session: Add torture assert
> > for unlink
> > 
> > Signed-off-by: Anoop C S <anoopcs at redhat.com>
> > ---
> >  source4/torture/smb2/session.c | 56
> > ++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 46 insertions(+), 10 deletions(-)
> > 
> > diff --git a/source4/torture/smb2/session.c
> > b/source4/torture/smb2/session.c
> > index f1d3b7f..d2f4d33 100644
> > --- a/source4/torture/smb2/session.c
> > +++ b/source4/torture/smb2/session.c
> > @@ -70,7 +70,11 @@ bool test_session_reconnect1(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  	snprintf(fname, sizeof(fname), "session_reconnect_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -158,7 +162,11 @@ bool test_session_reconnect2(struct
> > torture_context *tctx, struct smb2_tree *tre
> >  	snprintf(fname, sizeof(fname), "session_reconnect_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -220,7 +228,11 @@ bool test_session_reauth1(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	snprintf(fname, sizeof(fname), "session_reauth1_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -294,7 +306,11 @@ bool test_session_reauth2(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	snprintf(fname, sizeof(fname), "session_reauth2_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -383,7 +399,11 @@ bool test_session_reauth3(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	snprintf(fname, sizeof(fname), "session_reauth3_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -494,7 +514,11 @@ bool test_session_reauth4(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	snprintf(fname, sizeof(fname), "session_reauth4_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -678,7 +702,9 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  
> >  	snprintf(fname2, sizeof(fname2), "%s\\file2.dat", dname);
> >  
> > -	smb2_util_unlink(tree, fname2);
> > +	status = smb2_util_unlink(tree, fname2);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_unlink
> > failed");
> >  
> >  	ZERO_STRUCT(sfinfo);
> >  	sfinfo.rename_information.level =
> > RAW_SFILEINFO_RENAME_INFORMATION;
> > @@ -943,7 +969,11 @@ bool test_session_reauth6(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	snprintf(fname, sizeof(fname), "session_reauth1_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -1067,7 +1097,11 @@ static bool test_session_expire1(struct
> > torture_context *tctx)
> >  	snprintf(fname, sizeof(fname), "session_expire1_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree, fname);
> > +	status = smb2_util_unlink(tree, fname);
> > +	torture_assert_ntstatus_equal_goto(tctx, status,
> > +					NT_STATUS_OBJECT_NAME_NOT_
> > FOUND,
> > +					ret, done,
> > "smb2_util_unlink "
> > +					"returned unexpected
> > status");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > @@ -1169,7 +1203,9 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  	snprintf(fname, sizeof(fname), "session_bind1_%s.dat",
> >  		 generate_random_str(tctx, 8));
> >  
> > -	smb2_util_unlink(tree1, fname);
> > +	status = smb2_util_unlink(tree1, fname);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_unlink
> > failed");
> >  
> >  	smb2_oplock_create_share(&io1, fname,
> >  				 smb2_util_share_access(""),
> > -- 
> > 2.4.3
> > 
> 
> > From 69171fcdc42998aa10c7e50fd6266403cb0b2637 Mon Sep 17 00:00:00
> > 2001
> > From: Anoop C S <anoopcs at redhat.com>
> > Date: Mon, 26 Oct 2015 16:33:11 +0530
> > Subject: [PATCH 3/4] s4.torture.smb2/session: Add torture assert
> > for close
> > 
> > Signed-off-by: Anoop C S <anoopcs at redhat.com>
> > ---
> >  source4/torture/smb2/session.c | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/source4/torture/smb2/session.c
> > b/source4/torture/smb2/session.c
> > index d2f4d33..da09d6d 100644
> > --- a/source4/torture/smb2/session.c
> > +++ b/source4/torture/smb2/session.c
> > @@ -832,7 +832,9 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> >  					"smb2_getinfo_file
> > failed");
> >  
> > -	smb2_util_close(tree, _dh1);
> > +	status = smb2_util_close(tree, _dh1);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_close failed");
> >  	dh1 = NULL;
> >  
> >  	/* try to rename the file: still fails */
> > @@ -871,8 +873,9 @@ bool test_session_reauth5(struct
> > torture_context *tctx, struct smb2_tree *tree)
> >  
> >  	/* closs the file, check it is gone and reopen under the
> > new name */
> >  
> > -	smb2_util_close(tree, _h1);
> > -
> > +	status = smb2_util_close(tree, _h1);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_close failed");
> >  	ZERO_STRUCT(io1);
> >  
> >  	smb2_generic_create_share(&io1,
> > @@ -1270,7 +1273,9 @@ bool test_session_bind1(struct
> > torture_context *tctx, struct smb2_tree *tree1)
> >  					"smb2_getinfo_file
> > failed");
> >  
> >  	tree1->session = session1_1;
> > -	smb2_util_close(tree1, *h1);
> > +	status = smb2_util_close(tree1, *h1);
> > +	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
> > +					"smb2_util_close failed");
> >  	h1 = NULL;
> >  
> >  	/*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-s4.torture.smb2-session-Replace-CHECK_STATUS-with-to.patch
Type: text/x-patch
Size: 26166 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151029/6a7036c9/0001-s4.torture.smb2-session-Replace-CHECK_STATUS-with-to.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-s4.torture.smb2-session-Add-torture-assert-for-unlin.patch
Type: text/x-patch
Size: 988 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151029/6a7036c9/0002-s4.torture.smb2-session-Add-torture-assert-for-unlin.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-s4.torture.smb2-session-Add-torture-assert-for-close.patch
Type: text/x-patch
Size: 1730 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20151029/6a7036c9/0003-s4.torture.smb2-session-Add-torture-assert-for-close.bin>


More information about the samba-technical mailing list