[PATCH 11/12] torture: add locking tests for copychunk

Jelmer Vernooij jelmer at samba.org
Wed Nov 7 17:44:06 MST 2012


On Thu, 2012-11-08 at 01:19 +0100, David Disseldorp wrote:
> ---
>  selftest/knownfail           |    2 +
>  source4/torture/smb2/ioctl.c |  200 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 202 insertions(+)
> 
> diff --git a/selftest/knownfail b/selftest/knownfail
> index 8930baf..5c4ae5c 100644
> --- a/selftest/knownfail
> +++ b/selftest/knownfail
> @@ -188,6 +188,8 @@
>  ^samba4.smb2.ioctl.copy_chunk_overwrite\(dc\)	# not supported by s4 ntvfs server
>  ^samba4.smb2.ioctl.copy_chunk_append\(dc\)	# not supported by s4 ntvfs server
>  ^samba4.smb2.ioctl.copy_chunk_limits\(dc\)	# not supported by s4 ntvfs server
> +^samba4.smb2.ioctl.copy_chunk_src_lock\(dc\)	# not supported by s4 ntvfs server
> +^samba4.smb2.ioctl.copy_chunk_dest_lock\(dc\)	# not supported by s4 ntvfs server
>  ^samba3.smb2.dir.one
>  ^samba3.smb2.dir.modify
>  ^samba3.smb2.lease.request
> diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
> index ae727f0..6565be5 100644
> --- a/source4/torture/smb2/ioctl.c
> +++ b/source4/torture/smb2/ioctl.c
> @@ -632,6 +632,202 @@ static bool test_ioctl_copy_chunk_limits(struct torture_context *torture,
>  	return true;
>  }
>  
> +static bool test_ioctl_copy_chunk_src_lck(struct torture_context *torture,
> +					  struct smb2_tree *tree)
> +{
> +	struct smb2_handle src_h;
> +	struct smb2_handle src_h2;
> +	struct smb2_handle dest_h;
> +	NTSTATUS status;
> +	union smb_ioctl ioctl;
> +	TALLOC_CTX *tmp_ctx = talloc_new(tree);
> +	struct srv_copychunk_copy cc_copy;
> +	struct srv_copychunk_rsp cc_rsp;
> +	enum ndr_err_code ndr_ret;
> +	bool ok;
> +	struct smb2_lock lck;
> +	struct smb2_lock_element el[1];
> +
> +	ok = test_setup_copy_chunk(torture, tree, tmp_ctx,
> +				   1, /* chunks */
> +				   &src_h, 4096, /* src file */
> +				   &dest_h, 0,	/* dest file */
> +				   &cc_copy,
> +				   &ioctl);
> +	if (!ok) {
> +		return false;
> +	}
You probably want to indicate a failure here, either by calling the
torture_fail() convenience macro or torture_result(), for which it is a
wrapper.

Without this, the testsuite will report the test result as error rather
than failure and without a specific reason.

Cheers,

Jelmer



More information about the samba-technical mailing list