sim: Allow arguments to test entrypoints
Instead of a growing number of no-argument methods that just call other
methods with fixed arguments, change the `sim_test` macro to pass
through arguments to the test methods. This will make it easier to
further parameterize the test entrypoints.
Signed-off-by: David Brown <david.brown@linaro.org>
diff --git a/sim/src/image.rs b/sim/src/image.rs
index 90d3a77..becd2c4 100644
--- a/sim/src/image.rs
+++ b/sim/src/image.rs
@@ -155,7 +155,7 @@
}
}
- fn make_image_with_permanent(self, permanent: bool) -> Images {
+ pub fn make_image(self, permanent: bool) -> Images {
let mut images = self.make_no_upgrade_image();
for image in &images.images {
mark_upgrade(&mut images.flash, &image.slots[1]);
@@ -173,16 +173,6 @@
images
}
- /// Construct an `Images` for normal testing with perm upgrade.
- pub fn make_image(self) -> Images {
- self.make_image_with_permanent(true)
- }
-
- /// Construct an `Images` for normal testing with test upgrade.
- pub fn make_non_permanent_image(self) -> Images {
- self.make_image_with_permanent(false)
- }
-
pub fn make_bad_secondary_slot_image(self) -> Images {
let mut bad_flash = self.flash;
let images = self.slots.into_iter().map(|slots| {
@@ -390,10 +380,6 @@
fails > 0
}
- pub fn run_perm_with_random_fails_5(&self) -> bool {
- self.run_perm_with_random_fails(5)
- }
-
pub fn run_perm_with_random_fails(&self, total_fails: usize) -> bool {
let mut fails = 0;
let total_flash_ops = self.total_count.unwrap();
diff --git a/sim/src/lib.rs b/sim/src/lib.rs
index 1778713..1ed75dd 100644
--- a/sim/src/lib.rs
+++ b/sim/src/lib.rs
@@ -182,7 +182,7 @@
let images = run.clone().make_no_upgrade_image();
failed |= images.run_norevert_newimage();
- let images = run.make_image();
+ let images = run.make_image(true);
failed |= images.run_basic_revert();
failed |= images.run_revert_with_fails();