mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'ci/migrate_app_update_unit_test_app' into 'master'
ci: Migrate app_update unit tests from unit-test-app to component-test-app Closes IDF-5565 See merge request espressif/esp-idf!20432
This commit is contained in:
commit
9abe294064
@ -901,7 +901,7 @@ test_app_test_eth:
|
||||
|
||||
UT_001:
|
||||
extends: .unit_test_esp32_template
|
||||
parallel: 42
|
||||
parallel: 40
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
@ -910,7 +910,7 @@ UT_001:
|
||||
|
||||
UT_002:
|
||||
extends: .unit_test_esp32_template
|
||||
parallel: 15
|
||||
parallel: 14
|
||||
tags:
|
||||
- ESP32_IDF
|
||||
- UT_T1_1
|
||||
@ -1000,7 +1000,7 @@ UT_034:
|
||||
|
||||
UT_035:
|
||||
extends: .unit_test_esp32s2_template
|
||||
parallel: 43
|
||||
parallel: 41
|
||||
tags:
|
||||
- ESP32S2_IDF
|
||||
- UT_T1_1
|
||||
@ -1088,7 +1088,7 @@ UT_S2_SDSPI:
|
||||
|
||||
UT_C2:
|
||||
extends: .unit_test_esp32c2_template
|
||||
parallel: 19
|
||||
parallel: 17
|
||||
tags:
|
||||
- ESP32C2_IDF
|
||||
- UT_T1_1
|
||||
@ -1120,7 +1120,7 @@ UT_C2_FLASH:
|
||||
|
||||
UT_C3:
|
||||
extends: .unit_test_esp32c3_template
|
||||
parallel: 26
|
||||
parallel: 24
|
||||
tags:
|
||||
- ESP32C3_IDF
|
||||
- UT_T1_1
|
||||
@ -1157,7 +1157,7 @@ UT_C3_SDSPI:
|
||||
|
||||
UT_S3:
|
||||
extends: .unit_test_esp32s3_template
|
||||
parallel: 24
|
||||
parallel: 22
|
||||
tags:
|
||||
- ESP32S3_IDF
|
||||
- UT_T1_1
|
||||
|
7
components/app_update/test_apps/CMakeLists.txt
Normal file
7
components/app_update/test_apps/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
#This is the project CMakeLists.txt file for the test subproject
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/tools/unit-test-app/components")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
project(app_update_test)
|
3
components/app_update/test_apps/README.md
Normal file
3
components/app_update/test_apps/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- |
|
||||
|
@ -1,5 +1,5 @@
|
||||
idf_component_register(SRC_DIRS "."
|
||||
PRIV_INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES cmock test_utils app_update bootloader_support nvs_flash driver
|
||||
)
|
||||
WHOLE_ARCHIVE)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")
|
16
components/app_update/test_apps/main/app_main.c
Normal file
16
components/app_update/test_apps/main/app_main.c
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include "unity.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "nvs.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
unity_run_menu();
|
||||
ESP_ERROR_CHECK(nvs_flash_deinit());
|
||||
}
|
@ -23,6 +23,7 @@
|
||||
#include "bootloader_common.h"
|
||||
#include "../bootloader_flash/include/bootloader_flash_priv.h"
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_partition.h"
|
||||
@ -34,13 +35,32 @@
|
||||
#include "esp_sleep.h"
|
||||
#include "test_utils.h"
|
||||
|
||||
|
||||
#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
|
||||
//IDF-5131
|
||||
RTC_DATA_ATTR static int boot_count = 0;
|
||||
#define BOOT_COUNT_NAMESPACE "boot_count"
|
||||
|
||||
static const char *TAG = "ota_test";
|
||||
|
||||
static void set_boot_count_in_nvs(uint8_t boot_count)
|
||||
{
|
||||
nvs_handle_t boot_count_handle;
|
||||
TEST_ESP_OK(nvs_open(BOOT_COUNT_NAMESPACE, NVS_READWRITE, &boot_count_handle));
|
||||
TEST_ESP_OK(nvs_set_u8(boot_count_handle, "boot_count", boot_count));
|
||||
TEST_ESP_OK(nvs_commit(boot_count_handle));
|
||||
nvs_close(boot_count_handle);
|
||||
}
|
||||
|
||||
static uint8_t get_boot_count_from_nvs(void)
|
||||
{
|
||||
nvs_handle_t boot_count_handle;
|
||||
esp_err_t err = nvs_open(BOOT_COUNT_NAMESPACE, NVS_READONLY, &boot_count_handle);
|
||||
if (err == ESP_ERR_NVS_NOT_FOUND) {
|
||||
set_boot_count_in_nvs(0);
|
||||
}
|
||||
uint8_t boot_count;
|
||||
TEST_ESP_OK(nvs_get_u8(boot_count_handle, "boot_count", &boot_count));
|
||||
nvs_close(boot_count_handle);
|
||||
return boot_count;
|
||||
}
|
||||
|
||||
/* @brief Copies a current app to next partition using handle.
|
||||
*
|
||||
* @param[in] update_handle - Handle of API ota.
|
||||
@ -313,7 +333,7 @@ static void mark_app_valid(void)
|
||||
static void start_test(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "boot count 1 - reset");
|
||||
boot_count = 1;
|
||||
set_boot_count_in_nvs(1);
|
||||
erase_ota_data();
|
||||
ESP_LOGI(TAG, "ota_data erased");
|
||||
reboot_as_deep_sleep();
|
||||
@ -321,7 +341,9 @@ static void start_test(void)
|
||||
|
||||
static void test_flow1(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
@ -364,7 +386,9 @@ TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, OTA0", "[app_u
|
||||
|
||||
static void test_flow2(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
@ -401,7 +425,9 @@ TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, corrupt ota_sec1, fa
|
||||
|
||||
static void test_flow3(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
@ -441,64 +467,36 @@ static void test_flow3(void)
|
||||
// 3 Stage: run OTA0 -> check it -> copy OTA0 to OTA1 -> reboot --//--
|
||||
// 3 Stage: run OTA1 -> check it -> corrupt ota sector2 -> reboot --//--
|
||||
// 4 Stage: run OTA0 -> check it -> erase OTA_DATA for next tests -> PASS
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, currupt ota_sec2, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, OTA1, corrupt ota_sec2, OTA0", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow3, test_flow3, test_flow3, test_flow3);
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_FACTORY_RESET
|
||||
#define STORAGE_NAMESPACE "update_ota"
|
||||
|
||||
static void test_flow4(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
nvs_handle_t handle = 0;
|
||||
int32_t boot_count_nvs = 0;
|
||||
switch (boot_count) {
|
||||
case 2:
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
|
||||
|
||||
TEST_ESP_OK(nvs_flash_erase());
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
TEST_ESP_OK(nvs_open(STORAGE_NAMESPACE, NVS_READWRITE, &handle));
|
||||
TEST_ESP_OK(nvs_set_i32(handle, "boot_count", boot_count));
|
||||
TEST_ESP_OK(nvs_commit(handle));
|
||||
nvs_close(handle);
|
||||
nvs_flash_deinit();
|
||||
|
||||
copy_current_app_to_next_part_and_reboot();
|
||||
break;
|
||||
case 3:
|
||||
ESP_LOGI(TAG, "OTA0");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_OTA_0, cur_app->subtype);
|
||||
mark_app_valid();
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
TEST_ESP_OK(nvs_open(STORAGE_NAMESPACE, NVS_READWRITE, &handle));
|
||||
TEST_ESP_OK(nvs_get_i32(handle, "boot_count", &boot_count_nvs));
|
||||
TEST_ASSERT_EQUAL(boot_count_nvs + 1, boot_count);
|
||||
nvs_close(handle);
|
||||
nvs_flash_deinit();
|
||||
|
||||
set_output_pin(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET);
|
||||
|
||||
reboot_as_deep_sleep();
|
||||
esp_restart();
|
||||
break;
|
||||
case 4:
|
||||
reset_output_pin(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET);
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
|
||||
|
||||
int32_t boot_count_nvs;
|
||||
TEST_ESP_OK(nvs_flash_init());
|
||||
TEST_ESP_OK(nvs_open(STORAGE_NAMESPACE, NVS_READWRITE, &handle));
|
||||
TEST_ESP_ERR(ESP_ERR_NVS_NOT_FOUND, nvs_get_i32(handle, "boot_count", &boot_count_nvs));
|
||||
nvs_close(handle);
|
||||
nvs_flash_deinit();
|
||||
|
||||
erase_ota_data();
|
||||
break;
|
||||
default:
|
||||
reset_output_pin(CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET);
|
||||
erase_ota_data();
|
||||
TEST_FAIL_MESSAGE("Unexpected stage");
|
||||
break;
|
||||
@ -506,33 +504,32 @@ static void test_flow4(void)
|
||||
}
|
||||
// 1 Stage: After POWER_RESET erase OTA_DATA for this test -> reboot through deep sleep.
|
||||
// 2 Stage: run factory -> check it -> copy factory to OTA0 -> reboot --//--
|
||||
// 3 Stage: run OTA0 -> check it -> set_pin_factory_reset -> reboot --//--
|
||||
// 3 Stage: run OTA0 -> check it -> set_pin_factory_reset -> reboot
|
||||
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, OTA0, sets pin_factory_reset, factory", "[app_update][timeout=90][reset=DEEPSLEEP_RESET, SW_CPU_RESET, DEEPSLEEP_RESET]", start_test, test_flow4, test_flow4, test_flow4);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BOOTLOADER_APP_TEST
|
||||
static void test_flow5(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
case 2:
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_FACTORY, cur_app->subtype);
|
||||
|
||||
set_output_pin(CONFIG_BOOTLOADER_NUM_PIN_APP_TEST);
|
||||
|
||||
copy_partition(esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_TEST, NULL), cur_app);
|
||||
esp_partition_find_first(ESP_PARTITION_TYPE_DATA, ESP_PARTITION_SUBTYPE_DATA_OTA, NULL);
|
||||
reboot_as_deep_sleep();
|
||||
esp_restart();
|
||||
break;
|
||||
case 3:
|
||||
reset_output_pin(CONFIG_BOOTLOADER_NUM_PIN_APP_TEST);
|
||||
ESP_LOGI(TAG, "Test");
|
||||
TEST_ASSERT_EQUAL(ESP_PARTITION_SUBTYPE_APP_TEST, cur_app->subtype);
|
||||
reboot_as_deep_sleep();
|
||||
esp_restart();
|
||||
break;
|
||||
case 4:
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
@ -548,10 +545,10 @@ static void test_flow5(void)
|
||||
}
|
||||
|
||||
// 1 Stage: After POWER_RESET erase OTA_DATA for this test -> reboot through deep sleep.
|
||||
// 2 Stage: run factory -> check it -> copy factory to Test and set pin_test_app -> reboot --//--
|
||||
// 3 Stage: run test -> check it -> reset pin_test_app -> reboot --//--
|
||||
// 2 Stage: run factory -> check it -> copy factory to Test and set pin_test_app -> reboot
|
||||
// 3 Stage: run test -> check it -> reset pin_test_app -> reboot
|
||||
// 4 Stage: run factory -> check it -> erase OTA_DATA for next tests -> PASS
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][ignore][reset=DEEPSLEEP_RESET, DEEPSLEEP_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
|
||||
TEST_CASE_MULTIPLE_STAGES("Switching between factory, test, factory", "[app_update][timeout=90][reset=SW_CPU_RESET, SW_CPU_RESET, DEEPSLEEP_RESET]", start_test, test_flow5, test_flow5, test_flow5);
|
||||
#endif
|
||||
|
||||
static const esp_partition_t* app_update(void)
|
||||
@ -570,7 +567,9 @@ static const esp_partition_t* app_update(void)
|
||||
|
||||
static void test_rollback1(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
esp_ota_img_states_t ota_state = 0x5555AAAA;
|
||||
@ -621,8 +620,9 @@ static void test_rollback1(void)
|
||||
|
||||
static void test_rollback1_1(void)
|
||||
{
|
||||
boot_count = 5;
|
||||
set_boot_count_in_nvs(5);
|
||||
esp_ota_img_states_t ota_state = 0x5555AAAA;
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
ESP_LOGI(TAG, "Factory");
|
||||
@ -649,7 +649,9 @@ TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA0, rollback -> facto
|
||||
|
||||
static void test_rollback2(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
esp_ota_img_states_t ota_state = 0x5555AAAA;
|
||||
@ -714,7 +716,8 @@ static void test_rollback2(void)
|
||||
|
||||
static void test_rollback2_1(void)
|
||||
{
|
||||
boot_count = 5;
|
||||
set_boot_count_in_nvs(5);
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
esp_ota_img_states_t ota_state = 0x5555AAAA;
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
@ -747,7 +750,9 @@ TEST_CASE_MULTIPLE_STAGES("Test rollback. factory, OTA0, OTA1, rollback -> OTA0"
|
||||
|
||||
static void test_erase_last_app_flow(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
@ -780,7 +785,8 @@ static void test_erase_last_app_flow(void)
|
||||
|
||||
static void test_erase_last_app_rollback(void)
|
||||
{
|
||||
boot_count = 5;
|
||||
set_boot_count_in_nvs(5);
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
ESP_LOGI(TAG, "erase_last_app");
|
||||
@ -798,7 +804,9 @@ TEST_CASE_MULTIPLE_STAGES("Test erase_last_boot_app_partition. factory, OTA1, OT
|
||||
|
||||
static void test_flow6(void)
|
||||
{
|
||||
uint8_t boot_count = get_boot_count_from_nvs();
|
||||
boot_count++;
|
||||
set_boot_count_in_nvs(boot_count);
|
||||
ESP_LOGI(TAG, "boot count %d", boot_count);
|
||||
const esp_partition_t *cur_app = get_running_firmware();
|
||||
switch (boot_count) {
|
||||
@ -847,4 +855,3 @@ TEST_CASE("Test bootloader_common_get_sha256_of_partition returns ESP_ERR_IMAGE_
|
||||
TEST_ESP_ERR(ESP_ERR_IMAGE_INVALID, bootloader_common_get_sha256_of_partition(other_app->address, other_app->size, other_app->type, sha_256_other_app));
|
||||
TEST_ASSERT_EQUAL_MEMORY_MESSAGE(sha_256_cur_app, sha_256_other_app, sizeof(sha_256_cur_app), "must be the same");
|
||||
}
|
||||
#endif //!TEMPORARY_DISABLED_FOR_TARGETS(ESP32C2)
|
@ -0,0 +1,11 @@
|
||||
# Special partition table for unit test app_update
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, , 0x4000
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000
|
||||
factory, 0, 0, , 0xB0000
|
||||
ota_0, 0, ota_0, , 0xB0000
|
||||
ota_1, 0, ota_1, , 0xB0000
|
||||
test, 0, test, , 0xB0000
|
||||
# flash_test partition used for SPI flash tests, WL FAT tests, and SPIFFS tests
|
||||
flash_test, data, fat, , 528K
|
|
@ -0,0 +1,11 @@
|
||||
# Special partition table for unit test app_update
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, , 0x4000
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000
|
||||
factory, 0, 0, , 0x70000
|
||||
ota_0, 0, ota_0, , 0x70000
|
||||
ota_1, 0, ota_1, , 0x70000
|
||||
test, 0, test, , 0x70000
|
||||
# flash_test partition used for SPI flash tests, WL FAT tests, and SPIFFS tests
|
||||
flash_test, data, fat, , 128K
|
|
31
components/app_update/test_apps/pytest_app_update_ut.py
Normal file
31
components/app_update/test_apps/pytest_app_update_ut.py
Normal file
@ -0,0 +1,31 @@
|
||||
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
import re
|
||||
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
|
||||
DEFAULT_TIMEOUT = 20
|
||||
TEST_SUBMENU_PATTERN_PYTEST = re.compile(rb'\s+\((\d+)\)\s+"([^"]+)"\r?\n')
|
||||
|
||||
|
||||
def run_multiple_stages(dut: Dut, test_case_num: int, stages: int) -> None:
|
||||
for stage in range(1, stages + 1):
|
||||
dut.write(str(test_case_num))
|
||||
dut.expect(TEST_SUBMENU_PATTERN_PYTEST, timeout=DEFAULT_TIMEOUT)
|
||||
dut.write(str(stage))
|
||||
if stage != stages:
|
||||
dut.expect_exact('Press ENTER to see the list of tests.')
|
||||
|
||||
|
||||
@pytest.mark.supported_targets
|
||||
@pytest.mark.generic
|
||||
def test_app_update(dut: Dut) -> None:
|
||||
extra_data = dut.parse_test_menu()
|
||||
for test_case in extra_data:
|
||||
if test_case.type != 'multi_stage':
|
||||
dut.write(str(test_case.index))
|
||||
else:
|
||||
run_multiple_stages(dut, test_case.index, len(test_case.subcases))
|
||||
dut.expect_unity_test_output(timeout=90)
|
||||
dut.expect_exact("Enter next test, or 'enter' to see menu")
|
18
components/app_update/test_apps/sdkconfig.defaults
Normal file
18
components/app_update/test_apps/sdkconfig.defaults
Normal file
@ -0,0 +1,18 @@
|
||||
# General options for additional checks
|
||||
CONFIG_HEAP_POISONING_COMPREHENSIVE=y
|
||||
CONFIG_COMPILER_WARN_WRITE_STRINGS=y
|
||||
CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
|
||||
CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK=y
|
||||
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
|
||||
CONFIG_COMPILER_STACK_CHECK=y
|
||||
|
||||
CONFIG_ESP_TASK_WDT=n
|
||||
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x18000
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
||||
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
|
7
components/app_update/test_apps/sdkconfig.defaults.esp32
Normal file
7
components/app_update/test_apps/sdkconfig.defaults.esp32
Normal file
@ -0,0 +1,7 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=y
|
||||
CONFIG_BOOTLOADER_APP_TEST=y
|
||||
CONFIG_BOOTLOADER_DATA_FACTORY_RESET=""
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=32
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
@ -0,0 +1,5 @@
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota_2m.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota_2m.csv"
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -0,0 +1,2 @@
|
||||
CONFIG_IDF_TARGET="esp32c3"
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -0,0 +1,2 @@
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -1,15 +0,0 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_COMPONENTS=app_update
|
||||
TEST_EXCLUDE_COMPONENTS=bt
|
||||
CONFIG_UNITY_FREERTOS_STACK_SIZE=12288
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x18000
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=y
|
||||
CONFIG_BOOTLOADER_APP_TEST=y
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
||||
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=32
|
@ -1,15 +0,0 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32c2"
|
||||
TEST_COMPONENTS=app_update
|
||||
TEST_EXCLUDE_COMPONENTS=bt
|
||||
CONFIG_UNITY_FREERTOS_STACK_SIZE=12288
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota_2m.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota_2m.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x18000
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=y
|
||||
CONFIG_BOOTLOADER_APP_TEST=y
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
||||
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -1,15 +0,0 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32c3"
|
||||
TEST_COMPONENTS=app_update
|
||||
TEST_EXCLUDE_COMPONENTS=bt
|
||||
CONFIG_UNITY_FREERTOS_STACK_SIZE=12288
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x18000
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=y
|
||||
CONFIG_BOOTLOADER_APP_TEST=y
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
||||
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -1,15 +0,0 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
TEST_COMPONENTS=app_update
|
||||
TEST_EXCLUDE_COMPONENTS=bt
|
||||
CONFIG_UNITY_FREERTOS_STACK_SIZE=12288
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partition_table_unit_test_two_ota.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x18000
|
||||
CONFIG_BOOTLOADER_FACTORY_RESET=y
|
||||
CONFIG_BOOTLOADER_APP_TEST=y
|
||||
CONFIG_BOOTLOADER_HOLD_TIME_GPIO=2
|
||||
CONFIG_BOOTLOADER_OTA_DATA_ERASE=y
|
||||
CONFIG_BOOTLOADER_NUM_PIN_FACTORY_RESET=4
|
||||
CONFIG_BOOTLOADER_NUM_PIN_APP_TEST=18
|
@ -1,5 +1,4 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_COMPONENTS=bt
|
||||
TEST_EXCLUDE_COMPONENTS=app_update
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_UNITY_FREERTOS_STACK_SIZE=12288
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This config is split between targets since different component needs to be excluded
|
||||
CONFIG_IDF_TARGET="esp32c3"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update esp_pm freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs lwip experimental_cpp_component perfmon test_utils
|
||||
TEST_EXCLUDE_COMPONENTS=bt esp_pm freertos esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs lwip spiffs experimental_cpp_component perfmon test_utils
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component
|
||||
|
@ -1,3 +1,3 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32s3"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp32s3 esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component test_utils
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp32s3 esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs experimental_cpp_component test_utils
|
||||
|
@ -1,5 +1,5 @@
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update driver esp_hw_support esp_ipc esp_pm esp_system esp_timer spi_flash test_utils soc experimental_cpp_component esp-tls freertos sdmmc
|
||||
TEST_EXCLUDE_COMPONENTS=bt driver esp_hw_support esp_ipc esp_pm esp_system esp_timer spi_flash test_utils soc experimental_cpp_component esp-tls freertos sdmmc
|
||||
CONFIG_SPIRAM=y
|
||||
CONFIG_ESP_INT_WDT_TIMEOUT_MS=800
|
||||
CONFIG_SPIRAM_OCCUPY_NO_HOST=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This config is split between targets since different component needs to be included (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
||||
CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_system esp_pm esp_ipc esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_system esp_pm esp_ipc esp_timer driver soc spi_flash vfs test_utils experimental_cpp_component
|
||||
CONFIG_MEMMAP_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This config is split between targets since different component needs to be excluded (esp32, esp32s2)
|
||||
CONFIG_IDF_TARGET="esp32s2"
|
||||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_system esp_pm esp_timer driver soc spi_flash vfs experimental_cpp_component
|
||||
TEST_EXCLUDE_COMPONENTS=bt freertos esp_hw_support esp_ipc esp_system esp_pm esp_timer driver soc spi_flash vfs experimental_cpp_component
|
||||
CONFIG_MEMMAP_SMP=n
|
||||
CONFIG_FREERTOS_UNICORE=y
|
||||
CONFIG_ESP32S2_RTCDATA_IN_FAST_MEM=y
|
||||
|
Loading…
x
Reference in New Issue
Block a user