[PATCH v10] tests/fcntl.c: add test for print_f_owner_ex

Dmitry V. Levin ldv at altlinux.org
Wed May 2 23:05:33 UTC 2018


On Wed, May 02, 2018 at 11:16:57PM +0800, Zhibin Li wrote:
> *tests/fcntl.c (test_f_owner_ex_type_pid,

There has to be a space between * and the file name.

> test_f_owner_ex_umove_or_printaddr, test_f_owner_ex): New functions.
> (main): Use test_f_owner_ex.
> ---
>  tests/fcntl.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/tests/fcntl.c b/tests/fcntl.c
> index 4f62ca2a..504464e0 100644
> --- a/tests/fcntl.c
> +++ b/tests/fcntl.c
> @@ -69,12 +69,65 @@ test_flock64(void)
>  #endif
>  }
>  
> +static long
> +test_f_owner_ex_type_pid(const int cmd, const char *const cmd_name,
> +			 const int type, const char *const type_name,
> +			 pid_t pid)
> +{
> +	TAIL_ALLOC_OBJECT_CONST_PTR(struct f_owner_ex, fo);
> +
> +	fo->type = type;
> +	fo->pid = pid;
> +	long rc = invoke_test_syscall(cmd, fo);
> +	printf("%s(0, %s, {type=%s, pid=%d}) = %s\n",
> +	       TEST_SYSCALL_STR, cmd_name, type_name, fo->pid, sprintrc(rc));
> +
> +	void *bad_addr = (void *)fo + 1;
> +	long rc_efault = invoke_test_syscall(cmd, bad_addr);
> +	printf("%s(0, %s, %p) = %s\n",
> +	       TEST_SYSCALL_STR, cmd_name, bad_addr, sprintrc(rc_efault));
> +	printf("%p\n", fo);

Sorry, but have you tested this code?
The last printf seems to be out of place here.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180503/689b2d53/attachment.bin>


More information about the Strace-devel mailing list