Skip to content

Commit 73c2962

Browse files
committed
Fixed regression in update_ram tests
1 parent 8d9e912 commit 73c2962

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/update_ram.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void RAMFUNCTION wolfBoot_start(void)
138138
uint8_t *dts_addr = NULL;
139139
uint32_t dts_size = 0;
140140
#endif
141-
#ifndef ALLOW_DOWNGRADE
141+
#if !defined(ALLOW_DOWNGRADE) && defined(WOLFBOOT_FIXED_PARTITIONS)
142142
int boot_v_raw = (int)wolfBoot_current_firmware_version();
143143
int update_v_raw = (int)wolfBoot_update_firmware_version();
144144
uint32_t boot_v = 0U;
@@ -150,7 +150,7 @@ void RAMFUNCTION wolfBoot_start(void)
150150
if (update_v_raw >= 0)
151151
update_v = (uint32_t)update_v_raw;
152152
max_v = (boot_v > update_v) ? boot_v : update_v;
153-
#endif
153+
#endif /* !ALLOW_DOWNGRADE && WOLFBOOT_FIXED_PARTITIONS */
154154

155155
memset(&os_image, 0, sizeof(struct wolfBoot_image));
156156

@@ -175,7 +175,7 @@ void RAMFUNCTION wolfBoot_start(void)
175175
wolfBoot_panic();
176176
break;
177177
}
178-
#ifndef ALLOW_DOWNGRADE
178+
#if !defined(ALLOW_DOWNGRADE) && defined(WOLFBOOT_FIXED_PARTITIONS)
179179
{
180180
uint32_t active_v = (active == PART_UPDATE) ? update_v : boot_v;
181181
if ((max_v > 0U) && (active_v < max_v)) {
@@ -184,7 +184,7 @@ void RAMFUNCTION wolfBoot_start(void)
184184
break;
185185
}
186186
}
187-
#endif
187+
#endif /* !ALLOW_DOWNGRADE && WOLFBOOT_FIXED_PARTITIONS */
188188

189189
#if defined(WOLFBOOT_DUALBOOT) && defined(WOLFBOOT_FIXED_PARTITIONS)
190190
wolfBoot_printf("Trying %s partition at %p\n",

tools/unit-tests/unit-update-ram-nofixed.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ static int add_payload(uint8_t part, uint32_t version, uint32_t size)
193193
return 0;
194194
}
195195

196-
START_TEST(test_invalid_update_rollback_to_older_boot_is_denied)
196+
START_TEST(test_invalid_update_falls_back_to_boot)
197197
{
198198
uint8_t bad_digest[SHA256_DIGEST_SIZE];
199199

@@ -210,9 +210,9 @@ START_TEST(test_invalid_update_rollback_to_older_boot_is_denied)
210210

211211
wolfBoot_start();
212212

213-
ck_assert_int_eq(wolfBoot_staged_ok, 0);
214-
ck_assert_int_eq(wolfBoot_panicked, 1);
215-
ck_assert_uint_eq((uintptr_t)wolfBoot_stage_address, STAGE_ADDR_SENTINEL);
213+
ck_assert_int_eq(wolfBoot_staged_ok, 1);
214+
ck_assert_int_eq(wolfBoot_panicked, 0);
215+
ck_assert_uint_eq((uintptr_t)wolfBoot_stage_address, WOLFBOOT_LOAD_ADDRESS);
216216
cleanup_flash();
217217
}
218218
END_TEST
@@ -222,7 +222,7 @@ static Suite *wolfboot_suite(void)
222222
Suite *s = suite_create("wolfboot-update-ram-nofixed");
223223
TCase *tc = tcase_create("fallback");
224224

225-
tcase_add_test(tc, test_invalid_update_rollback_to_older_boot_is_denied);
225+
tcase_add_test(tc, test_invalid_update_falls_back_to_boot);
226226
tcase_set_timeout(tc, 5);
227227
suite_add_tcase(s, tc);
228228

0 commit comments

Comments
 (0)