mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(test_build_system): require components in ioctl overlap checker tests
Wire esp_blockdev, comp_a, and comp_b into the test app dependency graph
so ioctl def files are registered and the POST_BUILD overlap checker runs.
Co-authored-by: Cursor <cursoragent@cursor.com>
(cherry picked from commit ddc9c5fc40)
Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
committed by
Frantisek Hrbata
parent
91576e4c19
commit
a017026fc1
@@ -5,6 +5,7 @@
|
||||
from pathlib import Path
|
||||
|
||||
from test_build_system_helpers import IdfPyFunc
|
||||
from test_build_system_helpers import replace_in_file
|
||||
|
||||
COMP_A_DEFS_NO_OVERLAP = """\
|
||||
#include "esp_blockdev.h"
|
||||
@@ -46,10 +47,19 @@ def _add_component(app_path: Path, name: str, defs_content: str) -> None:
|
||||
(comp_dir / 'CMakeLists.txt').write_text(COMPONENT_CMAKELISTS.format(filename=filename))
|
||||
|
||||
|
||||
def _wire_components(app_path: Path) -> None:
|
||||
replace_in_file(
|
||||
app_path / 'main' / 'CMakeLists.txt',
|
||||
'# placeholder_inside_idf_component_register',
|
||||
'REQUIRES esp_blockdev comp_a comp_b\n # placeholder_inside_idf_component_register',
|
||||
)
|
||||
|
||||
|
||||
def test_ioctl_overlap_checker_passes_clean_build_v2(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
|
||||
"""Build succeeds when registered ioctl ranges do not overlap (cmakev2)."""
|
||||
_add_component(test_app_copy, 'comp_a', COMP_A_DEFS_NO_OVERLAP)
|
||||
_add_component(test_app_copy, 'comp_b', COMP_B_DEFS_NO_OVERLAP)
|
||||
_wire_components(test_app_copy)
|
||||
|
||||
ret = idf_py('build')
|
||||
assert ret.returncode == 0
|
||||
@@ -59,6 +69,7 @@ def test_ioctl_overlap_checker_fails_on_overlap_v2(idf_py: IdfPyFunc, test_app_c
|
||||
"""Build fails when registered ioctl ranges overlap (cmakev2)."""
|
||||
_add_component(test_app_copy, 'comp_a', COMP_A_DEFS_NO_OVERLAP)
|
||||
_add_component(test_app_copy, 'comp_b', COMP_B_DEFS_OVERLAP)
|
||||
_wire_components(test_app_copy)
|
||||
|
||||
ret = idf_py('build', check=False)
|
||||
assert ret.returncode != 0
|
||||
|
||||
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from test_build_system_helpers import IdfPyFunc
|
||||
from test_build_system_helpers import replace_in_file
|
||||
|
||||
COMP_A_DEFS_NO_OVERLAP = """\
|
||||
#include "esp_blockdev.h"
|
||||
@@ -48,12 +49,21 @@ def _add_component(app_path: Path, name: str, defs_content: str) -> None:
|
||||
(comp_dir / 'CMakeLists.txt').write_text(COMPONENT_CMAKELISTS.format(filename=filename))
|
||||
|
||||
|
||||
def _wire_components(app_path: Path) -> None:
|
||||
replace_in_file(
|
||||
app_path / 'main' / 'CMakeLists.txt',
|
||||
'# placeholder_inside_idf_component_register',
|
||||
'REQUIRES esp_blockdev comp_a comp_b\n # placeholder_inside_idf_component_register',
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('test_app_copy')
|
||||
def test_ioctl_overlap_checker_passes_clean_build(idf_py: IdfPyFunc, test_app_copy: Path) -> None:
|
||||
"""Build succeeds when registered ioctl ranges do not overlap."""
|
||||
logging.info('Testing ioctl overlap checker with non-overlapping ranges')
|
||||
_add_component(test_app_copy, 'comp_a', COMP_A_DEFS_NO_OVERLAP)
|
||||
_add_component(test_app_copy, 'comp_b', COMP_B_DEFS_NO_OVERLAP)
|
||||
_wire_components(test_app_copy)
|
||||
|
||||
ret = idf_py('build')
|
||||
assert ret.returncode == 0
|
||||
@@ -65,6 +75,7 @@ def test_ioctl_overlap_checker_fails_on_overlap(idf_py: IdfPyFunc, test_app_copy
|
||||
logging.info('Testing ioctl overlap checker detects overlapping ranges')
|
||||
_add_component(test_app_copy, 'comp_a', COMP_A_DEFS_NO_OVERLAP)
|
||||
_add_component(test_app_copy, 'comp_b', COMP_B_DEFS_OVERLAP)
|
||||
_wire_components(test_app_copy)
|
||||
|
||||
ret = idf_py('build', check=False)
|
||||
assert ret.returncode != 0
|
||||
|
||||
Reference in New Issue
Block a user