Skip to content

fix(core): return valid slot count from scan - #34

Open
ujjwalredd wants to merge 1 commit into
embeddedos-org:masterfrom
ujjwalredd:fix/slot-scan-count-tests
Open

fix(core): return valid slot count from scan#34
ujjwalredd wants to merge 1 commit into
embeddedos-org:masterfrom
ujjwalredd:fix/slot-scan-count-tests

Conversation

@ujjwalredd

@ujjwalredd ujjwalredd commented Aug 25, 2026

Copy link
Copy Markdown

Problem

eos_slot_scan_all() is documented to return the number of valid firmware slots but always returned EOS_OK (zero). The existing slot-manager test reimplemented every public slot API inside the test executable, so it tested the fake implementation rather than core/slot_manager.c. Release builds also disabled its standard assert() checks through NDEBUG.

Approach

  • Count successful A/B verification results and return a value from 0 to 2.
  • Replace public-API fakes with HAL and image-verification boundary stubs.
  • Use assertions that remain active in Release builds.
  • Cover zero, one, and two valid slots; state/header/version queries; integrity/signature failures; invalid recovery-slot requests; and erase success/failure.

No public signature or dependency changes are introduced.

Validation

  • Regression before fix: failed as expected at the one-valid-slot count.
  • Release test_slot_manager: 6/6 passed.
  • ASan/UBSan test_slot_manager: 6/6 passed.
  • All independently buildable C tests except the baseline-blocked recovery target: 13/13 passed.
  • Python tests excluding the unrelated runner failure: 9 passed.
  • Config generation from a representative boot layout: passed and produced both generated files.
  • git diff --check: passed.
  • Independent review: approved with no findings.

Additional considerations and limitations

The unmodified baseline full build already fails while linking test_recovery because eos_boot_log_append, eos_boot_log_get_head, and eos_boot_log_read are unresolved. The full Python suite also has one unrelated existing failure: run_all_tests.run_tests() raises SystemExit while its test expects a return value. This PR does not hide or expand into either issue. Validation was host-based; no hardware flashing was performed.

GitHub Actions created build, simulation, CodeQL, and assignment runs for this PR, but all are currently action_required pending maintainer approval.

Signed-off-by: Ujjwal Reddy K S <ujjwalreddyks@gmail.com>
Copilot AI lite review requested due to automatic review settings August 25, 2026 16:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants