Skip to content

Commit

Permalink
Merge pull request #244 from horw/feat/gdb_panic_server_from_module
Browse files Browse the repository at this point in the history
feat: gdb panic server from module (RDT-606)
  • Loading branch information
hfudev authored Dec 8, 2023
2 parents 873aae1 + e1f2f38 commit 8df0037
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
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

0 comments on commit 8df0037

Please sign in to comment.