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

feat: gdb panic server from module (RDT-606) #244

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pytest-embedded-idf/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ requires-python = ">=3.7"

dependencies = [
"pytest-embedded~=1.4.2",
"esp-idf-panic-decoder",
]

[project.optional-dependencies]
Expand Down
23 changes: 13 additions & 10 deletions pytest-embedded-idf/pytest_embedded_idf/dut.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib.util
import logging
import os
import re
Expand Down Expand Up @@ -74,16 +75,18 @@ def panic_output_decode_script(self) -> t.Optional[str]:
Returns:
Panic output decode script path
"""
script_filepath = self._panic_output_decode_script or os.path.join(
os.getenv('IDF_PATH', 'IDF_PATH'),
'tools',
'gdb_panic_server.py',
)
if not os.path.isfile(script_filepath):
raise ValueError(
'Panic output decode script not found. Please use --panic-output-decode-script flag '
'to provide script or set IDF_PATH (Default: $IDF_PATH/tools/gdb_panic_server.py)'
)

script_filepath = self._panic_output_decode_script
if not script_filepath or not os.path.isfile(script_filepath):
module = importlib.util.find_spec('esp_idf_panic_decoder.gdb_panic_server')
if not module:
raise ValueError(
'Panic output decode script not found. '
'Please use the --panic-output-decode-script flag to provide a script '
'or install esp-idf-panic-decoder using the command: `pip install esp-idf-panic-decoder` .'
)
script_filepath = module.origin

return os.path.realpath(script_filepath)

def _check_panic_decode_trigger(self): # type: () -> None
Expand Down
2 changes: 1 addition & 1 deletion pytest-embedded/pytest_embedded/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def pytest_addoption(parser):
idf_group.addoption(
'--panic-output-decode-script',
help='Panic output decode script that is used in conjunction with the check-panic-coredump option '
'to parse panic output. (Default: $IDF_PATH/tools/gdb_panic_server.py)',
'to parse panic output. (Default: use gdb_panic_server.py from package esp_idf_panic_decoder)',
)

jtag_group = parser.getgroup('embedded-jtag')
Expand Down
Loading