This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 35cdcc9a8 testing/ltp: Skip the CPU-time tests without the CPU-time 
clocks.
35cdcc9a8 is described below

commit 35cdcc9a850c7d41f6ff80bde3799f3a17cde4c8
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 30 08:11:05 2026 +0100

    testing/ltp: Skip the CPU-time tests without the CPU-time clocks.
    
    NuttX has the CPU-time clocks (CLOCK_PROCESS_CPUTIME_ID and
    CLOCK_THREAD_CPUTIME_ID) only with the run-time accounting of the
    critical section monitor (CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD >= 0).
    Without it, <unistd.h> defines _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME
    as -1 (apache/nuttx#21146), and the LTP tests of these options print
    "unsupported" or "not supported" instead of a result.  Do not build them 
then, as for the
    other options that a configuration does not have.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 testing/ltp/CMakeLists.txt | 7 +++++++
 testing/ltp/Makefile       | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/testing/ltp/CMakeLists.txt b/testing/ltp/CMakeLists.txt
index c3a82f1b8..758ef8024 100644
--- a/testing/ltp/CMakeLists.txt
+++ b/testing/ltp/CMakeLists.txt
@@ -270,6 +270,13 @@ if(CONFIG_TESTING_LTP)
       list(APPEND BLACKWORDS "shmget" "shmat")
     endif()
 
+    # The CPU-time clocks need the run-time accounting of the critical section
+    # monitor.  Without it, _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME are -1.
+
+    if(NOT CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD GREATER_EQUAL 0)
+      list(APPEND BLACKWORDS "_POSIX_CPUTIME" "_POSIX_THREAD_CPUTIME")
+    endif()
+
     file(GLOB_RECURSE LTP_ORIGS ${TESTDIR}/*.c)
 
     if(LTP_ORIGS)
diff --git a/testing/ltp/Makefile b/testing/ltp/Makefile
index 9a2513336..6b60ce60f 100644
--- a/testing/ltp/Makefile
+++ b/testing/ltp/Makefile
@@ -193,6 +193,14 @@ BLACKWORDS += shmget
 BLACKWORDS += shmat
 endif
 
+# The CPU-time clocks need the run-time accounting of the critical section
+# monitor.  Without it, _POSIX_CPUTIME and _POSIX_THREAD_CPUTIME are -1.
+
+ifneq ($(shell expr $(CONFIG_SCHED_CRITMONITOR_MAXTIME_THREAD) \>= 0 
2>/dev/null),1)
+BLACKWORDS += _POSIX_CPUTIME
+BLACKWORDS += _POSIX_THREAD_CPUTIME
+endif
+
 MAINWORDS += "main("
 
 LTP_ORIGS := $(shell find $(TESTDIR) -name *.c)

Reply via email to