Merge branch 'bugfix/ci_espcoredump' into 'master'

tools: Fix non-existing key in espcoredump's GDMI payload and increase internal GDB delay for CI tests

Closes IDFCI-74 and IDFCI-226

See merge request espressif/esp-idf!11221
This commit is contained in:
Anton Maklakov 2020-11-25 19:16:24 +08:00
commit bf10c537e4
2 changed files with 18 additions and 5 deletions

View File

@ -30,6 +30,8 @@ import time
from pygdbmi.gdbcontroller import GdbController, DEFAULT_GDB_TIMEOUT_SEC
_gdb_timeout_sec = DEFAULT_GDB_TIMEOUT_SEC
IDF_PATH = os.getenv('IDF_PATH')
if not IDF_PATH:
sys.stderr.write("IDF_PATH is not found! Set proper IDF_PATH in environment.\n")
@ -1234,7 +1236,7 @@ def gdbmi_run_cmd_get_responses(p, cmd, resp_message, resp_type, multiple=True,
# type: (GdbController, str, typing.Optional[str], str, bool, typing.Optional[str], typing.Optional[str]) -> list
p.write(cmd, read_response=False)
t_end = time.time() + DEFAULT_GDB_TIMEOUT_SEC
t_end = time.time() + _gdb_timeout_sec
filtered_response_list = []
all_responses = []
while time.time() < t_end:
@ -1269,7 +1271,8 @@ def gdbmi_start(gdb_path, gdb_cmds, core_filename, prog_filename): # type: (str
gdb_args.append(prog_filename)
res = GdbController(gdb_path=gdb_path, gdb_args=gdb_args)
# Consume initial output by issuing a dummy command
res.write("-data-list-register-values x pc", timeout_sec=5)
gdbmi_run_cmd_get_responses(res, "-data-list-register-values x pc", None, "console", multiple=True,
done_message="done", done_type="result")
return res
@ -1303,7 +1306,8 @@ def gdbmi_freertos_get_task_name(p, tcb_addr): # type: (GdbController, int) ->
""" Get FreeRTOS task name given the TCB address """
try:
val = gdbmi_data_evaluate_expression(p, "(char*)((TCB_t *)0x%x)->pcTaskName" % tcb_addr)
except ESPCoreDumpError:
except (ESPCoreDumpError, KeyError):
# KeyError is raised when "value" is not in "payload"
return ''
# Value is of form '0x12345678 "task_name"', extract the actual name
@ -1493,6 +1497,12 @@ def main():
type=int,
default=os.environ.get('ESPTOOL_BAUD', esptool.ESPLoader.ESP_ROM_BAUD))
parser.add_argument(
'--gdb-timeout-sec',
help='Overwrite the default internal delay for gdb responses',
type=int,
default=DEFAULT_GDB_TIMEOUT_SEC)
subparsers = parser.add_subparsers(
dest='operation',
help='Run coredumper {command} -h for additional help')
@ -1536,6 +1546,9 @@ def main():
args = parser.parse_args()
global _gdb_timeout_sec
_gdb_timeout_sec = args.gdb_timeout_sec
log_level = logging.CRITICAL
if args.debug == 0:
log_level = logging.CRITICAL

View File

@ -2,9 +2,9 @@
{ coverage debug sys \
&& coverage erase \
&& coverage run -a --source=espcoredump ../espcoredump.py info_corefile -m -t b64 -c coredump.b64 -s core.elf test.elf &> output \
&& coverage run -a --source=espcoredump ../espcoredump.py --gdb-timeout-sec 5 info_corefile -m -t b64 -c coredump.b64 -s core.elf test.elf &> output \
&& diff expected_output output \
&& coverage run -a --source=espcoredump ../espcoredump.py info_corefile -m -t elf -c core.elf test.elf &> output2 \
&& coverage run -a --source=espcoredump ../espcoredump.py --gdb-timeout-sec 5 info_corefile -m -t elf -c core.elf test.elf &> output2 \
&& diff expected_output output2 \
&& coverage run -a --source=espcoredump ./test_espcoredump.py \
&& coverage report \