Skip to content

Conversation

@wangchdo
Copy link
Contributor

@wangchdo wangchdo commented Dec 15, 2025

Summary

Add functional tests for the newly added hrtimer APIs,
including hrtimer_init(), hrtimer_start(), and hrtimer_cancel().

Impact

This PR depends on apache/nuttx#17489

Testing

ostest passed on a2g-tc397-5v-tft with hrtimer enalbed

NuttShell (NSH)
nsh>
nsh> uname -a
NuttX 0.0.0 eb9dd8afaf Dec 17 2025 13:34:17 tricore a2g-tc397-5v-tft
nsh>
nsh> ostest


(...)

user_main: hrtimer test

End of test memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       28dfc    28dfc
ordblks         6        6
mxordblk    1f8a8    1f8a8
uordblks     555c     555c
fordblks    238a0    238a0

Final memory usage:
VARIABLE  BEFORE   AFTER
======== ======== ========
arena       28dfc    28dfc
ordblks         1        6
mxordblk    24220    1f8a8
uordblks     4bdc     555c
fordblks    24220    238a0
user_main: Exiting
ostest_main: Exiting with status 0

anchao
anchao previously approved these changes Dec 15, 2025
Copy link
Contributor

@anchao anchao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM!

cederom
cederom previously approved these changes Dec 15, 2025
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wangchdo :-)

This PR should be merged after apache/nuttx#17489.

simbit18
simbit18 previously approved these changes Dec 15, 2025
@wangchdo wangchdo dismissed stale reviews from simbit18, cederom, and anchao via fd72386 December 16, 2025 02:40
@wangchdo
Copy link
Contributor Author

@anchao @cederom @simbit18

tests updated according to updated in apache/nuttx#17489

simbit18
simbit18 previously approved these changes Dec 16, 2025
cederom
cederom previously approved these changes Dec 16, 2025
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wangchdo :-)

linguini1
linguini1 previously approved these changes Dec 16, 2025
@wangchdo
Copy link
Contributor Author

@anchao @cederom @xiaoxiang781216 @linguini1 @simbit18

HRTimer tests have been updated according to @xiaoxiang781216's comments. The improvements include:

  1. Fixed typos.
  2. Enabled the HRTimer tests to run repeatedly.
  3. Added a tolerance margin in the test checks to improve robustness.

The ostest has passed on real hardware (a2g-tc397-5v-tft) for two consecutive runs.

Add functional tests for the newly added hrtimer APIs,
including hrtimer_init(), hrtimer_start(), and hrtimer_cancel().

Signed-off-by: Chengdong Wang <[email protected]>
Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @wangchdo for the great work and @xiaoxiang781216 for valuable remarks! :-)

HRTIMER_TEST(NSEC_PER_500MS > diff - NSEC_MARGIN, true);
}

test->previous = test->now;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change now to local variable


/* Stop the test after 15 expirations */

if (test->count >= 15)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (test->count >= 15)
if (test->count >= 15)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants