test(build): restore the fw_transport suite registration dropped by #50 - #61
Conversation
…mbeddedos-org#50 tests/unit/test_fw_transport.c has not been compiled or run since commit 39b0925. The merge that added test_slot_size_bounds replaced the test_fw_transport registration block instead of appending a new one, in both the add_executable/add_test section and the valgrind target list. The source file stayed in the tree, so nothing reported it as missing: the build stayed green and ctest simply ran one fewer test. The suite is the 12-case regression set added by embeddedos-org#51 for the UART update transports -- the unbounded 4-byte raw length prefix, the unbounded block-0 filename scan on the 1024-byte STX path, and the missing YMODEM block-number validation that let a retransmitted block be written to flash twice. Those fixes have been unguarded since. Restore both registrations, and add tests/unit/test_cmake_test_registration.py, which parses tests/CMakeLists.txt and fails if any tests/unit/test_*.c has no add_executable(), or if any test executable is built without a matching add_test(). The eBoot CI job already runs pytest over tests/, so this catches the same class of drop on the PR that introduces it. CONTRIBUTING.md listed 7 unit suites; there are 17. Update the table and document the registration requirement.
srpatcha
left a comment
There was a problem hiding this comment.
Verified — and this is the fourth instance of the same merge pattern
tests/unit/test_fw_transport.c is in the tree, passes, and has not been compiled since 28 Aug because #50's merge replaced its registration block instead of appending a new one. A test that silently stops running is worse than a deleted one: the file is still there, so it reads as coverage.
Confirmed on top of #58: 16 tests before this, 17 after, 0 build errors, all passing.
Worth recording that this is not an isolated slip. The same shape has now produced four separate repairs across two repos:
| where | what a merge did |
|---|---|
| eBoot #58 | core/sha512.c and core/rollback.c never added to CMakeLists — two merged security features compiled into nothing |
| eBoot, this PR | test_fw_transport registration replaced rather than appended |
| eos #82 | sync.c — #55 merged after #67 deleted #67's implementation but kept its call sites |
| eos #82 | #74's tests merged without #74's parser change |
Every one is a PR that was green on its own branch, squash-merged onto a base that had moved, with nothing re-verifying the result. #58's write-up names the cause correctly, and this PR is more evidence for it.
Catching the valgrind target list as well as the add_executable/add_test block is the detail that makes this a complete fix rather than a partial one.
Verification
Merged onto origin/master + #58; configure OK, 0 build errors, ctest 17/17 with test_fw_transport among them.
Not verified against master alone — master does not build; #58 repairs it. This PR also needs #58 to land first.
Blocker outside this PR
eBoot sets required_signatures: true on master and your commits are unsigned, as are every contributor's here. That makes this unmergeable regardless of review. Flagged to the maintainer as a policy decision; nothing for you to fix.
Master stopped building/testing clean again after several PRs (embeddedos-org#60, embeddedos-org#61, embeddedos-org#64, embeddedos-org#67, embeddedos-org#69, embeddedos-org#71) landed back-to-back without an integration build between them: - tests/CMakeLists.txt: embeddedos-org#61 registered test_fw_transport without the eboot_ prefix embeddedos-org#71's namespace guard now requires, so configure aborted with "Test target 'test_fw_transport' is not namespaced." Renamed the target to eboot_test_fw_transport (add_test NAME stays test_fw_transport per the guard's own guidance). - tests/CMakeLists.txt: the valgrind foreach block still referenced the pre-embeddedos-org#60/embeddedos-org#71 bare target names (test_bootctl, etc.) in $<TARGET_FILE:...>, which no longer resolve now that every target is eboot_-prefixed. Fixed the generator-expression reference while leaving the valgrind_${TEST_NAME} test labels unchanged. - core/recovery.c: recovery_handle_write() called eos_recovery_write_in_range(base, slot_size, ...) with slot_size never declared -- embeddedos-org#69 introduced the call but the counterpart eos_hal_slot_size(slot) lookup (mirroring the existing eos_hal_slot_addr(slot) line right above it) never made it in. - tests/unit/test_slot_manager.c: two versions of the file's fixture and test bodies had been spliced together by a merge (duplicate globals/slot_index, an unused old RUN macro next to the real TEST macro), and the TEST macro's simulated-flash fixture (sim_flash/sim_tick/sim_ops) was referenced but never defined anywhere in the file. Rebuilt the file as one coherent suite matching its own doc comment and every sibling test file's sim_board_ops_t convention; converted the three tests that were still plain functions to the same TEST() macro as the rest for consistency. Also gave sim_flash_erase real erase_result/ erased_addr/erased_size bookkeeping -- the generic version copied in ignored those script variables entirely, which the erase test relies on. Verified: cmake configure + build, 0 errors. ctest 17/17 (non-valgrind) and 32/32 including valgrind, all passing -- including test_recovery's real HAL-level exercise of the new slot_size bounds check and test_slot_manager's erase-failure/erase-bookkeeping cases. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VvWBEZhDegTQMaqVtry2mM
Summary
tests/unit/test_fw_transport.chas not been compiled or run since commit39b0925 (28 Aug). It is still in the tree, and it still passes — nothing builds it.
The merge that landed
test_slot_size_bounds(#50) replaced thetest_fw_transportregistration block intests/CMakeLists.txtinstead ofappending a new one, in both the
add_executable/add_testsection and thevalgrind target list:
Nothing reports this. The build stays green, and
ctestsimply runs one fewertest than it did the day before.
The orphaned suite is the 12-case regression set added by #51 for the UART
firmware-update transports. It covers, specifically:
0xFFFFFFFFdrove a multi-gigabyte receive loop;strlen()over YMODEM block 0, which ran off the end of the1026-byte block buffer on the STX path (the test picks fill byte
0x21deliberately: its CRC over 1024 bytes is
0xE940, so neither CRC byte is NULeither and nothing stopped the old scan);
retransmits after a lost ACK was written to flash twice, shifting every
following byte of the image.
Those are the fixes that have been sitting unguarded.
Type of Change
Changes
tests/CMakeLists.txt: restore thetest_fw_transportregistration, and addit back to the valgrind target list.
test_slot_size_boundsis untouched —both are registered now.
tests/unit/test_cmake_test_registration.py: new guard. It parsestests/CMakeLists.txtand fails if anytests/unit/test_*.chas noadd_executable(), or if any test executable is built without a matchingadd_test(). The eBoot CI job already runspytest tests/, so this catchesthe same class of drop on the PR that introduces it rather than weeks later.
CONTRIBUTING.md: the test table said "7 unit test suites" and listed 7.There are 17. Updated, and the registration requirement is now written down.
Testing
test_fw_transport, 12/12 pass against currentcore/fw_transport_uart.c:The guard was broken and watched to fail (
TESTING.md: "break the code andwatch the test fail"). Reverting only
tests/CMakeLists.txt:and with the registration restored,
3 passed.Additional Notes / Limitations
CI on this PR will be red, for reasons that predate it.
eboot_coredoesnot compile on master right now —
core/recovery.chas a duplicatedslot_sizedeclaration,core/image_verify.c'seos_crc32definitiondisagrees with its prototype in
eos_image.h, andcore/ed25519_verify.chas aduplicated SHA-512 block with the verification tail missing — all unresolved
merge conflicts. #55, #57 and #58 are open against exactly that.
To run the restored suite I built
test_fw_transport.cagainstfw_transport_uart.c,fw_update.c,hal_core.cand the rest of its actualdependencies with a local stub for
eos_ed25519_verify(which the transportpath never calls — these images carry
sig_type = 0). That stub is not partof this branch; the diff here is three files. Once any of the build-fix PRs
lands, this suite will run under
ctestnormally, and I am happy to rebase.Two further things I noticed and deliberately left alone, since fixing them here
would collide with the open build-fix PRs:
CMakeLists.txtlistscore/boot_log.ctwice in theeboot_coresource list(lines 83 and 87). CMake de-duplicates, so it is harmless — just untidy.
tests/unit/test_slot_manager.candtests/unit/test_boot_log.cdo notcompile independently of
eboot_core's breakage; that is already tracked inthe issue titled "Two test files broken independently of eboot_core's build".