add more coverage to sd_config - #615
Open
meilu-git wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
PartInitSD configuration tests covering varied thumbprint byte patterns, optional SAPOTA behavior, and erase/re-bootstrap scenarios. - Adds negative-path tests for repeated
PartInitand using a stale session aftererase.
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_emuappears redundant withpart_init_with_distinct_sata_and_sapota_thumbprints_emuearlier in this file (same inputs and same assertions). GivenTestCtxserializes 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);
Contributor
There was a problem hiding this comment.
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, usingsata.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 twoassert!(!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_emuduplicatespart_init_with_distinct_sata_and_sapota_thumbprints_emuearlier in this file (same SATA/SAPOTA values, same PartInit call, same assertions). SinceTestCtx::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);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.