[wr_arp] add timeout to thread join #2986
Merged
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.
Description of PR
Type of change
Approach
What is the motivation for this PR?
test_wr_arp.py got stuck in nightly test until the test was aborted. This is because paramiko didn't return shell command return code from exec_command() call. So if there were error and warm-reboot didn't proceed, the command will return as success. Without return code, we cannot solely rely on stderr to judge if the command failed or not (because we could ignored the error and proceeded).
How did you do it?
When warm reboot fails to reboot the dut and test failed to detect the failure. The thread.join() would fail and the test will stuck
indefinitely.
Add a timeout to join and check if the thread quit after join returns.
Signed-off-by: Ying Xie [email protected]
How did you verify/test it?
While warm reboot fails, with the fix, the thread join will timeout and give properly error information:
E "======================================================================",
E "FAIL: wr_arp.ArpTest",
E "----------------------------------------------------------------------",
E "Traceback (most recent call last):",
E " File "ptftests/wr_arp.py", line 278, in runTest",
E " self.assertTrue(False, "Timed out waiting for warm reboot")",
E "AssertionError: Timed out waiting for warm reboot",
E "",
E "----------------------------------------------------------------------",
E "Ran 1 test in 384.692s",
E "",
E "FAILED (failures=1)"