-
Notifications
You must be signed in to change notification settings - Fork 162
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
Improve wait sets test coverage. #683
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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.
If this fails, and
rcl_wait
doesn't return will the test just hang?Also, I can tell you've already figured this out, but timer based tests are notoriously unreliable on our Windows build farm, and it would be good to have as few of them as possible. It's not clear to me that TOLERANCE is a requirement of whether this test passes or succeeds. With the efforts of performance testing underway, I think measurements of how long rcl_wait takes to return should be put there.
What's the behavior you're trying to assert on this test?
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.
If wait sets' implementation misbehaves you mean? It may hang, though at that point it's not clear one can trust the given timeout will be honored either. At any rate, the CTest timeout will eventually kick in.
Indeed. Not entirely convinced ignoring them is a good idea though.
The test needs to assert that
rmw_wait()
didn't block, or, actually, that it was requested to not block. Without mocks, we can only resort to this indirect technique.That this snippet has the intended effect.
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.
What sort of event does wait_set wait on here? Can you just ASSERT that the event didn't finish before the function returned? That is, make the event something long but finite, say 1-10 seconds so that wait will return in either case. But it will assert success if the event didn't finish, and failure if it did?
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.
Hmm, not sure I follow. This test is covering the situation in which a timer (and it is that specific because timers are handled with in a special way) is way past its deadline by the time you wait on it for an X amount of time. In which case the function should realize, adjust its internal timeout and return almost immediately. That's what the test is checking. This other test does the same thing for a timer that is on-time.
The scenario you describe is being (indirectly) covered by this test.
We can make that timeout finite. We cannot change the assertion itself though.
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.
Ok, I think I understand better. I still think having a tolerance that is so tight it has to be different on different platforms sort of shows that the final EXPECT_LE is not cleanly deciding which behavior was followed in the code under test. Can you make timeout longer like 1-10 seconds so that it is very obvious whether it returned immediately or not?
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.
And make TOLERANCE correspondingly larger
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.
Hmm, I'm not sure I follow you here. Which timeout do you mean? The timer period is 0, the wait timeout is -1 (block forever). The reason why I believe I may have had to bump up the tolerance for Windows is it's rather large scheduler time slice and the flakyness it introduces.