[PATCH v3] nptl: Add smoke test for pthread_getcpuclockid failure

Siddhesh Poyarekar siddhesh@sourceware.org
Fri Nov 22 15:26:11 GMT 2024


On 2024-11-22 10:14, Florian Weimer wrote:
> * Florian Weimer:
> 
>> * Siddhesh Poyarekar:
>>
>>> Exercise the invalid thread descriptor case to ensure full test
>>> coverage for the function.
>>
>> Commit message should say exited thread, not invalid thread descriptor,
>> I think.
>>
>>> +int
>>> +do_test (void)
>>> +{
>>> +  clockid_t c;
>>> +  pthread_t t = xpthread_create (NULL, thr, NULL);
>>> +
>>> +  while (pthread_getcpuclockid (t, &c) != ESRCH);
>>> +
>>> +  return 0;
>>> +}
>>
>> Please loop until the return value is non zero and then check the error
>> code against ESRCH with TEST_COMPARE.  And join the thread afterwards
>> using xpthread_join.
> 
> … and maybe use sched_yield in the loop.

Thanks, done, sent v4 with all changes suggested.

Sid


More information about the Libc-alpha mailing list