[api] Populate schema defaults for transitive cpp test deps; add json override

- script/build_helpers.py: when injecting a non-MULTI_CONF component
  into the post-validation config, run its CONFIG_SCHEMA with {} so
  defaults are populated. Without this, socket got config = {} and
  socket.FILTER_SOURCE_FILES crashed with KeyError on
  'implementation' (the schema's defaulted key was never filled in).
  Falls back to {} if the schema can't validate empty input.

- tests/components/json/__init__.py: enable codegen for json so its
  to_code runs during cpp unit test builds, registering the
  ArduinoJson library. Required for any api dep test, since
  json_util.cpp #includes <ArduinoJson.h>.

Locally verified 'script/cpp_unit_test.py api' now compiles and runs;
ProtoMacVarint test suite (9 cases) passes.
This commit is contained in:
J. Nick Koston
2026-04-25 04:44:35 -05:00
parent 45525c8a82
commit 5f8e991ed8
2 changed files with 24 additions and 5 deletions
+9
View File
@@ -0,0 +1,9 @@
from tests.testing_helpers import ComponentManifestOverride
def override_manifest(manifest: ComponentManifestOverride) -> None:
# json's to_code calls cg.add_library("bblanchon/ArduinoJson", ...). C++
# unit test builds that pull json in transitively (e.g. api) need that
# library registration to happen, otherwise json_util.cpp fails to find
# ArduinoJson.h.
manifest.enable_codegen()