sim: Test variants of single upgrade with multi-image
Test the variations of the situation where we are built for multi-image,
but are only upgrading a single image, including no dependencies,
correct dependencies, and unmet dependencies.
Signed-off-by: David Brown <david.brown@linaro.org>
Signed-off-by: Fabio Utzig <utzig@apache.org>
diff --git a/sim/tests/core.rs b/sim/tests/core.rs
index dc0b0a5..00f16c3 100644
--- a/sim/tests/core.rs
+++ b/sim/tests/core.rs
@@ -66,7 +66,7 @@
/// These are the variants of dependencies we will test.
pub static TEST_DEPS: &[DepTest] = &[
- // First is a sanity test, no dependencies should upgrade.
+ // A sanity test, no dependencies should upgrade.
DepTest {
depends: [DepType::Nothing, DepType::Nothing],
upgrades: [UpgradeInfo::Upgraded, UpgradeInfo::Upgraded],
@@ -98,6 +98,43 @@
upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
},
+ // Test where only the first image is upgraded, and there are no
+ // dependencies.
+ DepTest {
+ depends: [DepType::Nothing, DepType::NoUpgrade],
+ upgrades: [UpgradeInfo::Upgraded, UpgradeInfo::Held],
+ },
+
+ // Test one image with a valid dependency on the first image.
+ DepTest {
+ depends: [DepType::OldCorrect, DepType::NoUpgrade],
+ upgrades: [UpgradeInfo::Upgraded, UpgradeInfo::Held],
+ },
+
+ // Test one image with an invalid dependency on the first image.
+ DepTest {
+ depends: [DepType::Newer, DepType::NoUpgrade],
+ upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
+ },
+
+ // Test where only the second image is upgraded, and there are no
+ // dependencies.
+ DepTest {
+ depends: [DepType::NoUpgrade, DepType::Nothing],
+ upgrades: [UpgradeInfo::Held, UpgradeInfo::Upgraded],
+ },
+
+ // Test one image with a valid dependency on the second image.
+ DepTest {
+ depends: [DepType::NoUpgrade, DepType::OldCorrect],
+ upgrades: [UpgradeInfo::Held, UpgradeInfo::Upgraded],
+ },
+
+ // Test one image with an invalid dependency on the second image.
+ DepTest {
+ depends: [DepType::NoUpgrade, DepType::Newer],
+ upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
+ },
];
/// Counter for the image number.