CI: Use higher-level interaction with GDB in example tests and test apps

This commit is contained in:
Roland Dobai
2020-05-19 14:27:31 +02:00
committed by bot
parent 8526cb577c
commit 493c852b73
10 changed files with 159 additions and 145 deletions

View File

@@ -1,5 +1,6 @@
from __future__ import unicode_literals
from io import open
import debug_backend
import os
import re
import tempfile
@@ -29,14 +30,17 @@ def test_examples_sysview_tracing_heap_log(env, extra_data):
new_content = new_content.replace('file:///tmp/heap_log.svdat', 'file://{}'.format(tempfiles[1]), 1)
f_out.write(new_content)
with ttfw_idf.OCDProcess(os.path.join(proj_path, 'openocd.log')):
with ttfw_idf.OCDBackend(os.path.join(proj_path, 'openocd.log'), dut.app.target):
dut.start_app()
dut.expect('esp_apptrace: Initialized TRAX on CPU0')
gdb_args = '-x {} --directory={}'.format(tempfiles[0], os.path.join(proj_path, 'main'))
with ttfw_idf.GDBProcess(os.path.join(proj_path, 'gdb.log'), elf_path, dut.app.target, gdb_args) as gdb:
gdb.pexpect_proc.expect_exact('Thread 1 hit Temporary breakpoint 2, heap_trace_stop ()')
gdb.pexpect_proc.expect_exact('(gdb)')
gdb_log = os.path.join(proj_path, 'gdb.log')
gdb_workdir = os.path.join(proj_path, 'main')
with ttfw_idf.GDBBackend(gdb_log, elf_path, dut.app.target, tempfiles[0], gdb_workdir) as p:
for _ in range(2): # There are two breakpoints
p.gdb.wait_target_state(debug_backend.TARGET_STATE_RUNNING)
stop_reason = p.gdb.wait_target_state(debug_backend.TARGET_STATE_STOPPED)
assert stop_reason == debug_backend.TARGET_STOP_REASON_BP, 'STOP reason: {}'.format(stop_reason)
# dut has been restarted by gdb since the last dut.expect()
dut.expect('esp_apptrace: Initialized TRAX on CPU0')