Skip to content

Two test files broken independently of eboot_core's build: test_slot_manager.c, test_boot_log.c #56

Description

@tejasmhadgut

Found while verifying #55 (fixing eboot_core's build). These are two
separate, pre-existing, unrelated problems in the test suite — real, but each is
a larger undertaking than a quick fix, so filing them here rather than folding
them into that PR.

tests/unit/test_slot_manager.c — ~20 test functions called but never defined

PR #37 rewrote this file's fixture (old SLOT_A_ADDR/parse_result[]/ASSERT/RUN
style → new sim_flash/slot_states[]/PASS() style) to support new boot-attempt/
rollback tests. The patch was applied incompletely:

  • Symbols the surviving old code still references (slot_index, SLOT_A_ADDR,
    SLOT_SIZE, erase_result) were deleted.
  • New content was spliced into the middle of an existing function body rather than
    replacing it cleanly — eos_image_parse_header()'s body is truncated mid-statement,
    and the very next line starts a new function definition inside its still-open
    brace, which is illegal in C (error: function definition is not allowed here,
    repeated for every function after it).
  • The new main() calls roughly twenty test functions (test_scan_one_valid_slot,
    test_slot_is_valid_empty, test_slot_erase, test_version_macro_encoding, …)
    that don't exist anywhere in the file — only their names appear in the call list.

Reproduce:

$ cc -fsyntax-only -x c -I include tests/unit/test_slot_manager.c
# 20 errors, starting with "use of undeclared identifier 'SLOT_B_ADDR'"

Fixing this properly means writing ~20 real test bodies against
eos_slot_manager.h's actual API — new test authorship, not a restoration.

tests/unit/test_boot_log.c — duplicate-symbol conflict with the real implementation

This file defines its own local mock of eos_boot_log_read() with a different
signature than the real one in core/boot_log.c ((entries, max_count) vs.
(index, out) — see #55 for why the header was corrected to match the real
implementation). But its CMake target also links the full eboot_core library,
which includes the real core/boot_log.c. That means even with a header fix,
this file redefines a symbol that's also present in the library it links against

— a duplicate-symbol conflict, not a simple signature mismatch. It needs a real
redesign (either drop the local mock and use the real implementation with a fake
HAL backend, or rename the mock), not a one-line fix.

Reproduce (after #55 is merged, since before that the header itself was also
wrong and masked this):

$ cmake --build build --target test_boot_log
# core/ed25519_verify.c:434: error: conflicting types for 'eos_boot_log_read'

Not investigated further

I didn't audit whether other test files have the same class of damage as
test_slot_manager.c — I found these two while trying to get eboot_core's own
tests running, not via a systematic sweep. Worth a broader look.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions