mirror of
https://github.com/esphome/esphome.git
synced 2026-09-30 08:20:21 +00:00
Close the native CI trigger gap and log the remaining silent library skips
This commit is contained in:
@@ -3083,6 +3083,9 @@ def test_esp8266_native_components_full_list_on_infra_change() -> None:
|
||||
# Shared modules the native build depends on
|
||||
["esphome/espidf/idedata.py"],
|
||||
["esphome/platformio/library.py"],
|
||||
# Top-level esphome/*.py modules the backend imports directly
|
||||
["esphome/framework_helpers.py"],
|
||||
["esphome/writer.py"],
|
||||
):
|
||||
with (
|
||||
patch.object(determine_jobs, "changed_files", return_value=changed),
|
||||
|
||||
@@ -11,6 +11,7 @@ PlatformIO toolchain produces for the same configuration.
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
@@ -454,7 +455,9 @@ def test_generate_ld_scripts_testing_mode(tmp_path: Path) -> None:
|
||||
assert "len = 0x2000000" in patched
|
||||
|
||||
|
||||
def test_write_project_libraries_and_variant(tmp_path: Path) -> None:
|
||||
def test_write_project_libraries_and_variant(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
from esphome.arduino8266.component import ArduinoLibrary
|
||||
|
||||
paths = _make_framework(tmp_path)
|
||||
@@ -477,14 +480,17 @@ def test_write_project_libraries_and_variant(tmp_path: Path) -> None:
|
||||
)
|
||||
_set_flags("-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS")
|
||||
|
||||
content = _write_ninja(
|
||||
paths, libraries=[library, headers_only], ccache="/cc/ccache"
|
||||
)
|
||||
with caplog.at_level(logging.DEBUG, logger="esphome.build_gen.arduino8266"):
|
||||
content = _write_ninja(
|
||||
paths, libraries=[library, headers_only], ccache="/cc/ccache"
|
||||
)
|
||||
|
||||
assert "build libFrameworkArduinoVariant.a: ar" in content
|
||||
assert "build libMyLib.a: ar" in content
|
||||
# A headers-only library contributes includes but no archive
|
||||
# A headers-only library contributes includes but no archive, with a
|
||||
# debug log distinguishing it from a resolution failure
|
||||
assert "libHeadersOnly.a" not in content
|
||||
assert "Library HeadersOnly has no source files" in caplog.text
|
||||
assert " flags = -DMYLIB=1" in content
|
||||
assert "-lalgobsec" in content
|
||||
# Library link flags reach the firmware link line; .cc compiles as C++
|
||||
|
||||
@@ -84,6 +84,18 @@ def test_library_info_flags_parsing(tmp_path: Path) -> None:
|
||||
assert lib.link_flags == ["-Wl,--wrap=malloc"]
|
||||
|
||||
|
||||
def test_library_info_missing_link_dir_warns(
|
||||
tmp_path: Path, caplog: pytest.LogCaptureFixture
|
||||
) -> None:
|
||||
read_path = tmp_path / "lib"
|
||||
read_path.mkdir()
|
||||
data = {"build": {"flags": ["-Lmissing_blobs"]}}
|
||||
lib = component._library_info("x", read_path, data)
|
||||
assert "declares library dir missing_blobs which does not exist" in caplog.text
|
||||
# Kept anyway: the linker ignores missing -L dirs
|
||||
assert lib.link_dirs == [(read_path / "missing_blobs").resolve()]
|
||||
|
||||
|
||||
def test_library_info_no_src_dir(tmp_path: Path) -> None:
|
||||
read_path = tmp_path / "empty"
|
||||
read_path.mkdir()
|
||||
|
||||
Reference in New Issue
Block a user