mirror of
https://github.com/esphome/esphome.git
synced 2025-10-12 14:53:49 +01:00
fix
This commit is contained in:
@@ -40,6 +40,15 @@ from esphome.config_helpers import Extend, Remove
|
|||||||
# Path to common bus configs
|
# Path to common bus configs
|
||||||
COMMON_BUS_PATH = Path("tests/test_build_components/common")
|
COMMON_BUS_PATH = Path("tests/test_build_components/common")
|
||||||
|
|
||||||
|
# Components that must be tested in isolation (not grouped or batched with others)
|
||||||
|
# These have known build issues that prevent grouping
|
||||||
|
# NOTE: This should be kept in sync with both test_build_components and split_components_for_ci.py
|
||||||
|
ISOLATED_COMPONENTS = {
|
||||||
|
"camera_encoder": "Multiple definition errors: esp32-camera IDF component conflicts with ESPHome camera component",
|
||||||
|
"camera": "Uses relative include paths that break when merged with other components",
|
||||||
|
"esphome": "Defines devices/areas in esphome: section that are referenced in other sections - breaks when merged",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
@lru_cache(maxsize=1)
|
||||||
def get_common_bus_packages() -> frozenset[str]:
|
def get_common_bus_packages() -> frozenset[str]:
|
||||||
|
@@ -21,19 +21,11 @@ import sys
|
|||||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
from script.analyze_component_buses import (
|
from script.analyze_component_buses import (
|
||||||
|
ISOLATED_COMPONENTS,
|
||||||
analyze_all_components,
|
analyze_all_components,
|
||||||
create_grouping_signature,
|
create_grouping_signature,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Components that must be tested in isolation (not grouped or batched with others)
|
|
||||||
# These have known build issues that prevent grouping
|
|
||||||
# NOTE: This should be kept in sync with ISOLATED_COMPONENTS in test_build_components
|
|
||||||
ISOLATED_COMPONENTS = {
|
|
||||||
"camera_encoder": "Multiple definition errors: esp32-camera IDF component conflicts with ESPHome camera component",
|
|
||||||
"camera": "Uses relative include paths that break when merged with other components",
|
|
||||||
"esphome": "Defines devices/areas in esphome: section that are referenced in other sections - breaks when merged",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def has_test_files(component_name: str, tests_dir: Path) -> bool:
|
def has_test_files(component_name: str, tests_dir: Path) -> bool:
|
||||||
"""Check if a component has test files.
|
"""Check if a component has test files.
|
||||||
@@ -94,26 +86,16 @@ def create_intelligent_batches(
|
|||||||
signature_groups: dict[str, list[str]] = defaultdict(list)
|
signature_groups: dict[str, list[str]] = defaultdict(list)
|
||||||
|
|
||||||
for component in components_with_tests:
|
for component in components_with_tests:
|
||||||
# Components in ISOLATED_COMPONENTS can share a batch/runner with others
|
# Components that can't be grouped get unique signatures
|
||||||
# but won't be grouped/merged - they're tested individually
|
# This includes both manually curated ISOLATED_COMPONENTS and
|
||||||
# Give each one a unique signature so they can be batched but not grouped
|
# automatically detected non_groupable components
|
||||||
if component in ISOLATED_COMPONENTS:
|
# These can share a batch/runner but won't be grouped/merged
|
||||||
|
if component in ISOLATED_COMPONENTS or component in non_groupable:
|
||||||
signature_groups[f"isolated_{component}"].append(component)
|
signature_groups[f"isolated_{component}"].append(component)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Components that can't be grouped (use local files, etc.)
|
|
||||||
# Also get unique signatures
|
|
||||||
if component in non_groupable:
|
|
||||||
signature_groups[f"isolated_{component}"].append(component)
|
|
||||||
continue
|
|
||||||
|
|
||||||
if component not in component_buses:
|
|
||||||
# Component has no bus configs, put in "no_buses" group
|
|
||||||
# These components CAN be grouped together
|
|
||||||
signature_groups["no_buses"].append(component)
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Get signature from any platform (they should all have the same buses)
|
# Get signature from any platform (they should all have the same buses)
|
||||||
|
# Components not in component_buses were filtered out by has_test_files check
|
||||||
comp_platforms = component_buses[component]
|
comp_platforms = component_buses[component]
|
||||||
for platform, buses in comp_platforms.items():
|
for platform, buses in comp_platforms.items():
|
||||||
if buses:
|
if buses:
|
||||||
@@ -149,9 +131,9 @@ def create_intelligent_batches(
|
|||||||
|
|
||||||
# Flatten all groups in signature-sorted order
|
# Flatten all groups in signature-sorted order
|
||||||
# Components within each signature group stay in their natural order
|
# Components within each signature group stay in their natural order
|
||||||
all_components = []
|
all_components = [
|
||||||
for signature, group_components in sorted_groups:
|
comp for _, group_components in sorted_groups for comp in group_components
|
||||||
all_components.extend(group_components)
|
]
|
||||||
|
|
||||||
# Split into batches of batch_size
|
# Split into batches of batch_size
|
||||||
# Isolated components are included in all_components (in "isolated" group)
|
# Isolated components are included in all_components (in "isolated" group)
|
||||||
|
@@ -27,6 +27,7 @@ sys.path.insert(0, str(Path(__file__).parent.parent))
|
|||||||
|
|
||||||
# pylint: disable=wrong-import-position
|
# pylint: disable=wrong-import-position
|
||||||
from script.analyze_component_buses import (
|
from script.analyze_component_buses import (
|
||||||
|
ISOLATED_COMPONENTS,
|
||||||
analyze_all_components,
|
analyze_all_components,
|
||||||
create_grouping_signature,
|
create_grouping_signature,
|
||||||
is_platform_component,
|
is_platform_component,
|
||||||
@@ -34,14 +35,6 @@ from script.analyze_component_buses import (
|
|||||||
)
|
)
|
||||||
from script.merge_component_configs import merge_component_configs
|
from script.merge_component_configs import merge_component_configs
|
||||||
|
|
||||||
# Components that must be tested in isolation (not grouped)
|
|
||||||
# These have known build issues that prevent grouping
|
|
||||||
ISOLATED_COMPONENTS = {
|
|
||||||
"camera_encoder": "Multiple definition errors: esp32-camera IDF component conflicts with ESPHome camera component (buffer_impl.cpp symbols defined in both src/camera/ and src/esphome/components/camera/)",
|
|
||||||
"camera": "Uses relative include paths that break when merged with other components",
|
|
||||||
"esphome": "Defines devices/areas in esphome: section that are referenced in other sections - breaks when merged",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def find_component_tests(
|
def find_component_tests(
|
||||||
components_dir: Path, component_pattern: str = "*"
|
components_dir: Path, component_pattern: str = "*"
|
||||||
|
Reference in New Issue
Block a user