mirror of
https://github.com/esphome/esphome.git
synced 2026-08-30 17:46:01 +00:00
Make the link-line and tool-path tests platform-independent
This commit is contained in:
@@ -258,17 +258,20 @@ def test_write_project_link_line_and_exclusions(tmp_path: Path) -> None:
|
||||
assert '"$in"' not in content
|
||||
assert '"$out"' not in content
|
||||
# -L/-l from esphome build_flags reach the link line, not the compiles;
|
||||
# spaced forms ("-L /path") are shell-lexed the way PlatformIO does
|
||||
assert '-L"/opt/blobs"' in content
|
||||
# spaced forms ("-L /path") are shell-lexed the way PlatformIO does.
|
||||
# str(Path(...)) so the separator matches the host platform.
|
||||
opt_blobs = str(Path("/opt/blobs"))
|
||||
spc_blobs = str(Path("/spc/blobs"))
|
||||
assert f'-L"{opt_blobs}"' in content
|
||||
assert "-luser_blob" in content
|
||||
assert '-L"/spc/blobs"' in content
|
||||
assert f'-L"{spc_blobs}"' in content
|
||||
assert "-lspaced_blob" in content
|
||||
for line in content.splitlines():
|
||||
if line.split(" = ")[0] in ("cflags", "cxxflags", "asflags"):
|
||||
assert "user_blob" not in line
|
||||
assert "/opt/blobs" not in line
|
||||
assert opt_blobs not in line
|
||||
assert "spaced_blob" not in line
|
||||
assert "/spc/blobs" not in line
|
||||
assert spc_blobs not in line
|
||||
# System libraries with the selected lwIP variant, in the builder's order
|
||||
assert (
|
||||
"-lhal -lphy -lpp -lnet80211 -llwip2-1460 -lwpa -lcrypto -lmain -lwps "
|
||||
|
||||
@@ -50,9 +50,11 @@ def _paths(tmp_path: Path) -> dict[str, Path]:
|
||||
def test_path_getters(tmp_path: Path) -> None:
|
||||
assert toolchain.get_build_dir() == CORE.relative_pioenvs_path("test8266")
|
||||
assert toolchain.get_elf_path().name == "firmware.elf"
|
||||
assert toolchain.get_addr2line_path().name == "xtensa-lx106-elf-addr2line"
|
||||
assert toolchain.get_objdump_path().name == "xtensa-lx106-elf-objdump"
|
||||
assert toolchain.get_readelf_path().name == "xtensa-lx106-elf-readelf"
|
||||
# Pin both suffix variants so the test passes on every host platform
|
||||
with patch.object(toolchain, "_EXE_SUFFIX", ""):
|
||||
assert toolchain.get_addr2line_path().name == "xtensa-lx106-elf-addr2line"
|
||||
assert toolchain.get_objdump_path().name == "xtensa-lx106-elf-objdump"
|
||||
assert toolchain.get_readelf_path().name == "xtensa-lx106-elf-readelf"
|
||||
# Windows binutils carry the executable suffix
|
||||
with patch.object(toolchain, "_EXE_SUFFIX", ".exe"):
|
||||
assert toolchain.get_addr2line_path().name == "xtensa-lx106-elf-addr2line.exe"
|
||||
|
||||
Reference in New Issue
Block a user