-
Notifications
You must be signed in to change notification settings - Fork 4.9k
fixes in playback test #14040
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
fixes in playback test #14040
Conversation
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.
Pull Request Overview
This PR addresses fixes in the playback test to improve iteration handling and status verification during a stress test run. Key changes include replacing a hard-coded iteration count with the variable number_of_iterations and updating the status verification mechanism from a blocking wait to a timed sleep plus explicit status checking.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
unit-tests/live/rec-play/test-playback-stress.py | Refactored iteration count and status check logic in playback test |
unit-tests/live/rec-play/playback_helper.py | Added collection of playback statuses for more detailed verification |
# We allow 10 seconds to each iteration to verify the playback_stopped event. | ||
psv.wait_for_status( 10, rs.playback_status.stopped ) | ||
time.sleep(10) | ||
|
||
statuses = psv.get_statuses() |
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.
Using a fixed sleep time may lead to nondeterministic test behavior if the playback status update is delayed. Consider using a more robust status waiting mechanism.
Copilot uses AI. Check for mistakes.
# We allow 10 seconds to each iteration to verify the playback_stopped event. | ||
psv.wait_for_status( 10, rs.playback_status.stopped ) | ||
time.sleep(10) |
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.
Before this change we waited 15 sec between starting the sensor and stopping it.
Now it's 10 sec, will we finish the playback in 10 seconds?
You still check the status is stop and than start,
Can you explain the change and what does it try to solve?
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 you think the start status override the stop before we managed to check it?
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.
- look at the updated code.
- the clip we run is very short (64 frames). It may happen that playback is stopped very fast after start so 'stop' status overriding 'start' status before we even test it. The change ensuring we get both start and stop in the proper order
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.
Pull Request Overview
This PR makes fixes and improvements to the playback stress test to enhance its robustness during continuous iterations. Key changes include introducing a variable for iteration count, updating the status check logic to ensure proper status transitions, and extending the PlaybackStatusVerifier functionality to capture multiple status changes.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
unit-tests/live/rec-play/test-playback-stress.py | Replaces a fixed iteration count with a variable and refines status checking using a new method in PlaybackStatusVerifier. |
unit-tests/live/rec-play/playback_helper.py | Adds a statuses list to track playback status changes and introduces methods to wait for and retrieve multiple status changes. |
Comments suppressed due to low confidence (2)
unit-tests/live/rec-play/test-playback-stress.py:31
- [nitpick] Remove the unnecessary semicolon at the end of the line to adhere to Python coding style.
psv = PlaybackStatusVerifier( dev );
unit-tests/live/rec-play/playback_helper.py:73
- Timer is used here but there is no indication that it has been imported or defined in this diff. Please ensure Timer is properly imported or defined to avoid runtime errors.
wait_for_event_timer = Timer(timeout)
required_status_detected = True | ||
break | ||
time.sleep( sample_interval ) | ||
test.check(required_status_detected, description='Check failed, Timeout on waiting for ') |
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.
[nitpick] Consider enhancing the error description to specify which status transition failed or which statuses were expected, to make debugging easier.
Copilot uses AI. Check for mistakes.
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
8073569
to
da45ca1
Compare
time.sleep( sample_interval ) | ||
test.check(required_status_detected, description='Check failed, Timeout on waiting for ') | ||
|
||
def reset_status_changes_cnt(self): |
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 use this function? can we remove it?
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.
currently not in use but it make sense to have for future usages
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.
decided to remove for now
@@ -66,3 +69,20 @@ def wait_for_status( self, timeout, required_status, sample_interval=0.01 ): | |||
'Multiple status changes detected, expecting a single change, got '+ str( self._status_changes_cnt - status_changes_cnt ) + | |||
' changes, consider lowering the sample interval' ) | |||
|
|||
def wait_for_status_changes( self, counter, timeout, sample_interval=0.01 ): |
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.
dose this replace wait_for_status
function? if we use it in other places in the code can we replace it with the new function?
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'm not sure yet. original wait_for_status() is fine for cases where we waiting for specific status and i see it's usefull in other test cases.
log.d( 'deadlock file:', file_name ) | ||
frames_in_bag_file = 64 | ||
number_of_iterations = 150 |
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.
can we keep it 250?
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.
sure, fixed
try: | ||
log.d("Test - Starting iteration # " , i) |
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.
can we keep this log? I think it helps with debugging
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.
fixing
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.
LGTM
No description provided.