mirror of
https://github.com/esphome/esphome.git
synced 2025-10-21 11:13:46 +01:00
esp32 only platforms
This commit is contained in:
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
@@ -422,28 +421,6 @@ class MemoryAnalyzer:
|
|||||||
|
|
||||||
return "Other Core"
|
return "Other Core"
|
||||||
|
|
||||||
def to_json(self) -> str:
|
|
||||||
"""Export analysis results as JSON."""
|
|
||||||
data = {
|
|
||||||
"components": {
|
|
||||||
name: {
|
|
||||||
"text": mem.text_size,
|
|
||||||
"rodata": mem.rodata_size,
|
|
||||||
"data": mem.data_size,
|
|
||||||
"bss": mem.bss_size,
|
|
||||||
"flash_total": mem.flash_total,
|
|
||||||
"ram_total": mem.ram_total,
|
|
||||||
"symbol_count": mem.symbol_count,
|
|
||||||
}
|
|
||||||
for name, mem in self.components.items()
|
|
||||||
},
|
|
||||||
"totals": {
|
|
||||||
"flash": sum(c.flash_total for c in self.components.values()),
|
|
||||||
"ram": sum(c.ram_total for c in self.components.values()),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return json.dumps(data, indent=2)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from .cli import main
|
from .cli import main
|
||||||
|
@@ -54,6 +54,7 @@ from helpers import (
|
|||||||
changed_files,
|
changed_files,
|
||||||
get_all_dependencies,
|
get_all_dependencies,
|
||||||
get_components_from_integration_fixtures,
|
get_components_from_integration_fixtures,
|
||||||
|
parse_test_filename,
|
||||||
root_path,
|
root_path,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -335,11 +336,8 @@ def detect_memory_impact_config(
|
|||||||
# Check if component has tests for any preferred platform
|
# Check if component has tests for any preferred platform
|
||||||
available_platforms = []
|
available_platforms = []
|
||||||
for test_file in test_files:
|
for test_file in test_files:
|
||||||
parts = test_file.stem.split(".")
|
_, platform = parse_test_filename(test_file)
|
||||||
if len(parts) < 2:
|
if platform != "all" and platform in PLATFORM_PREFERENCE:
|
||||||
continue
|
|
||||||
platform = parts[1]
|
|
||||||
if platform in PLATFORM_PREFERENCE:
|
|
||||||
available_platforms.append(platform)
|
available_platforms.append(platform)
|
||||||
|
|
||||||
if not available_platforms:
|
if not available_platforms:
|
||||||
|
@@ -46,6 +46,23 @@ def parse_list_components_output(output: str) -> list[str]:
|
|||||||
return [c.strip() for c in output.strip().split("\n") if c.strip()]
|
return [c.strip() for c in output.strip().split("\n") if c.strip()]
|
||||||
|
|
||||||
|
|
||||||
|
def parse_test_filename(test_file: Path) -> tuple[str, str]:
|
||||||
|
"""Parse test filename to extract test name and platform.
|
||||||
|
|
||||||
|
Test files follow the naming pattern: test.<platform>.yaml or test-<variant>.<platform>.yaml
|
||||||
|
|
||||||
|
Args:
|
||||||
|
test_file: Path to test file
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Tuple of (test_name, platform)
|
||||||
|
"""
|
||||||
|
parts = test_file.stem.split(".")
|
||||||
|
if len(parts) == 2:
|
||||||
|
return parts[0], parts[1] # test, platform
|
||||||
|
return parts[0], "all"
|
||||||
|
|
||||||
|
|
||||||
def styled(color: str | tuple[str, ...], msg: str, reset: bool = True) -> str:
|
def styled(color: str | tuple[str, ...], msg: str, reset: bool = True) -> str:
|
||||||
prefix = "".join(color) if isinstance(color, tuple) else color
|
prefix = "".join(color) if isinstance(color, tuple) else color
|
||||||
suffix = colorama.Style.RESET_ALL if reset else ""
|
suffix = colorama.Style.RESET_ALL if reset else ""
|
||||||
|
Reference in New Issue
Block a user