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

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

commit ae7a0d81e9f4e1804b11116ea05adab73e5118bd
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Thu Jul 10 11:05:42 2025 +0800

    testing/drivers: Fix posix timer assertions.
    
    On QEMU, if vcpus are preempted by other threads, the deviation of the
    timer might be very large, causing assertion failure. This commit
    addressed the problem.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 testing/drivers/drivertest/drivertest_posix_timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/testing/drivers/drivertest/drivertest_posix_timer.c 
b/testing/drivers/drivertest/drivertest_posix_timer.c
index 0870484cf..a9db327b8 100644
--- a/testing/drivers/drivertest/drivertest_posix_timer.c
+++ b/testing/drivers/drivertest/drivertest_posix_timer.c
@@ -161,7 +161,8 @@ static void posix_timer_callback(union sigval arg)
 
   syslog(0, "range: %d ms\n", range);
 
-  assert(range >= sigev_para->it.it_interval.tv_sec * 1000);
+  assert(range >= sigev_para->it.it_interval.tv_sec * 1000 -
+                  sigev_para->deviation);
 
   syslog(LOG_DEBUG, "callback trigger!!!\n");
   (*sigev_para).tim = get_timestamp();

Reply via email to