Skip to content

Add the two-QEMU Battery EC-relay e2e#121

Merged
dymk merged 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/phase1-battery-e2e
Jul 10, 2026
Merged

Add the two-QEMU Battery EC-relay e2e#121
dymk merged 1 commit into
OpenDevicePartnership:mainfrom
dymk:dymk/phase1-battery-e2e

Conversation

@dymk

@dymk dymk commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a Battery service two-QEMU round-trip E2E, proving the MCTP relay carries a second service (after Thermal). Registers ec_service_lib::services::Battery in the QEMU SP (reusing the shared EcRelay that already backs Thermal — one line) and adds a battery e2e binary driving GetBst over the two-QEMU link.

The test asserts the EC dev-qemu MockFuelGauge dynamic data exactly — state=0x1 (DISCHARGING), rate=1500, capacity=2304, voltage=11850 — values that originate from the EC, not the SP.

Factors the shared FF-A request-build + dispatch (build_request, send_service_command) into test-support and refactors the thermal binary onto it. Adds the battery vdrive + test-sp-ec-link-battery target (sharing a canned two-QEMU recipe with thermal) and wires it into the top-level e2e-test sequence.

No EC or odp-secure-services change — the EC dev-qemu mock already registers BatteryServiceRelayHandler, and the SP Battery relay service already exists.

Verification

  • make ec uefi && make -C e2e-tests test-sp-ec-link-battery → ALL TESTS PASSED (ffa_version, ffa_id_get, partition_discovery, battery_get_bst); observed GetBst: state=0x1 rate=1500 capacity=2304 voltage=11850.
  • Thermal e2e (test-sp-ec-link) still green after the shared-helper refactor.
  • Red-green confirmed: the battery test fails before the SP registration, passes after.

Notes

Closes #120

Register the Battery relay service in the vendored SP (reusing the
shared EcRelay that already backs Thermal) and add a battery e2e test
binary that drives GetBst over the two-QEMU MCTP link and asserts the
EC dev-qemu MockFuelGauge dynamic data (state=DISCHARGING, rate=1500,
capacity=2304, voltage=11850) — values the SP cannot fabricate.

Factor the shared FF-A request-build + dispatch (build_request,
send_service_command) into test-support and refactor the thermal
binary onto it. Wire the battery vdrive + test-sp-ec-link-battery
target (sharing a canned two-QEMU recipe with thermal) and add it to
the top-level e2e-test sequence.

Verified: make ec uefi + test-sp-ec-link-battery -> ALL TESTS PASSED;
thermal e2e still green.

Assisted-by: GitHub Copilot:claude-opus-4.8
@dymk
dymk requested a review from a team as a code owner July 9, 2026 18:12
@dymk
dymk requested review from Copilot, kat-perez, maxperga-msft, philgweber and rogurr and removed request for Copilot July 9, 2026 18:12

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.

Pull request overview

Adds end-to-end coverage for a second EC-relay service (Battery) in the two-QEMU harness, and refactors common FF-A request/dispatch logic into shared test support to keep per-service tests focused on request/response specifics.

Changes:

  • Register Battery alongside Thermal in the QEMU Secure Partition message handler.
  • Add a new battery UEFI e2e test binary that issues GetBst and asserts EC-origin BST values.
  • Factor shared FF-A payload build + command dispatch into test-support, refactor the thermal test to use it, and wire a new test-sp-ec-link-battery target into the e2e Makefile flow.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
mod/secure-services/platform/src/main.rs Registers Battery relay service in the QEMU SP handler chain.
Makefile Runs the new two-QEMU battery e2e as part of the top-level e2e-test sequence.
e2e-tests/tests/thermal/src/main.rs Refactors thermal test to use shared request/dispatch helper.
e2e-tests/tests/battery/src/main.rs New battery GetBst two-QEMU e2e test asserting exact EC BST values.
e2e-tests/tests/battery/Cargo.toml Adds the new battery test crate manifest.
e2e-tests/test-support/src/lib.rs Adds Battery UUID and shared helpers (build_request, send_service_command).
e2e-tests/Makefile Adds battery vdrive, new test-sp-ec-link-battery target, and a shared two-QEMU runner macro.
e2e-tests/Cargo.toml Adds tests/battery to the workspace members.
e2e-tests/Cargo.lock Locks the new workspace member (battery).

Comment thread e2e-tests/Makefile
Comment thread e2e-tests/test-support/src/lib.rs
@dymk
dymk enabled auto-merge (squash) July 9, 2026 20:30
@dymk
dymk merged commit 9d74680 into OpenDevicePartnership:main Jul 10, 2026
4 checks passed
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.

E2E: add Battery service two-QEMU coverage over the EC relay

4 participants