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

Avocado instrumented timeout handling in thread #6060

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richtja
Copy link
Contributor

@richtja richtja commented Oct 31, 2024

This commit changes the way how avocado instrumented runner handles test timeouts. For timeout handling, we used to use signals and raising TestInterrupt error. Such solution has an issue that we can't control where in the code the Error will be raised, and it can be handled before it reaches the runner layer. More info about this issue in #6046.

This change removes the signal handling and uses threading instead. Now each test method will be run in a separated thread and this thread will be terminated if timeout is reached. This solution selves the raising error issue and keeps the current test lifecycle untouched.

Reference: #6046

@richtja richtja added the bug label Oct 31, 2024
@richtja richtja added this to the 109 - Codename TBD milestone Oct 31, 2024
@richtja richtja self-assigned this Oct 31, 2024
@richtja richtja linked an issue Oct 31, 2024 that may be closed by this pull request
Copy link

codecov bot commented Oct 31, 2024

Codecov Report

Attention: Patch coverage is 76.19048% with 5 lines in your changes missing coverage. Please review.

Project coverage is 51.72%. Comparing base (bf9b3d5) to head (1555489).
Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
avocado/plugins/runners/avocado_instrumented.py 33.33% 4 Missing ⚠️
avocado/core/test.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6060      +/-   ##
==========================================
- Coverage   54.45%   51.72%   -2.74%     
==========================================
  Files         202      202              
  Lines       21885    21888       +3     
==========================================
- Hits        11917    11321     -596     
- Misses       9968    10567     +599     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This commit changes the way how avocado instrumented runner handles test
timeouts.  For timeout handling, we used to use signals and raising
TestInterrupt error. Such solution has an issue that we can't control
where in the code the Error will be raised, and it can be handled before
it reaches the runner layer. More info about this issue in avocado-framework#6046.

This change removes the signal handling and uses threading instead. Now
each test method will be run in a separated thread and this thread will
be terminated if timeout is reached. This solution selves the raising
error issue and keeps the current test lifecycle untouched.

Reference: avocado-framework#6046
Signed-off-by: Jan Richter <[email protected]>
@clebergnu
Copy link
Contributor

It would be interesting to run this with external test suites, such as the tests on QEMU or sosreport. I can attempt that as part of my review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review Requested
Development

Successfully merging this pull request may close these issues.

Exception handling causes test timeouts issues
2 participants