From e4576b888cc5c397cb0649b07b280423ccef6503 Mon Sep 17 00:00:00 2001 From: David Brown Date: Tue, 3 Sep 2019 12:26:18 -0600 Subject: [PATCH] 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 Signed-off-by: Fabio Utzig --- sim/tests/core.rs | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/sim/tests/core.rs b/sim/tests/core.rs index dc0b0a5d..00f16c36 100644 --- a/sim/tests/core.rs +++ b/sim/tests/core.rs @@ -66,7 +66,7 @@ test_shell!(dependency_combos, r, { /// 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 @@ pub static TEST_DEPS: &[DepTest] = &[ 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.