Skip to content

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

Merged
merged 4 commits into from
Jun 10, 2025

Conversation

alexk1976
Copy link

No description provided.

@alexk1976 alexk1976 requested review from Nir-Az and Copilot June 1, 2025 14:39
Copy link

@Copilot Copilot AI left a 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

Comment on lines 43 to 48
# 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()
Copy link
Preview

Copilot AI Jun 1, 2025

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)
Copy link
Collaborator

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?

Copy link
Collaborator

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?

Copy link
Author

@alexk1976 alexk1976 Jun 2, 2025

Choose a reason for hiding this comment

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

  1. look at the updated code.
  2. 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

@alexk1976 alexk1976 requested review from Copilot June 2, 2025 19:07
Copy link

@Copilot Copilot AI left a 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 ')
Copy link
Preview

Copilot AI Jun 2, 2025

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.

Copy link

@Copilot Copilot AI left a 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.

@Nir-Az Nir-Az requested a review from Noy-Zini June 3, 2025 13:26
@alexk1976 alexk1976 force-pushed the akunin/stress_test_relax branch from 8073569 to da45ca1 Compare June 4, 2025 08:10
time.sleep( sample_interval )
test.check(required_status_detected, description='Check failed, Timeout on waiting for ')

def reset_status_changes_cnt(self):
Copy link

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?

Copy link
Author

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

Copy link
Author

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 ):
Copy link

@Noy-Zini Noy-Zini Jun 8, 2025

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?

Copy link
Author

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
Copy link

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?

Copy link
Author

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)
Copy link

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

Copy link
Author

Choose a reason for hiding this comment

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

fixing

Copy link

@Noy-Zini Noy-Zini left a comment

Choose a reason for hiding this comment

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

LGTM

@Nir-Az Nir-Az merged commit f7c895d into IntelRealSense:development Jun 10, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants