casaroli opened a new pull request, #3944:
URL: https://github.com/apache/nuttx-apps/pull/3944

   ## Summary
   
   NuttX has the CPU-time clocks (`CLOCK_PROCESS_CPUTIME_ID`, 
`CLOCK_THREAD_CPUTIME_ID`) only with the run-time accounting of the critical 
section monitor (`CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0`). Without it, 
`clock_gettime()` of these clocks fails with `EINVAL`, and apache/nuttx#21146 
makes `<unistd.h>` say so: `_POSIX_CPUTIME` and `_POSIX_THREAD_CPUTIME` become 
-1.
   
   The LTP tests of these options then print "unsupported" instead of a result. 
This PR does not build them when the configuration has no CPU-time clocks, as 
`testing/ltp` already does for the other options that a configuration does not 
have (`FS_AIO`, `PTHREAD_SPINLOCKS`, `FS_NAMED_SEMAPHORES` ...). Make and CMake.
   
   ## Impact
   
   Only `testing/ltp`. Without `CONFIG_SCHED_CRITMONITOR` (or with 
`CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD` < 0), the LTP 20230516 tests that use 
these options are not built: `clock_getcpuclockid` 1-1, 1-2, 2-1, 5-1, 6-1; 
`clock_getres` 7-1, 8-1; `clock_gettime` 4-1; `fork` 22-1; 
`pthread_condattr_setclock` 1-3; `pthread_create` 11-1; `timer_create` 10-1, 
11-1. With the CPU-time clocks they are built as before. Make and CMake.
   
   ## Testing
   
   `qemu-armv8a:nsh` (flat) with `CONFIG_TESTING_LTP` and `CONFIG_LIBC_LOCALE`, 
on nuttx with apache/nuttx#21146, Make and CMake (the same lists):
   
   | Build | LTP programs |
   |---|---|
   | apps master, no CRITMONITOR | 822 |
   | this PR, no CRITMONITOR | 811: the 11 CPU-time tests of the list above 
that this configuration builds are gone (5-1 and fork 22-1 are not built here 
anyway: `setuid`, `fork`), no other change |
   | this PR, `CONFIG_SCHED_CRITMONITOR=y` (`MAXTIME_THREAD=0`) | 822, the same 
list as apps master |
   
   The condition, checked with `make` and `cmake -P`: 
`CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD` unset or -1 skips the tests, 0, 5 and 
100 build them. No "expr" message in the build logs.
   
   Run with CRITMONITOR (QEMU, HVF): `clock_getcpuclockid` 6-1, 1-1, 1-2, 2-1, 
`clock_gettime` 4-1, `clock_getres` 7-1, 8-1, `pthread_condattr_setclock` 1-3: 
PASS. (`timer_create` 10-1, 11-1 and `pthread_create` 11-1 end with EINVAL: 
NuttX's `timer_create()` and `setitimer()` do not take the CPU-time clocks yet, 
as on master.)
   
   `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to