-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
twister: add trace print in exception #81703
base: main
Are you sure you want to change the base?
twister: add trace print in exception #81703
Conversation
pre discussion in #80623 |
9a01921
to
e778ea7
Compare
@nashif , @gchwier , @golowanow , @PerMac , @LukaszMrugala , @KamilxPaszkiet please review this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this PR should clarify its commit description as it logs traces for TwisterException
objects only.
.. and the stack trace output will be duplicated for all other Twister exceptions, but StatusAttributeError
with their handlers.
for line in traceback.format_stack(): | ||
logger.info(line.strip()) | ||
logger.warning("======call stack dump end============") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way it will log the trace stack at once to reduce chances of other output in between, and to omit its last lines from TwisterException
code itself.
for line in traceback.format_stack(): | |
logger.info(line.strip()) | |
logger.warning("======call stack dump end============") | |
logger.error(''.join(["Twister call stack dump:\n"] + traceback.format_stack()[:-1])) |
add trace print when exception happens Signed-off-by: Hake Huang <[email protected]>
update test cases for twister 1. test_errors.py add protection. 2. test_handlers.py change call to status 3. test_testsuite.py change call to status The log traces for TwisterException objects only. And the stack trace output follow the same rules for all exceptions, but StatusAttributeError with its dedicated handlers. Signed-off-by: Hake Huang <[email protected]>
e778ea7
to
ac3cd20
Compare
add trace print when exception happens