feat(sysview): update multicore files for testing

This commit is contained in:
Erhan Kurubas
2025-06-05 21:13:56 +02:00
committed by BOT
parent e8d5bdd51c
commit 3c29b8feec
11 changed files with 18765 additions and 16511 deletions

View File

@@ -16,6 +16,7 @@ import signal
import sys import sys
import tempfile import tempfile
import traceback import traceback
from urllib.parse import urlparse
import espytrace.apptrace as apptrace import espytrace.apptrace as apptrace
import espytrace.sysview as sysview import espytrace.sysview as sysview
@@ -24,27 +25,27 @@ import espytrace.sysview as sysview
def is_segger_multicore_format(file_path): def is_segger_multicore_format(file_path):
"""Check if the file has offsets in header""" """Check if the file has offsets in header"""
try: try:
with open(file_path, 'rb') as f: url = urlparse(file_path)
header = f.read(200) if len(url.scheme) == 0 or url.scheme == 'file':
header_str = header.decode('utf-8', errors='ignore') with open(url.path, 'rb') as f:
header = f.read(200)
if ( header_str = header.decode('utf-8', errors='ignore')
'; Version SEGGER SystemViewer' in header_str if (
and '; Author Espressif Inc' in header_str '; Version SEGGER SystemViewer' in header_str
and '; Offset Core0' in header_str and '; Author Espressif Inc' in header_str
and '; Offset Core1' in header_str and '; Offset Core0' in header_str
): and '; Offset Core1' in header_str
logging.info('Detected SEGGER multicore format in file:', file_path) ):
return True return True
except Exception as e: except Exception as e:
logging.error('Error checking file format:', e) logging.error('Error checking SEGGER multicore file format:', e)
return False return False
def split_segger_multicore_file(file_path): def split_segger_multicore_file(file_path):
"""Split SEGGER multicore file into separate core files.""" """Split SEGGER multicore file into separate core files."""
try: try:
with open(file_path, 'rb') as f: with open(urlparse(file_path).path, 'rb') as f:
# Read first few lines to get offsets for each core # Read first few lines to get offsets for each core
header = f.read(200) header = f.read(200)
header_str = header.decode('utf-8', errors='ignore') header_str = header.decode('utf-8', errors='ignore')
@@ -165,15 +166,15 @@ def main():
logging.basicConfig(level=verbosity_levels[args.verbose], format='[%(levelname)s] %(message)s') logging.basicConfig(level=verbosity_levels[args.verbose], format='[%(levelname)s] %(message)s')
segger_files = [] temp_files = []
# Only check for SEGGER format if there's exactly one trace source # Only check for SEGGER format if there's exactly one trace source
if len(args.trace_sources) == 1: if len(args.trace_sources) == 1:
trace_source = args.trace_sources[0] trace_source = args.trace_sources[0]
if is_segger_multicore_format(trace_source): if is_segger_multicore_format(trace_source):
core0_file, core1_file = split_segger_multicore_file(trace_source) core0_file, core1_file = split_segger_multicore_file(trace_source)
if core0_file and core1_file: if core0_file and core1_file:
segger_files.extend([core0_file, core1_file]) temp_files.extend([core0_file, core1_file])
args.trace_sources = segger_files args.trace_sources = temp_files
else: else:
sys.exit(2) sys.exit(2)
@@ -257,8 +258,8 @@ def main():
proc.print_report() proc.print_report()
proc.cleanup() proc.cleanup()
if segger_files: if len(temp_files) > 0:
for file in segger_files: for file in temp_files:
try: try:
os.remove(file) os.remove(file)
except Exception as e: except Exception as e:

View File

@@ -24,7 +24,7 @@
``` ```
cd $IDF_PATH/examples/system/sysview_tracing_heap_log cd $IDF_PATH/examples/system/sysview_tracing_heap_log
xtensa-esp32-elf-gdb -x gdbinit build/sysview_tracing_heap_log.elf xtensa-esp32-elf-gdb -x $IDF_PATH/tools/esp_app_trace/test/sysview/gdbinit build/sysview_tracing_heap_log.elf
``` ```
When program stops at `heap_trace_stop` quit GDB and OpenOCD When program stops at `heap_trace_stop` quit GDB and OpenOCD
@@ -45,7 +45,7 @@
``` ```
cd $IDF_PATH/examples/system/sysview_tracing_heap_log cd $IDF_PATH/examples/system/sysview_tracing_heap_log
xtensa-esp32-elf-gdb -x gdbinit-mcore build/sysview_tracing_heap_log.elf xtensa-esp32-elf-gdb -x $IDF_PATH/tools/esp_app_trace/test/sysview/gdbinit-mcore build/sysview_tracing_heap_log.elf
``` ```
When program stops at `heap_trace_stop` quit GDB and OpenOCD When program stops at `heap_trace_stop` quit GDB and OpenOCD
@@ -59,6 +59,7 @@
You can use the commands from the `test.sh` to generate expected result files You can use the commands from the `test.sh` to generate expected result files
``` ```
cd $IDF_PATH/tools/esp_app_trace/test/sysview/
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output.json $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &> expected_output.json
$IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log_mcore.svdat &> expected_output_mcore $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log_mcore.svdat &> expected_output_mcore

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,29 @@
#!/usr/bin/env bash #!/usr/bin/env bash
{ python -m coverage debug sys \ { python -m coverage debug sys && \
&& python -m coverage erase &> output \ python -m coverage erase > output && \
&& python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &>> output \ python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat >> output && \
&& diff output expected_output \ diff output expected_output && \
&& python -m coverage report \ python -m coverage report; \
; } || { echo 'The test for sysviewtrace_proc has failed. Please examine the artifacts.' ; exit 1; } } || { echo 'The test for sysviewtrace_proc has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \ { python -m coverage debug sys && \
&& python -m coverage erase &> output.json \ python -m coverage erase > output.json && \
&& python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat &>> output.json \ python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log0.svdat heap_log1.svdat >> output.json && \
&& diff output.json expected_output.json \ diff output.json expected_output.json && \
&& python -m coverage report \ python -m coverage report; \
; } || { echo 'The test for sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; } } || { echo 'The test for sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \ { python -m coverage debug sys && \
&& python -m coverage erase &> output \ python -m coverage erase > output && \
&& python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log_mcore.svdat &>> output \ python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -d -p -b sysview_tracing_heap_log.elf heap_log_mcore.svdat >> output && \
&& diff output expected_output_mcore \ diff output expected_output_mcore && \
&& python -m coverage report \ python -m coverage report; \
; } || { echo 'The test for mcore sysviewtrace_proc functionality has failed. Please examine the artifacts.' ; exit 1; } } || { echo 'The test for mcore sysviewtrace_proc functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \ { python -m coverage debug sys && \
&& python -m coverage erase &> output.json \ python -m coverage erase > output.json && \
&& python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log_mcore.svdat &>> output.json \ python -m coverage run -a $IDF_PATH/tools/esp_app_trace/sysviewtrace_proc.py -j -b sysview_tracing_heap_log.elf heap_log_mcore.svdat >> output.json && \
&& diff output.json expected_output_mcore.json \ diff output.json expected_output_mcore.json && \
&& python -m coverage report \ python -m coverage report; \
; } || { echo 'The test for mcore sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; } } || { echo 'The test for mcore sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }