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

Florian Weimer fweimer@redhat.com
Fri Nov 22 15:14:01 GMT 2024


* 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.

Florian



More information about the Libc-alpha mailing list