apptrace: fix SystemView example test

add trace svdat file to artifacts
This commit is contained in:
Alexey Lapshin
2023-01-20 17:43:12 +07:00
parent dd40877ab2
commit 8b824d4f79

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD # SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0 # SPDX-License-Identifier: Unlicense OR CC0-1.0
import os.path import os.path
import time import time
@@ -7,8 +7,6 @@ import pexpect.fdpexpect
import pytest import pytest
from pytest_embedded_idf import IdfDut from pytest_embedded_idf import IdfDut
TEMP_FILE = os.path.join(os.path.dirname(__file__), 'heap_log.svdat')
@pytest.mark.esp32 @pytest.mark.esp32
@pytest.mark.jtag @pytest.mark.jtag
@@ -16,12 +14,14 @@ TEMP_FILE = os.path.join(os.path.dirname(__file__), 'heap_log.svdat')
'esp,idf,jtag', 'esp,idf,jtag',
], indirect=True) ], indirect=True)
def test_examples_sysview_tracing_heap_log(idf_path: str, dut: IdfDut) -> None: def test_examples_sysview_tracing_heap_log(idf_path: str, dut: IdfDut) -> None:
trace_log = os.path.join(os.path.dirname(dut.gdb._logfile), 'heap_log.svdat') # pylint: disable=protected-access
dut.gdb.write('mon reset halt') dut.gdb.write('mon reset halt')
dut.gdb.write('flushregs') dut.gdb.write('flushregs')
dut.gdb.write('tb heap_trace_start') dut.gdb.write('tb heap_trace_start')
dut.gdb.write('commands', non_blocking=True) dut.gdb.write('commands', non_blocking=True)
dut.gdb.write(f'mon esp sysview start file://{TEMP_FILE}', non_blocking=True) dut.gdb.write(f'mon esp sysview start file://{trace_log}', non_blocking=True)
dut.gdb.write('c', non_blocking=True) dut.gdb.write('c', non_blocking=True)
dut.gdb.write('end') dut.gdb.write('end')
@@ -30,14 +30,14 @@ def test_examples_sysview_tracing_heap_log(idf_path: str, dut: IdfDut) -> None:
dut.gdb.write('mon esp sysview stop', non_blocking=True) dut.gdb.write('mon esp sysview stop', non_blocking=True)
dut.gdb.write('end') dut.gdb.write('end')
dut.gdb.write('c', non_blocking=True) dut.gdb.write('c')
dut.expect('esp_apptrace: Initialized TRAX on CPU0') dut.expect('esp_apptrace: Initialized TRAX on CPU0')
time.sleep(1) # make sure that the sysview file has been generated time.sleep(1) # make sure that the sysview file has been generated
with pexpect.spawn(' '.join([os.path.join(idf_path, 'tools', 'esp_app_trace', 'sysviewtrace_proc.py'), with pexpect.spawn(' '.join([os.path.join(idf_path, 'tools', 'esp_app_trace', 'sysviewtrace_proc.py'),
'-p', '-p',
'-b', dut.app.elf_file, '-b', dut.app.elf_file,
TEMP_FILE])) as sysviewtrace: trace_log])) as sysviewtrace:
sysviewtrace.expect(r'Found \d+ leaked bytes in \d+ blocks.', timeout=120) sysviewtrace.expect(r'Found \d+ leaked bytes in \d+ blocks.', timeout=120)
with open(dut.gdb._logfile) as fr: # pylint: disable=protected-access with open(dut.gdb._logfile) as fr: # pylint: disable=protected-access