ostest/hrtimer: Refactor hrtimer test.#3414
Merged
linguini1 merged 9 commits intoapache:masterfrom Feb 26, 2026
Merged
Conversation
This commit added missing assert.h. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit removed HRTIMER_TEST to simplify the code. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit simplified the hrtimer test. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit fixed the hrtimer test. In a QEMU environment, the hrtimer latency can be arbitrary because vCPUs can be preempted. We can not assert the latency. we can only issue alerts for excessively high latency. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
d030c6b to
9f8a3e6
Compare
This commit relocated the hrtimer test to simplify the code. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit improved the code readability. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
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 <ouyangxiangzhen@xiaomi.com>
This commit refactored the hrtimer_test and provided significantly improved test-cases for both SMP and non-SMP. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit updated the comments. Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
9f8a3e6 to
d9ed169
Compare
xiaoxiang781216
approved these changes
Feb 25, 2026
linguini1
previously requested changes
Feb 25, 2026
Contributor
linguini1
left a comment
There was a problem hiding this comment.
Could you please attach the ostest log from your test?
jerpelea
approved these changes
Feb 26, 2026
cederom
approved these changes
Feb 26, 2026
Contributor
cederom
left a comment
There was a problem hiding this comment.
Thank you @Fix-Point :-)
linguini1
approved these changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The HRTimer test in
ostesthas been significantly refactored and enhanced to provide comprehensive coverage of high-resolution timer functionality. The previous test was limited in scope and could fail on virtual platforms (e.g., QEMU) due to timing inaccuracies caused by vCPU preemption.Key improvements include:
ASSERT().CONFIG_BUILD_FLATconditional to align with other flat-mode tests, ensuring it is only built when appropriate.These changes ensure the HRTimer subsystem is thoroughly validated across different hardware and virtual environments, with clear diagnostics for timing anomalies.
Impact
ostesttest suite. Developers running the OS test will now see more extensive HRTimer validation.CONFIG_BUILD_FLAT(alongsideCONFIG_HRTIMER). This may affect builds that previously included the test in non-flat configurations, but such configurations are uncommon.ASSERT()instead of a custom macro; any external scripts relying on the old test output may need adjustment, but the overall test structure remains compatible with the OS test harness.Testing
Tested on
rv-virt:smp, ostest passed.