-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workaround random test_suite_platform
fail in time test
#7419
Merged
gilles-peskine-arm
merged 8 commits into
Mbed-TLS:development
from
yuhaoth:test/random-time-test-fail
Apr 28, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fce8577
try to reproduce random assert fail
yuhaoth c9c3e62
workaround the assert fail with tollerance
yuhaoth 2f1e85f
fix comments issues
yuhaoth 4852bb8
remove time delay tests
yuhaoth d1190a5
Update comments and remove delay seconds test
yuhaoth ed9b9a7
Add warning to reserve the reason
yuhaoth d3c7d53
Improve comments about the time_delay test.
yuhaoth ad2091d
fix grammar issues
yuhaoth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,3 @@ time_get_seconds: | |
|
||
Time: delay milliseconds | ||
time_delay_milliseconds:1000 | ||
|
||
Time: delay seconds | ||
time_delay_seconds:1 |
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need these tests?
Historically, we had somewhat similar tests in the
timing
module. They often failed on the CI and so we ended up removing them. I fear that we've reintroduced the problem, and this pull request is just one of many.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
Should I remove these tests here? Or another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delay test were removed.
I think we should keep
*get
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Completely removing the tests may be too much. How about keeping the calls to the functions (so at least we know they don't e.g. crash), but not testing delays?
Possibly even check that
t1 = ms_time(); sleep(small); t2 = ms_time(); ASSERT(t2 > t1)
. @yuhaoth Can you clarifyWhat can cause a negative elapsed time difference? E.g. Can this happen from automatic drift adjustment? I would have expected that
t2 - t1
might be less thansmall
, but not negative.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It happens only in
time_delay_seconds
because time source are different. Built-inmbedtls_time
was defined as standard time function, the time source isCLOCK_REALTIME
. And nanosleep takeCLOCK_MONOTONIC
as time source.If CLOCK_MONOTONIC is faster than CLOCK_REALTIME and CLOCK_REALTIME was adjusted during sleep, sometime
t2 - t1 < small
happens.And I think
time_delay_milliseconds
should not be removed now :) . It use same time source.This check can not resolve the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just update the comments. But I did not mention
automatic drift adjustment
. I think that's enough.And I revert last commit without
Time: delay seconds
test