This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add test for pthread_setname_np and pthread_getname_np.
- From: Adhemerval Zanella <azanella at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Cc: "Carlos O'Donell" <carlos at redhat dot com>
- Date: Mon, 16 Dec 2013 11:35:53 -0200
- Subject: Re: [PATCH] Add test for pthread_setname_np and pthread_getname_np.
- Authentication-results: sourceware.org; auth=none
- References: <52A6AF89 dot 6040903 at redhat dot com> <1386689266 dot 23049 dot 3227 dot camel at triegel dot csb> <52A94EAC dot 5020800 at redhat dot com> <52A957D3 dot 5090809 at redhat dot com>
On 12-12-2013 04:29, Carlos O'Donell wrote:
> On 12/12/2013 12:50 AM, Carlos O'Donell wrote:
>> On 12/10/2013 10:27 AM, Torvald Riegel wrote:
>>> On Tue, 2013-12-10 at 01:07 -0500, Carlos O'Donell wrote:
>>>> I've had this kicking around since Ondrej added the manual
>>>> entry for these functions and we all agreed that they should
>>>> do nothing with NULL input.
>>>>
>>>> This adds 4 test for pthread_setname_np and pthread_getname_np.
>>>>
>>>> Test 1: Get the name of the task via pthread_getname_np and /proc
>>>> and verify that they both match.
>>>>
>>>> Test 2: Test setting the name and then independently verify it
>>>> was set via /proc.
>>>>
>>>> Test 3: Test setting a name that is one-byte too big and fails
>>>> with the correct error return *and* that the process
>>>> name is not modified.
>>>>
>>>> Test 4: Verify that setting the longest name works.
>>>>
>>>> Tested on x86-64 with no regressions.
>>>>
>>>> [carlos@koi glibc]$ cat nptl/tst-setgetname.out
>>>> PASS: Test 1 - pthread_getname_np and /proc agree.
>>>> PASS: Test 2 - Value used in pthread_setname_np and /proc agree.
>>>> PASS: Test 3 - pthread_setname_np returned ERANGE for a process name that was too long.
>>>> PASS: Test 3 - Original name unchanged after pthread_setname_np returned ERANGE.
>>>> PASS: Test 4 - Longest name set via pthread_setname_np agrees with /proc.
>>>>
>>>> OK to checkin?
>>> Looks good to me.
>> Thanks, I've checked this in.
>>
>> Cheers,
>> Carlos.
>>
> Final version with two more tests is what I checked in:
>
> * Check that calling pthread_getname_np with small buffer results in ERANGE
> and buffer remains unmodified.
>
> * Check that you can read back the longest name correctly.
>
> 2013-12-09 Carlos O'Donell <carlos@redhat.com>
>
> * sysdeps/unix/sysv/linux/tst-setgetname.c: New file.
> * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-setgetname.
>
>
Hi Carlos,
The /proc/pid/tasks/tid/comm was added in linux 2.6.33 (commit 4614a696bd1c3a9af3a08f0e5874830a85b889d4)
and current tests are failing in order kernels. Should we keep it failing or add check for if errno
is ENOENT (for get_self_comm return) to skip the tests?