Commit 0e6bc7fe authored by David Brown's avatar David Brown Committed by Fabio Utzig
Browse files

sim: Fix upgrade check

Instead of allowing a preliminary error if the first image is marked to
be held, allow this error if any of the images are marked to be held.
The error doesn't return which image caused the failure, so just check
if any are supposed to be held.

Signed-off-by: default avatarDavid Brown <david.brown@linaro.org>
Signed-off-by: default avatarFabio Utzig <utzig@apache.org>
parent 207c457d
Loading
Loading
Loading
Loading
+5 −4
Changes for sim/src/image.rs: 5 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -192,10 +192,11 @@ impl ImagesBuilder {
        let total_count = match images.run_basic_upgrade(permanent) {
            Ok(v)  => v,
            Err(_) =>
                match deps.upgrades[0] {
                    UpgradeInfo::Held => 0,
                    UpgradeInfo::Upgraded => panic!("Unable to perform basic upgrade"),
                },
                if deps.upgrades.iter().any(|u| *u == UpgradeInfo::Held) {
                    0
                } else {
                    panic!("Unable to perform basic upgrade");
                }
        };

        images.total_count = Some(total_count);