Skip to content

Commit

Permalink
Run Python test scripts with fault handler enabled (#36991)
Browse files Browse the repository at this point in the history
* Run Python test scripts with fault handler enabled

* Allow to override --script-gdb from command line
  • Loading branch information
arkq authored Jan 9, 2025
1 parent 0e10604 commit f044060
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/tests/run_python_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def forward_fifo(path: str, f_out: typing.BinaryIO, stop_event: threading.Event)
'mobile-device-test.py'), help='Test script to use.')
@click.option("--script-args", type=str, default='',
help='Script arguments, can use placeholders like {SCRIPT_BASE_NAME}.')
@click.option("--script-gdb", is_flag=True,
@click.option("--script-gdb/--no-script-gdb", default=None,
help='Run script through gdb')
@click.option("--quiet/--no-quiet", default=None,
help="Do not print output from passing tests. Use this flag in CI to keep GitHub log size manageable.")
Expand Down Expand Up @@ -152,6 +152,8 @@ def main(app: str, factory_reset: bool, factory_reset_app_only: bool, app_args:
run.factory_reset = factory_reset
if factory_reset_app_only is not None:
run.factory_reset_app_only = factory_reset_app_only
if script_gdb is not None:
run.script_gdb = script_gdb
if quiet is not None:
run.quiet = quiet

Expand Down Expand Up @@ -232,7 +234,7 @@ def main_impl(app: str, factory_reset: bool, factory_reset_app_only: bool, app_a
script_command = ("gdb -batch -return-child-result -q -ex run -ex "
"thread|apply|all|bt --args python3".split() + script_command)
else:
script_command = "/usr/bin/env python3".split() + script_command
script_command = "/usr/bin/env python3 -X faulthandler".split() + script_command

final_script_command = [i.replace('|', ' ') for i in script_command]

Expand Down

0 comments on commit f044060

Please sign in to comment.