Do not panic when upgrade info tells to hold

Before running tests, a sanity upgrade was run to gather the amount of
flash writes to be expected for the operation. This operation fails when
the dependencies hold an upgrade, so the checks were updated to avoid
aborting under those circumstances.

Signed-off-by: Fabio Utzig <utzig@apache.org>
This commit is contained in:
Fabio Utzig 2019-08-28 10:59:22 -03:00 committed by Fabio Utzig
parent 019a81a4f4
commit 7c1d1557f2
1 changed files with 5 additions and 3 deletions

View File

@ -191,9 +191,11 @@ impl ImagesBuilder {
// upgrades without fails, counts number of flash operations
let total_count = match images.run_basic_upgrade(permanent) {
Ok(v) => v,
Err(_) => {
panic!("Unable to perform basic upgrade");
},
Err(_) =>
match deps.upgrades[0] {
UpgradeInfo::Held => 0,
UpgradeInfo::Upgraded => panic!("Unable to perform basic upgrade"),
},
};
images.total_count = Some(total_count);