Skip to content

add more coverage to sd_config - #615

Open
meilu-git wants to merge 2 commits into
mainfrom
meilu/tbor_tests_sd_config
Open

add more coverage to sd_config#615
meilu-git wants to merge 2 commits into
mainfrom
meilu/tbor_tests_sd_config

Conversation

@meilu-git

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Expands emulator integration-test coverage for TBOR PartInit security-domain configuration (part_init_sd) to exercise a wider range of SATA/SAPOTA thumbprint patterns and device-state transitions.

Changes:

  • Adds a shared assertion macro for validating PartInit response artifacts (pta_csr, pta_report).
  • Introduces many additional PartInit SD configuration tests covering varied thumbprint byte patterns, optional SAPOTA behavior, and erase/re-bootstrap scenarios.
  • Adds negative-path tests for repeated PartInit and using a stale session after erase.
Comments suppressed due to low confidence (1)

ddi/tbor/types/tests/commands/part_init/sd_config.rs:680

  • sd_config_distinct_sata_and_sapota_values_emu appears redundant with part_init_with_distinct_sata_and_sapota_thumbprints_emu earlier in this file (same inputs and same assertions). Given TestCtx serializes tests via a process-global lock, duplicating equivalent PartInit roundtrips can significantly increase test runtime. Consider removing one of the duplicates or consolidating these cases into a single table-driven test.
/// Verifies that distinct SATA and SAPOTA values are accepted independently.
#[test]
fn sd_config_distinct_sata_and_sapota_values_emu() {
    let ctx = TestCtx::new();
    let session = bootstrap_rotated_co(&ctx, &ROTATED_CO_PSK);

Comment thread ddi/tbor/types/tests/commands/part_init/sd_config.rs
Comment thread ddi/tbor/types/tests/commands/part_init/sd_config.rs Outdated
Comment thread ddi/tbor/types/tests/commands/part_init/sd_config.rs
Comment thread ddi/tbor/types/tests/commands/part_init/sd_config.rs Outdated
Copilot AI review requested due to automatic review settings July 30, 2026 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (4)

ddi/tbor/types/tests/commands/part_init/sd_config.rs:725

  • This loop hard-codes both the length (0..48) and the last index (47 - index). Deriving from the array length (sata.len() / sapota.len()) makes the test resilient to size changes and avoids an off-by-one risk if the constant is updated in only one place.
    for index in 0..48 {
        sata[index] = index as u8;
        sapota[index] = (47 - index) as u8;
    }

ddi/tbor/types/tests/commands/part_init/sd_config.rs:693

  • This loop hard-codes the thumbprint length (0..48). Since the arrays already carry their length, using sata.len() avoids future breakage if the thumbprint size changes.

This issue also appears on line 722 of the same file.

    for index in 0..48 {

ddi/tbor/types/tests/commands/part_init/sd_config.rs:652

  • This file introduces assert_part_init_artifacts_present! to centralize the PTA artifact assertions, but this new test still duplicates the same two assert!(!is_empty()) checks. Using the macro keeps messages consistent and reduces repeated boilerplate across the many SD config test cases.
    assert!(!resp.pta_csr.is_empty(), "PTACSR must be non-empty");
    assert!(!resp.pta_report.is_empty(), "PTAReport must be non-empty");

ddi/tbor/types/tests/commands/part_init/sd_config.rs:659

  • sd_config_distinct_sata_and_sapota_values_emu duplicates part_init_with_distinct_sata_and_sapota_thumbprints_emu earlier in this file (same SATA/SAPOTA values, same PartInit call, same assertions). Since TestCtx::new() holds a process-global lock for the test lifetime (ddi/tbor/types/tests/harness/ctx.rs:66-78), keeping both tests increases suite runtime without adding coverage. Please remove one of the duplicates (or change this one to cover a distinct scenario).
/// Verifies that distinct SATA and SAPOTA values are accepted independently.
#[test]
fn sd_config_distinct_sata_and_sapota_values_emu() {
    let ctx = TestCtx::new();
    let session = bootstrap_rotated_co(&ctx, &ROTATED_CO_PSK);

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