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 7fb71aa57a8f6d6ebcb1429c77a441fcc0537986
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 13eb4425a..65b95ee24 100644
--- a/testing/drivers/drivertest/drivertest_posix_timer.c
+++ b/testing/drivers/drivertest/drivertest_posix_timer.c
@@ -164,7 +164,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).trigger_count++;

Reply via email to