From 66337ca85b5e8520b5ba5658bdeaf33c187a88b7 Mon Sep 17 00:00:00 2001 From: Eran Date: Wed, 15 May 2024 19:35:15 +0300 Subject: [PATCH 1/2] fix PR #12911: sleep if test is not live --- unit-tests/run-unit-tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit-tests/run-unit-tests.py b/unit-tests/run-unit-tests.py index 1cda72b9f1..3cf4ee38e6 100644 --- a/unit-tests/run-unit-tests.py +++ b/unit-tests/run-unit-tests.py @@ -459,10 +459,10 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ): log.debug_unindent() # just to make it stand out a little more log.d( f' Failed; retry #{retry}' ) log.debug_indent() - if no_reset: + if no_reset or not sns: time.sleep(1) # small pause between tries else: - devices.enable_only( serial_numbers, recycle=True ) + devices.enable_only( sns, recycle=True ) if test_wrapper_( test, configuration, repetition, retry, sns ): return True log._n_errors -= 1 From fa561ae96155f65df3b40b1758a493082c02e660 Mon Sep 17 00:00:00 2001 From: Eran Date: Thu, 16 May 2024 08:12:23 +0300 Subject: [PATCH 2/2] replace 'sns' with 'serial_numbers' --- unit-tests/run-unit-tests.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unit-tests/run-unit-tests.py b/unit-tests/run-unit-tests.py index 3cf4ee38e6..0b52053050 100644 --- a/unit-tests/run-unit-tests.py +++ b/unit-tests/run-unit-tests.py @@ -450,7 +450,7 @@ def test_wrapper_( test, configuration=None, repetition=1, retry=0, sns=None ): return False -def test_wrapper( test, configuration=None, repetition=1, sns=None ): +def test_wrapper( test, configuration=None, repetition=1, serial_numbers=None ): global n_tests n_tests += 1 for retry in range( test.config.retries + 1 ): @@ -459,11 +459,11 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ): log.debug_unindent() # just to make it stand out a little more log.d( f' Failed; retry #{retry}' ) log.debug_indent() - if no_reset or not sns: + if no_reset or not serial_numbers: time.sleep(1) # small pause between tries else: - devices.enable_only( sns, recycle=True ) - if test_wrapper_( test, configuration, repetition, retry, sns ): + devices.enable_only( serial_numbers, recycle=True ) + if test_wrapper_( test, configuration, repetition, retry, serial_numbers ): return True log._n_errors -= 1 @@ -599,7 +599,7 @@ def test_wrapper( test, configuration=None, repetition=1, sns=None ): except RuntimeError as e: log.w( log.red + test.name + log.reset + ': ' + str( e ) ) else: - test_ok = test_wrapper( test, configuration, repetition, sns=serial_numbers ) and test_ok + test_ok = test_wrapper( test, configuration, repetition, serial_numbers ) and test_ok finally: log.debug_unindent() if not test_ok: