-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add driver test cases for PersistentDataAccessor. (#747)
PersistentData::assert_matches_layout() is executed on the host as part of the unit tests, but we also need to check the layout when compiled for risc-v, as some types have a different size on a 32-bit CPU.
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed under the Apache-2.0 license | ||
|
||
#![no_std] | ||
#![no_main] | ||
|
||
use caliptra_drivers::{PersistentData, PersistentDataAccessor}; | ||
use caliptra_test_harness::test_suite; | ||
|
||
fn test_persistent_data_layout() { | ||
PersistentData::assert_matches_layout(); | ||
} | ||
|
||
fn test_read_write() { | ||
{ | ||
let mut accessor = unsafe { PersistentDataAccessor::new() }; | ||
accessor.get_mut().fht.fht_marker = 0xfe9cd1c0; | ||
} | ||
{ | ||
let accessor = unsafe { PersistentDataAccessor::new() }; | ||
assert_eq!(accessor.get().fht.fht_marker, 0xfe9cd1c0); | ||
} | ||
} | ||
|
||
test_suite! { | ||
test_persistent_data_layout, | ||
test_read_write, | ||
} |
This file contains 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