Enable overwrite-only testing on sim
Adds the feature to enable testing of overwrite-only functionality. While running with this feature enabled, disable tests that try to revert and disables trailer verification, since overwrite-only doesn't rely on status writing. Signed-off-by: Fabio Utzig <utzig@apache.org>
This commit is contained in:
parent
ffa3fb23bf
commit
100bb74b54
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
language: rust
|
language: rust
|
||||||
script:
|
script:
|
||||||
- cd sim; cargo build --release
|
- set -e
|
||||||
- cd sim; cargo run --release -- runall
|
- cd sim
|
||||||
- cd sim; cargo run --release --features sig-rsa -- runall
|
- cargo build --release
|
||||||
|
- cargo run --release -- runall
|
||||||
|
- cargo run --release --features sig-rsa -- runall
|
||||||
|
- cargo run --release --features overwrite-only -- runall
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
slack:
|
slack:
|
||||||
|
|
|
@ -7,6 +7,7 @@ authors = ["David Brown <davidb@davidb.org>"]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
sig-rsa = ["mcuboot-sys/sig-rsa"]
|
sig-rsa = ["mcuboot-sys/sig-rsa"]
|
||||||
|
overwrite-only = ["mcuboot-sys/overwrite-only"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gcc = "0.3.38"
|
gcc = "0.3.38"
|
||||||
|
|
|
@ -315,6 +315,13 @@ fn run_basic_upgrade(flash: &SimFlash, areadesc: &AreaDesc, images: &Images)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "overwrite-only")]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn run_basic_revert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn run_basic_revert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
fn run_basic_revert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
||||||
let mut fails = 0;
|
let mut fails = 0;
|
||||||
|
|
||||||
|
@ -413,6 +420,14 @@ fn run_perm_with_random_fails(flash: &SimFlash, areadesc: &AreaDesc,
|
||||||
fails > 0
|
fails > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "overwrite-only")]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn run_revert_with_fails(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
||||||
|
total_count: i32) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn run_revert_with_fails(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
fn run_revert_with_fails(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
||||||
total_count: i32) -> bool {
|
total_count: i32) -> bool {
|
||||||
let mut fails = 0;
|
let mut fails = 0;
|
||||||
|
@ -430,6 +445,13 @@ fn run_revert_with_fails(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
||||||
fails > 0
|
fails > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "overwrite-only")]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
fn run_norevert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn run_norevert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
fn run_norevert(flash: &SimFlash, areadesc: &AreaDesc, images: &Images) -> bool {
|
||||||
let mut fl = flash.clone();
|
let mut fl = flash.clone();
|
||||||
let mut fails = 0;
|
let mut fails = 0;
|
||||||
|
@ -612,6 +634,7 @@ fn try_upgrade(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
||||||
(fl, count - c::get_flash_counter())
|
(fl, count - c::get_flash_counter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn try_revert(flash: &SimFlash, areadesc: &AreaDesc, count: usize) -> SimFlash {
|
fn try_revert(flash: &SimFlash, areadesc: &AreaDesc, count: usize) -> SimFlash {
|
||||||
let mut fl = flash.clone();
|
let mut fl = flash.clone();
|
||||||
c::set_flash_counter(0);
|
c::set_flash_counter(0);
|
||||||
|
@ -624,6 +647,7 @@ fn try_revert(flash: &SimFlash, areadesc: &AreaDesc, count: usize) -> SimFlash {
|
||||||
fl
|
fl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn try_revert_with_fail_at(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
fn try_revert_with_fail_at(flash: &SimFlash, areadesc: &AreaDesc, images: &Images,
|
||||||
stop: i32) -> bool {
|
stop: i32) -> bool {
|
||||||
let mut fl = flash.clone();
|
let mut fl = flash.clone();
|
||||||
|
@ -834,6 +858,16 @@ fn verify_image(flash: &Flash, offset: usize, buf: &[u8]) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "overwrite-only")]
|
||||||
|
#[allow(unused_variables)]
|
||||||
|
// overwrite-only doesn't employ trailer management
|
||||||
|
fn verify_trailer(flash: &Flash, offset: usize,
|
||||||
|
magic: Option<&[u8]>, image_ok: Option<u8>,
|
||||||
|
copy_done: Option<u8>) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "overwrite-only"))]
|
||||||
fn verify_trailer(flash: &Flash, offset: usize,
|
fn verify_trailer(flash: &Flash, offset: usize,
|
||||||
magic: Option<&[u8]>, image_ok: Option<u8>,
|
magic: Option<&[u8]>, image_ok: Option<u8>,
|
||||||
copy_done: Option<u8>) -> bool {
|
copy_done: Option<u8>) -> bool {
|
||||||
|
|
Loading…
Reference in New Issue