mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 20:41:14 +00:00
feat(debugging): move gdbinit generation to CMake
This feature is useful for 3rd-party software to run GDB with predefined options that described in project_description.json file allow to pass custom options to "idf.py gdb": --gdb-commands: command line arguments for gdb. (without changes) -ex: pass command to gdb. -x: pass gdbinit file to gdb. Alias for old --gdbinit command
This commit is contained in:
@@ -13,9 +13,7 @@ from unittest import main
|
||||
from unittest import mock
|
||||
from unittest import TestCase
|
||||
|
||||
import elftools.common.utils as ecu
|
||||
import jsonschema
|
||||
from elftools.elf.elffile import ELFFile
|
||||
|
||||
try:
|
||||
from StringIO import StringIO
|
||||
@@ -265,48 +263,6 @@ class TestHelpOutput(TestWithoutExtensions):
|
||||
self.action_test_idf_py(['help', '--json', '--add-options'], schema_json)
|
||||
|
||||
|
||||
class TestROMs(TestWithoutExtensions):
|
||||
def get_string_from_elf_by_addr(self, filename: str, address: int) -> str:
|
||||
result = ''
|
||||
with open(filename, 'rb') as stream:
|
||||
elf_file = ELFFile(stream)
|
||||
ro = elf_file.get_section_by_name('.rodata')
|
||||
ro_addr_delta = ro['sh_addr'] - ro['sh_offset']
|
||||
cstring = ecu.parse_cstring_from_stream(ro.stream, address - ro_addr_delta)
|
||||
if cstring:
|
||||
result = str(cstring.decode('utf-8'))
|
||||
return result
|
||||
|
||||
def test_roms_validate_json(self):
|
||||
with open(os.path.join(py_actions_path, 'roms.json'), 'r') as f:
|
||||
roms_json = json.load(f)
|
||||
|
||||
with open(os.path.join(py_actions_path, 'roms_schema.json'), 'r') as f:
|
||||
schema_json = json.load(f)
|
||||
jsonschema.validate(roms_json, schema_json)
|
||||
|
||||
def test_roms_check_supported_chips(self):
|
||||
from idf_py_actions.constants import SUPPORTED_TARGETS
|
||||
with open(os.path.join(py_actions_path, 'roms.json'), 'r') as f:
|
||||
roms_json = json.load(f)
|
||||
for chip in SUPPORTED_TARGETS:
|
||||
self.assertTrue(chip in roms_json, msg=f'Have no ROM data for chip {chip}')
|
||||
|
||||
def test_roms_validate_build_date(self):
|
||||
sys.path.append(py_actions_path)
|
||||
|
||||
rom_elfs_dir = os.getenv('ESP_ROM_ELF_DIR')
|
||||
with open(os.path.join(py_actions_path, 'roms.json'), 'r') as f:
|
||||
roms_json = json.load(f)
|
||||
|
||||
for chip in roms_json:
|
||||
for k in roms_json[chip]:
|
||||
rom_file = os.path.join(rom_elfs_dir, f'{chip}_rev{k["rev"]}_rom.elf')
|
||||
build_date_str = self.get_string_from_elf_by_addr(rom_file, int(k['build_date_str_addr'], base=16))
|
||||
self.assertTrue(len(build_date_str) == 11)
|
||||
self.assertTrue(build_date_str == k['build_date_str'])
|
||||
|
||||
|
||||
class TestFileArgumentExpansion(TestCase):
|
||||
def test_file_expansion(self):
|
||||
"""Test @filename expansion functionality"""
|
||||
|
Reference in New Issue
Block a user