Skip to content

include farm: close remaining ways it can resolve a header differently than the -I list #1588

Closed

Description

@zackees

Follow-up to #1581 (esp32dev broke because esp_bt.h's #include "../../../controller/esp32/esp_bredr_cfg.h" escaped the farm root) and the farm introduced in #1550 / #1567.

#1581 fixed that case and added a unit test, but the farm can still silently diverge from the original -I search order in these ways:

Gaps

  1. The farm check reads include lines as text only. quoted_includes() in crates/fbuild-build-engine/src/include_farm.rs only sees literal #include "...". It misses:

    • macro includes (#include FOO_H), which IDF uses;
    • angle-bracket includes with .. (#include <../x.h>).

    Either kind can resolve differently inside the farm and break the build like fix(include-farm): keep dirs whose top-level headers climb out via .. #1581, or pick the wrong header.

  2. PR coverage is too narrow for farm changes. With ci: run path-selected board builds on PRs, same rules as main #1585, a change to crates/fbuild-build-engine/** (a shared path) builds only the 3 core boards: esp32dev, teensy41 and uno. The farm is used for every ESP32 variant (s3, c3, c6, h2, p4, …), and each has different SDK headers. A layout that only one variant has passes the PR and fails on main or in the nightly run.

  3. Farm output is never checked against a real SDK. Farm vs no-farm equivalence is only tested on synthetic trees. A farm that compiles but picks a different header wouldn't fail any build.

Proposed fixes

  • (2) Add the ESP32 family to the boards selected for crates/fbuild-build-engine/** (and include_farm*.rs) in ci/board_families.json, so farm changes build every ESP32 variant on the PR.

  • (1) + (3) Add a real-SDK test, #[ignore = "downloads ESP32 toolchain (~hundreds of MB)"], run by the nightly platform run. For each ESP32 variant it would:

    • build the farm over the real framework -I block;
    • preprocess a sample of core and SDK translation units twice, with GCC -H or -M, once with the original -I list and once with the farm replacement;
    • assert both runs resolve to the same real header paths (after resolving symlinks).

    This catches every divergence, macro includes and wrong-but-compiling headers included, without depending on the text parser.

  • Optional: when that test finds a divergence, have the check in plan_farm keep the offending directory out of the farm, or make ensure_farm fall back to the original list, so users never hit a broken build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions