[PATCH v10] tests/fcntl.c: add test for print_f_owner_ex
Zhibin Li
08826794brmt at gmail.com
Thu May 3 00:13:46 UTC 2018
I've heard about a way to test one's own code before sending duplicate
patches: git send-email to your own mailbox and then try to apply the patch
to see if it is ok. Do you think I should do that every time? Is it done by
using mutt? Anyway, it seems a careful and experienced man will not send
useless patches like me.
On Thu, May 3, 2018, 07:57 Zhibin Li <08826794brmt at gmail.com> wrote:
> Oh, please accept my apology, I was trying to print out the address to
> understand what (void *)fo+1 without uintptr_t is really doing but I was a
> little sleepy last night and I forgot to remove the stupid code. I have say
> you are so patience and I'm really sorry.
>
> On Thu, May 3, 2018, 07:05 Dmitry V. Levin <ldv at altlinux.org> wrote:
>
>> 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 --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180503/b3093bdf/attachment.html>
More information about the Strace-devel
mailing list