2017-11-03 05:39:21 +08:00
|
|
|
//! Core tests
|
|
|
|
//!
|
|
|
|
//! Run the existing testsuite as a Rust unit test.
|
|
|
|
|
|
|
|
extern crate bootsim;
|
|
|
|
|
2017-11-07 05:30:05 +08:00
|
|
|
use bootsim::{Run, testlog};
|
2017-11-03 05:39:21 +08:00
|
|
|
|
2017-11-07 05:30:05 +08:00
|
|
|
macro_rules! sim_test {
|
|
|
|
($name:ident, $maker:ident, $test:ident) => {
|
|
|
|
#[test]
|
|
|
|
fn $name() {
|
|
|
|
testlog::setup();
|
2017-11-03 22:37:38 +08:00
|
|
|
|
2017-11-07 05:30:05 +08:00
|
|
|
Run::each_device(|r| {
|
|
|
|
let image = r.$maker();
|
|
|
|
assert!(!image.$test());
|
|
|
|
});
|
2017-11-03 05:39:21 +08:00
|
|
|
}
|
2017-11-07 05:30:05 +08:00
|
|
|
};
|
2017-11-03 05:39:21 +08:00
|
|
|
}
|
2017-11-07 05:30:05 +08:00
|
|
|
|
|
|
|
sim_test!(bad_slot1, make_bad_slot1_image, run_signfail_upgrade);
|
|
|
|
sim_test!(norevert_newimage, make_no_upgrade_image, run_norevert_newimage);
|
|
|
|
sim_test!(basic_revert, make_image, run_basic_revert);
|
|
|
|
sim_test!(revert_with_fails, make_image, run_revert_with_fails);
|
|
|
|
sim_test!(perm_with_fails, make_image, run_perm_with_fails);
|
|
|
|
sim_test!(perm_with_random_fails, make_image, run_perm_with_random_fails_5);
|
|
|
|
sim_test!(norevert, make_image, run_norevert);
|
2017-11-24 18:11:05 +08:00
|
|
|
sim_test!(status_write_fails_complete, make_image, run_with_status_fails_complete);
|
2017-11-24 20:48:52 +08:00
|
|
|
sim_test!(status_write_fails_with_reset, make_image, run_with_status_fails_with_reset);
|