File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -342,6 +342,19 @@ START_TEST(test_wolfBoot_set_partition_state)
342342
343343END_TEST
344344
345+ START_TEST (test_wolfBoot_get_partition_state_rejects_erased_magic )
346+ {
347+ uint8_t st = IMG_STATE_SUCCESS ;
348+
349+ mock_reset_partition_states ();
350+
351+ /* With no magic trailer set, reads must fail. */
352+ ck_assert_int_eq (wolfBoot_get_partition_state (PART_UPDATE , & st ), -1 );
353+ ck_assert_uint_eq (st , IMG_STATE_SUCCESS );
354+ ck_assert_uint_eq (mock_state [PART_UPDATE ].getstate_called , 0 );
355+ }
356+ END_TEST
357+
345358START_TEST (test_wolfBoot_misc_utils )
346359{
347360 uint16_t word2 = 0xA0B1 ;
@@ -373,6 +386,8 @@ Suite *wolfboot_suite(void)
373386 TCase * tcase_wolfBoot_set_partition_state = tcase_create ("wolfBoot_set_partition_state" );
374387 tcase_set_timeout (tcase_wolfBoot_set_partition_state , 20 );
375388 tcase_add_test (tcase_wolfBoot_set_partition_state , test_wolfBoot_set_partition_state );
389+ tcase_add_test (tcase_wolfBoot_set_partition_state ,
390+ test_wolfBoot_get_partition_state_rejects_erased_magic );
376391 suite_add_tcase (s , tcase_wolfBoot_set_partition_state );
377392
378393 TCase * tcase_wolfBoot_misc_utils = tcase_create ("wolfBoot_misc_utils" );
You can’t perform that action at this time.
0 commit comments