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 d33830e83fe99fc56e5a53642196a1d9e45ef702 Author: ouyangxiangzhen <[email protected]> AuthorDate: Mon Feb 2 16:17:22 2026 +0800 ostest/hrtimer: Increase the tolerent latency. For QEMU, virtual CPUs can be preempted by any high priority thread in test environments. This can cause the timer to be triggered later than expected. This commit increased the tolerant latency to avoid the test failures. Signed-off-by: ouyangxiangzhen <[email protected]> --- testing/ostest/hrtimer.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/testing/ostest/hrtimer.c b/testing/ostest/hrtimer.c index eedd53b86..3cf847eb3 100644 --- a/testing/ostest/hrtimer.c +++ b/testing/ostest/hrtimer.c @@ -45,18 +45,22 @@ #define HRTIMER_THREAD_LOOP_NR 50 #define HRTIMER_TEST_THREAD_NR (CONFIG_SMP_NCPUS * 5) -/* Set a 1ms latency to allow hrtimertest to pass in QEMU. +/* Set the tolerent latency to 10ms to allow hrtimer_test to pass + * in QEMU. * - * QEMU is a virtual platform, and its timer resolution and scheduling - * latency may be less precise than on real hardware. Using a larger - * latency ensures that tests do not fail due to timing inaccuracies. + * QEMU is a virtual platform, vCPUs can be preempted by any + * high priority thread. This can cause the timer to be triggered + * later than expected. This is especially true on QEMU because it + * has a lot of overhead. The timer resolution is also less precise + * than on real hardware. Using a larger latency ensures that tests + * do not fail due to timing inaccuracies. * * On real hardware (verified on the a2g-tc397-5v-tft board), this * latency can be reduced to less than 5 ns because timers are precise * and deterministic. */ -#define HRTIMER_TEST_TOLERENT_LATENCY (NSEC_PER_MSEC) +#define HRTIMER_TEST_TOLERENT_LATENCY (10 * NSEC_PER_MSEC) /**************************************************************************** * Private Types
