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

View File

@@ -24,7 +24,7 @@
```
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
@@ -45,7 +45,7 @@
```
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
@@ -59,6 +59,7 @@
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 -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

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
{ python -m coverage debug sys \
&& 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 \
&& diff output expected_output \
&& python -m coverage report \
; } || { echo 'The test for sysviewtrace_proc has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys && \
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 && \
diff output expected_output && \
python -m coverage report; \
} || { echo 'The test for sysviewtrace_proc has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \
&& 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 \
&& diff output.json expected_output.json \
&& python -m coverage report \
; } || { echo 'The test for sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys && \
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 && \
diff output.json expected_output.json && \
python -m coverage report; \
} || { echo 'The test for sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \
&& 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 \
&& diff output expected_output_mcore \
&& python -m coverage report \
; } || { echo 'The test for mcore sysviewtrace_proc functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys && \
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 && \
diff output expected_output_mcore && \
python -m coverage report; \
} || { echo 'The test for mcore sysviewtrace_proc functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys \
&& 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 \
&& diff output.json expected_output_mcore.json \
&& python -m coverage report \
; } || { echo 'The test for mcore sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }
{ python -m coverage debug sys && \
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 && \
diff output.json expected_output_mcore.json && \
python -m coverage report; \
} || { echo 'The test for mcore sysviewtrace_proc JSON functionality has failed. Please examine the artifacts.' ; exit 1; }