Merge branch 'feature/efuse_migrate_from_ut_app_to_test_app' into 'master'

efuse: Migrate efuse unit tests from unit-test-app to component test app

Closes IDF-5570

See merge request espressif/esp-idf!20756
This commit is contained in:
Konstantin Kondrashov
2022-10-26 18:25:20 +08:00
26 changed files with 78 additions and 28 deletions

View File

@@ -909,7 +909,7 @@ test_app_test_eth:
UT_001: UT_001:
extends: .unit_test_esp32_template extends: .unit_test_esp32_template
parallel: 40 parallel: 32
tags: tags:
- ESP32_IDF - ESP32_IDF
- UT_T1_1 - UT_T1_1
@@ -918,7 +918,7 @@ UT_001:
UT_002: UT_002:
extends: .unit_test_esp32_template extends: .unit_test_esp32_template
parallel: 14 parallel: 12
tags: tags:
- ESP32_IDF - ESP32_IDF
- UT_T1_1 - UT_T1_1
@@ -926,7 +926,6 @@ UT_002:
UT_003: UT_003:
extends: .unit_test_esp32_template extends: .unit_test_esp32_template
parallel: 2
tags: tags:
- ESP32_IDF - ESP32_IDF
- UT_T1_SDMODE - UT_T1_SDMODE
@@ -1008,7 +1007,7 @@ UT_034:
UT_035: UT_035:
extends: .unit_test_esp32s2_template extends: .unit_test_esp32s2_template
parallel: 41 parallel: 32
tags: tags:
- ESP32S2_IDF - ESP32S2_IDF
- UT_T1_1 - UT_T1_1
@@ -1096,7 +1095,7 @@ UT_S2_SDSPI:
UT_C2: UT_C2:
extends: .unit_test_esp32c2_template extends: .unit_test_esp32c2_template
parallel: 17 parallel: 15
tags: tags:
- ESP32C2_IDF - ESP32C2_IDF
- UT_T1_1 - UT_T1_1
@@ -1128,7 +1127,7 @@ UT_C2_FLASH:
UT_C3: UT_C3:
extends: .unit_test_esp32c3_template extends: .unit_test_esp32c3_template
parallel: 24 parallel: 21
tags: tags:
- ESP32C3_IDF - ESP32C3_IDF
- UT_T1_1 - UT_T1_1
@@ -1165,7 +1164,7 @@ UT_C3_SDSPI:
UT_S3: UT_S3:
extends: .unit_test_esp32s3_template extends: .unit_test_esp32s3_template
parallel: 22 parallel: 19
tags: tags:
- ESP32S3_IDF - ESP32S3_IDF
- UT_T1_1 - UT_T1_1
@@ -1186,7 +1185,6 @@ UT_S3_SPI_DUAL:
UT_S3_FLASH: UT_S3_FLASH:
extends: .unit_test_esp32s3_template extends: .unit_test_esp32s3_template
parallel: 2
tags: tags:
- ESP32S3_IDF - ESP32S3_IDF
- UT_T1_ESP_FLASH - UT_T1_ESP_FLASH

View File

@@ -0,0 +1,7 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/efuse/test_apps:
disable_test:
- if: IDF_TARGET in ["esp32s2", "esp32s3"]
temporary: true
reason: eFuse for S2 and S3 is similar to the C3 chip, so we only test for C3.

View File

@@ -0,0 +1,7 @@
#This is the project CMakeLists.txt file for the test subproject
cmake_minimum_required(VERSION 3.16)
set(COMPONENTS main)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(efuse_test)

View File

@@ -0,0 +1,3 @@
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 |
| ----------------- | ----- | -------- | -------- | -------- | -------- |

View File

@@ -13,7 +13,6 @@ endif()
set(src_dirs "." "${dir}") set(src_dirs "." "${dir}")
idf_component_register(SRC_DIRS "${src_dirs}" idf_component_register(SRC_DIRS "${src_dirs}"
PRIV_INCLUDE_DIRS "." "${dir}/include" "../private_include" "../${target}/private_include" PRIV_INCLUDE_DIRS "." "${dir}/include" "../../private_include" "../../${target}/private_include"
PRIV_REQUIRES cmock test_utils efuse bootloader_support esp_timer PRIV_REQUIRES cmock efuse bootloader_support esp_timer
) WHOLE_ARCHIVE)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

View File

@@ -19,7 +19,6 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "test_utils.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_rom_efuse.h" #include "esp_rom_efuse.h"
#include "bootloader_common.h" #include "bootloader_common.h"

View File

@@ -10,7 +10,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "unity.h" #include "unity.h"
#include "test_utils.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_efuse.h" #include "esp_efuse.h"
#include "esp_efuse_table.h" #include "esp_efuse_table.h"

View File

@@ -0,0 +1,14 @@
/*
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
#include "unity.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(void)
{
vTaskPrioritySet(NULL, 5);
unity_run_menu();
}

View File

@@ -20,7 +20,6 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "test_utils.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_rom_efuse.h" #include "esp_rom_efuse.h"
#include "bootloader_common.h" #include "bootloader_common.h"
@@ -29,6 +28,8 @@
#define MAC_FACTORY_HAS_CRC 1 #define MAC_FACTORY_HAS_CRC 1
#endif #endif
#define TASK_PRIORITY (5)
__attribute__((unused)) static const char* TAG = "efuse_test"; __attribute__((unused)) static const char* TAG = "efuse_test";
@@ -707,8 +708,8 @@ TEST_CASE("Batch mode is thread-safe", "[efuse]")
sema = xSemaphoreCreateBinary(); sema = xSemaphoreCreateBinary();
printf("\n"); printf("\n");
xTaskCreatePinnedToCore(task1, "task1", 3072, NULL, UNITY_FREERTOS_PRIORITY - 1, NULL, 0); xTaskCreatePinnedToCore(task1, "task1", 3072, NULL, TASK_PRIORITY - 1, NULL, 0);
xTaskCreatePinnedToCore(task2, "task2", 3072, NULL, UNITY_FREERTOS_PRIORITY - 1, NULL, 1); xTaskCreatePinnedToCore(task2, "task2", 3072, NULL, TASK_PRIORITY - 1, NULL, 1);
vTaskDelay(3000 / portTICK_PERIOD_MS); vTaskDelay(3000 / portTICK_PERIOD_MS);
xSemaphoreTake(sema, portMAX_DELAY); xSemaphoreTake(sema, portMAX_DELAY);
@@ -716,8 +717,8 @@ TEST_CASE("Batch mode is thread-safe", "[efuse]")
esp_efuse_utility_erase_virt_blocks(); esp_efuse_utility_erase_virt_blocks();
printf("\n"); printf("\n");
xTaskCreatePinnedToCore(task1, "task1", 3072, NULL, UNITY_FREERTOS_PRIORITY - 1, NULL, 0); xTaskCreatePinnedToCore(task1, "task1", 3072, NULL, TASK_PRIORITY - 1, NULL, 0);
xTaskCreatePinnedToCore(task3, "task3", 3072, NULL, UNITY_FREERTOS_PRIORITY - 1, NULL, 1); xTaskCreatePinnedToCore(task3, "task3", 3072, NULL, TASK_PRIORITY - 1, NULL, 1);
vTaskDelay(3000 / portTICK_PERIOD_MS); vTaskDelay(3000 / portTICK_PERIOD_MS);
xSemaphoreTake(sema, portMAX_DELAY); xSemaphoreTake(sema, portMAX_DELAY);
@@ -810,7 +811,7 @@ TEST_CASE("Check a case when ESP_ERR_DAMAGED_READING occurs during reading efuse
TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY, &mac, sizeof(mac) * 8)); TEST_ESP_OK(esp_efuse_read_field_blob(ESP_EFUSE_MAC_FACTORY, &mac, sizeof(mac) * 8));
ESP_LOGI(TAG, "read MAC address: %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); ESP_LOGI(TAG, "read MAC address: %02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
xTaskCreatePinnedToCore(reset_task, "reset_task", 3072, NULL, UNITY_FREERTOS_PRIORITY - 1, NULL, 1); xTaskCreatePinnedToCore(reset_task, "reset_task", 3072, NULL, TASK_PRIORITY - 1, NULL, 1);
uint8_t new_mac[6]; uint8_t new_mac[6];
for (int i = 0; i < 1000; ++i) { for (int i = 0; i < 1000; ++i) {

View File

@@ -19,7 +19,6 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "test_utils.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_rom_efuse.h" #include "esp_rom_efuse.h"
#include "bootloader_common.h" #include "bootloader_common.h"

View File

@@ -160,16 +160,16 @@ TEST_CASE("Test Coding Scheme for efuse manager", "[efuse]")
esp_efuse_utility_debug_dump_blocks(); esp_efuse_utility_debug_dump_blocks();
printf("Data from encoded\n"); printf("Data from encoded\n");
for (int j = 0; j < 8; ++j) { for (int j = 0; j < 8; ++j) {
printf("0x%08x ", encoded[j]); printf("0x%08lx ", encoded[j]);
} }
printf("\nData from w_data_after_coding\n"); printf("\nData from w_data_after_coding\n");
for (int j = 0; j < 8; ++j) { for (int j = 0; j < 8; ++j) {
printf("0x%08x ", w_data_after_coding[j]); printf("0x%08lx ", w_data_after_coding[j]);
} }
printf("\nData from buf\n"); printf("\nData from buf\n");
for (int j = 0; j < 8; ++j) { for (int j = 0; j < 8; ++j) {
printf("0x%08x ", *((uint32_t*)buf + j)); printf("0x%08lx ", *((uint32_t*)buf + j));
} }
printf("\n"); printf("\n");
#endif #endif

View File

@@ -19,7 +19,6 @@
#include "freertos/FreeRTOS.h" #include "freertos/FreeRTOS.h"
#include "freertos/task.h" #include "freertos/task.h"
#include "freertos/semphr.h" #include "freertos/semphr.h"
#include "test_utils.h"
#include "sdkconfig.h" #include "sdkconfig.h"
#include "esp_rom_efuse.h" #include "esp_rom_efuse.h"
#include "bootloader_common.h" #include "bootloader_common.h"

View File

@@ -10,7 +10,6 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "unity.h" #include "unity.h"
#include "test_utils.h"
#include "esp_log.h" #include "esp_log.h"
#include "esp_efuse.h" #include "esp_efuse.h"
#include "esp_efuse_table.h" #include "esp_efuse_table.h"

View File

@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Unlicense OR CC0-1.0
import pytest
from pytest_embedded import Dut
@pytest.mark.esp32
@pytest.mark.esp32c2
@pytest.mark.esp32c3
@pytest.mark.generic
def test_efuse(dut: Dut) -> None:
dut.expect_exact('Press ENTER to see the list of tests')
dut.write('*')
dut.expect_unity_test_output(timeout=200)

View File

@@ -0,0 +1,11 @@
# 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_INIT=n
CONFIG_EFUSE_VIRTUAL=y

View File

@@ -1,3 +1,3 @@
# This config is split between targets since different component needs to be included # This config is split between targets since different component needs to be included
CONFIG_IDF_TARGET="esp32c2" CONFIG_IDF_TARGET="esp32c2"
TEST_COMPONENTS=app_trace efuse esp_common esp_eth esp_hid esp_netif esp_phy esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc TEST_COMPONENTS=app_trace esp_common esp_eth esp_hid esp_netif esp_phy esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc

View File

@@ -1,3 +1,3 @@
# This config is split between targets since different component needs to be included # This config is split between targets since different component needs to be included
CONFIG_IDF_TARGET="esp32c2" CONFIG_IDF_TARGET="esp32c2"
TEST_EXCLUDE_COMPONENTS=app_trace efuse esp_common esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs TEST_EXCLUDE_COMPONENTS=app_trace esp_common esp_eth esp_hid esp_netif esp_phy esp_ringbuf esp_wifi espcoredump hal lwip mdns mqtt newlib nvs_flash partition_table sdmmc esp_hw_support esp_ipc esp_system esp_timer driver soc spi_flash vfs