test_verify_image.c 1009 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Tests for bootloader_support esp_image_basic_verify()
  3. */
  4. #include <esp_types.h>
  5. #include <stdio.h>
  6. #include "rom/ets_sys.h"
  7. #include "freertos/FreeRTOS.h"
  8. #include "freertos/task.h"
  9. #include "freertos/semphr.h"
  10. #include "freertos/queue.h"
  11. #include "freertos/xtensa_api.h"
  12. #include "unity.h"
  13. #include "esp_partition.h"
  14. #include "esp_ota_ops.h"
  15. #include "esp_image_format.h"
  16. TEST_CASE("Verify bootloader image in flash", "[bootloader_support]")
  17. {
  18. uint32_t image_len = 0;
  19. TEST_ASSERT_EQUAL_HEX(ESP_OK, esp_image_basic_verify(0x1000, true, &image_len));
  20. TEST_ASSERT_NOT_EQUAL(0, image_len);
  21. }
  22. TEST_CASE("Verify unit test app image", "[bootloader_support]")
  23. {
  24. uint32_t image_len = 0;
  25. const esp_partition_t *running = esp_ota_get_running_partition();
  26. TEST_ASSERT_NOT_EQUAL(NULL, running);
  27. TEST_ASSERT_EQUAL_HEX(ESP_OK, esp_image_basic_verify(running->address, true, &image_len));
  28. TEST_ASSERT_NOT_EQUAL(0, image_len);
  29. TEST_ASSERT_TRUE(image_len <= running->size);
  30. }