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

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

commit 1c0281be1520ff33e90264866798964914f0f35f
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Thu Jan 29 16:13:52 2026 +0800

    sched/hrtimer: relocate the hrtimer test to simplify.
    
    This commit relocated the hrtimer test to simplify the code.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 testing/ostest/CMakeLists.txt |  7 +++----
 testing/ostest/Makefile       | 10 ++++------
 testing/ostest/ostest.h       | 10 ++++++----
 testing/ostest/ostest_main.c  | 16 ++++++++--------
 4 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/testing/ostest/CMakeLists.txt b/testing/ostest/CMakeLists.txt
index 6096c7ce6..fba7f4c47 100644
--- a/testing/ostest/CMakeLists.txt
+++ b/testing/ostest/CMakeLists.txt
@@ -157,16 +157,15 @@ if(CONFIG_TESTING_OSTEST)
     list(APPEND SRCS nxevent.c)
   endif()
 
-  if(CONFIG_HRTIMER AND CONFIG_BUILD_FLAT)
-    list(APPEND SRCS hrtimer.c)
-  endif()
-
   if(CONFIG_ARCH_HAVE_PERF_EVENTS)
     list(APPEND SRCS perf_gettime.c)
   endif()
 
   if(CONFIG_BUILD_FLAT)
     list(APPEND SRCS wdog.c spinlock.c)
+    if(CONFIG_HRTIMER)
+      list(APPEND SRCS hrtimer.c)
+    endif()
   endif()
 
   set(OSTEST_SRCS ostest_main.c ${SRCS})
diff --git a/testing/ostest/Makefile b/testing/ostest/Makefile
index 1f6a28b2f..6fc3a7b76 100644
--- a/testing/ostest/Makefile
+++ b/testing/ostest/Makefile
@@ -160,18 +160,16 @@ CSRCS += nxevent.c
 endif
 endif
 
-ifeq ($(CONFIG_HRTIMER),y)
-ifeq ($(CONFIG_BUILD_FLAT),y)
-CSRCS += hrtimer.c
-endif
-endif
-
 ifeq ($(CONFIG_ARCH_HAVE_PERF_EVENTS),y)
 CSRCS += perf_gettime.c
 endif
 
 ifeq ($(CONFIG_BUILD_FLAT),y)
 CSRCS += wdog.c spinlock.c
+
+ifeq ($(CONFIG_HRTIMER),y)
+CSRCS += hrtimer.c
+endif
 endif
 
 include $(APPDIR)/Application.mk
diff --git a/testing/ostest/ostest.h b/testing/ostest/ostest.h
index f4f09ca8b..0fb2b8d31 100644
--- a/testing/ostest/ostest.h
+++ b/testing/ostest/ostest.h
@@ -215,6 +215,12 @@ void suspend_test(void);
 
 void wdog_test(void);
 
+/* hrtimer.c ****************************************************************/
+
+#ifdef CONFIG_HRTIMER
+void hrtimer_test(void);
+#endif
+
 /* posixtimers.c ************************************************************/
 
 void timer_test(void);
@@ -314,8 +320,4 @@ int sem_nfreeholders(void);
 void nxevent_test(void);
 #endif
 
-#if defined(CONFIG_HRTIMER) && defined(CONFIG_BUILD_FLAT)
-void hrtimer_test(void);
-#endif
-
 #endif /* __APPS_TESTING_OSTEST_OSTEST_H */
diff --git a/testing/ostest/ostest_main.c b/testing/ostest/ostest_main.c
index c711a8db6..89022b4bc 100644
--- a/testing/ostest/ostest_main.c
+++ b/testing/ostest/ostest_main.c
@@ -555,6 +555,14 @@ static int user_main(int argc, char *argv[])
       printf("\nuser_main: wdog test\n");
       wdog_test();
       check_test_memory_usage();
+
+      /* Verify hrtimer */
+
+#  ifdef CONFIG_HRTIMER
+      printf("\nuser_main: hrtimer test\n");
+      hrtimer_test();
+      check_test_memory_usage();
+#  endif
 #endif
 
 #if !defined(CONFIG_DISABLE_POSIX_TIMERS) && \
@@ -643,14 +651,6 @@ static int user_main(int argc, char *argv[])
       check_test_memory_usage();
 #endif
 
-#if defined(CONFIG_HRTIMER) && defined(CONFIG_BUILD_FLAT)
-      /* Verify hrtimer */
-
-      printf("\nuser_main: hrtimer test\n");
-      hrtimer_test();
-      check_test_memory_usage();
-#endif
-
       /* Compare memory usage at time ostest_main started until
        * user_main exits.  These should not be identical, but should
        * be similar enough that we can detect any serious OS memory

Reply via email to