[esp32] Redefine __FILE__ to the basename so assert paths stay out of RAM (#19106)

This commit is contained in:
J. Nick Koston
2026-09-17 11:22:32 +12:00
committed by GitHub
parent bb5c06c58a
commit f8012bc467
3 changed files with 36 additions and 0 deletions
@@ -0,0 +1,8 @@
esphome:
name: test
esp32:
board: esp32dev
framework:
type: esp-idf
version: 5.0.6
+21
View File
@@ -658,6 +658,27 @@ def test_platformio_arduino_enables_reproducible_build(
assert sdkconfig.get("CONFIG_APP_REPRODUCIBLE_BUILD") is True
@pytest.mark.parametrize(
("config_file", "expected"),
[
("reproducible_build.yaml", True),
("reproducible_build_arduino.yaml", True),
("file_macro_idf_5_0.yaml", False),
],
)
def test_file_macro_is_basename_only(
generate_main: Callable[[str | Path], str],
component_config_path: Callable[[str], Path],
config_file: str,
expected: bool,
) -> None:
"""__FILE__ becomes the basename on GCC 12 toolchains; IDF 5.0 (GCC 11) is skipped."""
generate_main(component_config_path(config_file))
assert ("-D__FILE__=__FILE_NAME__" in CORE.build_flags) is expected
assert ("-Wno-builtin-macro-redefined" in CORE.build_flags) is expected
def test_native_idf_enables_reproducible_build(
component_config_path: Callable[[str], Path],
) -> None: