Commit 18d301f5 authored by David Brown's avatar David Brown Committed by Fabio Utzig
Browse files

sim: Add additional tests for mismatched upgrades

Test the configuration where one image has its dependencies met and the
other does not, and make sure in these cases we just hold back from
upgrading entirely.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 17909888
Loading
Loading
Loading
Loading
+17 −0
Changes for sim/tests/core.rs: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -72,15 +72,32 @@ pub static TEST_DEPS: &[DepTest] = &[
        upgrades: [UpgradeInfo::Upgraded, UpgradeInfo::Upgraded],
    },

    // If all of the dependencies are met, we should also upgrade.
    DepTest {
        depends: [DepType::Correct, DepType::Correct],
        upgrades: [UpgradeInfo::Upgraded, UpgradeInfo::Upgraded],
    },

    // If none of the dependencies are met, the images should be held.
    DepTest {
        depends: [DepType::Newer, DepType::Newer],
        upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
    },

    // If the first image is not met, we should hold back on the
    // dependencies (it is not well defined what the correct behavior is
    // here, it could also be correct to upgrade only the second image).
    DepTest {
        depends: [DepType::Newer, DepType::Correct],
        upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
    },

    // Test the variant in the other direction.
    DepTest {
        depends: [DepType::Correct, DepType::Newer],
        upgrades: [UpgradeInfo::Held, UpgradeInfo::Held],
    },

];

/// Counter for the image number.