Skip to content

Commit f044060

Browse files
authored
Run Python test scripts with fault handler enabled (#36991)
* Run Python test scripts with fault handler enabled * Allow to override --script-gdb from command line
1 parent 0e10604 commit f044060

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/tests/run_python_test.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def forward_fifo(path: str, f_out: typing.BinaryIO, stop_event: threading.Event)
111111
'mobile-device-test.py'), help='Test script to use.')
112112
@click.option("--script-args", type=str, default='',
113113
help='Script arguments, can use placeholders like {SCRIPT_BASE_NAME}.')
114-
@click.option("--script-gdb", is_flag=True,
114+
@click.option("--script-gdb/--no-script-gdb", default=None,
115115
help='Run script through gdb')
116116
@click.option("--quiet/--no-quiet", default=None,
117117
help="Do not print output from passing tests. Use this flag in CI to keep GitHub log size manageable.")
@@ -152,6 +152,8 @@ def main(app: str, factory_reset: bool, factory_reset_app_only: bool, app_args:
152152
run.factory_reset = factory_reset
153153
if factory_reset_app_only is not None:
154154
run.factory_reset_app_only = factory_reset_app_only
155+
if script_gdb is not None:
156+
run.script_gdb = script_gdb
155157
if quiet is not None:
156158
run.quiet = quiet
157159

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

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

0 commit comments

Comments
 (0)