Skip to content
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

LibCI - Recycle device on retry #12911

Merged
merged 4 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion unit-tests/py/rspy/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,6 @@ def finish( on_fail=LOG ):
log.i("Test passed")
test_in_progress = None


def print_separator():
"""
For use only in-between test-cases, this will separate them in some visual way so as
Expand Down
11 changes: 10 additions & 1 deletion unit-tests/run-unit-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,12 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ):
if test_wrapper_( test, configuration, repetition, retry, sns ):
return True
log._n_errors -= 1
time.sleep( 1 ) # small pause between tries
if no_reset:
time.sleep(1) # small pause between tries
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should happen only if retry < test.config.retries.
Anyway, same comment as before: move to before line 446 and check if retry > 0. And the log (line 452) should now be taken care of by test_wrapper_(), right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is a difference between retry and repeat, repeat is currently handles inside, retry outside.
I will think about it.

elif retry < test.config.retries:
log.w("retry", retry + 1, "out of", test.config.retries)
devices.enable_only(serial_numbers, recycle=True)

log._n_errors += 1
return False

Expand Down Expand Up @@ -555,6 +560,8 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ):
test_ok = True
for repetition in range(repeat):
test_ok = test_wrapper( test, repetition = repetition ) and test_ok
if repetition + 1 < repeat:
Nir-Az marked this conversation as resolved.
Show resolved Hide resolved
log.d("repeating #", repetition + 1)
if not test_ok:
failed_tests.append( test )
continue
Expand All @@ -578,6 +585,8 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ):
log.w( log.red + test.name + log.reset + ': ' + str( e ) )
else:
test_ok = test_wrapper( test, configuration, repetition, sns=serial_numbers ) and test_ok
if repetition + 1 < repeat:
log.d("repeating #", repetition + 1)
finally:
log.debug_unindent()
if not test_ok:
Expand Down