Procházet zdrojové kódy

apptrace: fix SystemView example test

add trace svdat file to artifacts
Alexey Lapshin před 3 roky
rodič
revize
8b824d4f79

+ 6 - 6
examples/system/sysview_tracing_heap_log/pytest_sysview_tracing_heap_log.py

@@ -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
 import os.path
 import time
@@ -7,8 +7,6 @@ import pexpect.fdpexpect
 import pytest
 from pytest_embedded_idf import IdfDut
 
-TEMP_FILE = os.path.join(os.path.dirname(__file__), 'heap_log.svdat')
-
 
 @pytest.mark.esp32
 @pytest.mark.jtag
@@ -16,12 +14,14 @@ TEMP_FILE = os.path.join(os.path.dirname(__file__), 'heap_log.svdat')
     'esp,idf,jtag',
 ], indirect=True)
 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('flushregs')
 
     dut.gdb.write('tb heap_trace_start')
     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('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('end')
 
-    dut.gdb.write('c', non_blocking=True)
+    dut.gdb.write('c')
     dut.expect('esp_apptrace: Initialized TRAX on CPU0')
 
     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'),
                                  '-p',
                                  '-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)
 
     with open(dut.gdb._logfile) as fr:  # pylint: disable=protected-access