From edf41b1c35837f2abe1606dacafdb7aa6ad310ef Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Thu, 17 Sep 2026 09:29:03 +0200 Subject: [PATCH] Verify partition isolation in custom-trailer state test After writing both partitions, re-read BOOT and confirm it still holds TESTING, so a backend that routes both IDs to the same trailer is caught (previously each read followed its own write). Verification: make -C tools/unit-tests unit-custom-trailer-nopart exits 0; suite runs 1 check, 0 failures. --- tools/unit-tests/unit-custom-trailer-nopart.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/unit-tests/unit-custom-trailer-nopart.c b/tools/unit-tests/unit-custom-trailer-nopart.c index 0099143e..16e05911 100644 --- a/tools/unit-tests/unit-custom-trailer-nopart.c +++ b/tools/unit-tests/unit-custom-trailer-nopart.c @@ -94,6 +94,11 @@ START_TEST(test_set_get_partition_state) ck_assert_int_eq(wolfBoot_get_partition_state(PART_UPDATE, &st), 0); ck_assert_uint_eq(st, IMG_STATE_UPDATING); + /* Writing UPDATE must not clobber BOOT: re-read BOOT and confirm it + * still holds TESTING, not the UPDATE value. */ + ck_assert_int_eq(wolfBoot_get_partition_state(PART_BOOT, &st), 0); + ck_assert_uint_eq(st, IMG_STATE_TESTING); + /* PART_NONE is rejected. */ ck_assert_int_eq(wolfBoot_set_partition_state(PART_NONE, 0), -1); ck_assert_int_eq(wolfBoot_get_partition_state(PART_NONE, &st), -1);