Skip to content

Commit

Permalink
Rearrange runtime test to fix timeout on FPGA.
Browse files Browse the repository at this point in the history
caliptra-runtime::integration_tests::test_update failed because of a
timeout in the TRNG. The external TRNG is serviced by the AP cores in
the Zynq Ultrascale+. The test was previously booting Calitpra then
building the update image, but this would make the test fail because the
AP cores are too busy building to respond to the TRNG request. This
switches the order so it builds the update image and then starts booting
Caliptra. Which gives the AP cores the resources it needs to respond.
  • Loading branch information
zhalvorsen authored and jhand2 committed Oct 17, 2023
1 parent d5da674 commit 93a2b9e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions runtime/tests/runtime_integration_tests/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,26 @@ fn test_standard() {

#[test]
fn test_update() {
// Test that the normal runtime firmware boots.
// Ultimately, this will be useful for exercising Caliptra end-to-end
// via the mailbox.
let mut model = run_rt_test(None, None);

model.step_until(|m| m.soc_mbox().status().read().mbox_fsm_ps().mbox_idle());

let image_options = ImageOptions {
app_version: 0xaabbccdd,
..Default::default()
};
// Make image to update to
// Make image to update to. On the FPGA this needs to be done before executing the test,
// otherwise the test will fail because processor is too busy building to be able to respond to
// the TRNG call during the initial boot.
let image =
caliptra_builder::build_and_sign_image(&FMC_WITH_UART, &APP_WITH_UART, image_options)
.unwrap()
.to_bytes()
.unwrap();

// Test that the normal runtime firmware boots.
// Ultimately, this will be useful for exercising Caliptra end-to-end
// via the mailbox.
let mut model = run_rt_test(None, None);

model.step_until(|m| m.soc_mbox().status().read().mbox_fsm_ps().mbox_idle());

model
.mailbox_execute(u32::from(CommandId::FIRMWARE_LOAD), &image)
.unwrap();
Expand Down

0 comments on commit 93a2b9e

Please sign in to comment.