forked from espressif/esp-idf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'ci/migrate_esp-tls_unit_test_app' into 'master'
ci: Migrate esp-tls unit tests from unit-test-app to component-test-app Closes IDF-5571 See merge request espressif/esp-idf!20099
- Loading branch information
Showing
16 changed files
with
105 additions
and
51 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(esp-tls_test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-S2 | ESP32-S3 | | ||
| ----------------- | ----- | -------- | -------- | -------- | -------- | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
idf_component_register(SRC_DIRS "." | ||
PRIV_REQUIRES test_utils esp-tls unity | ||
WHOLE_ARCHIVE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/task.h" | ||
#include "unity.h" | ||
#include "memory_checks.h" | ||
#include "soc/soc_caps.h" | ||
#if SOC_SHA_SUPPORT_PARALLEL_ENG | ||
#include "sha/sha_parallel_engine.h" | ||
#elif SOC_SHA_SUPPORT_DMA | ||
#include "sha/sha_dma.h" | ||
#else | ||
#include "sha/sha_block.h" | ||
#endif | ||
|
||
#if SOC_SHA_SUPPORT_SHA512 | ||
#define SHA_TYPE SHA2_512 | ||
#else | ||
#define SHA_TYPE SHA2_256 | ||
#endif //SOC_SHA_SUPPORT_SHA512 | ||
|
||
/* setUp runs before every test */ | ||
void setUp(void) | ||
{ | ||
// Execute esp_sha operation to allocate internal SHA semaphore memory | ||
// which is considered as leaked otherwise | ||
const uint8_t input_buffer[64] = {0}; | ||
uint8_t output_buffer[64]; | ||
esp_sha(SHA_TYPE, input_buffer, sizeof(input_buffer), output_buffer); | ||
test_utils_record_free_mem(); | ||
TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_GENERAL)); | ||
TEST_ESP_OK(test_utils_set_leak_level(0, ESP_LEAK_TYPE_WARNING, ESP_COMP_LEAK_GENERAL)); | ||
|
||
} | ||
|
||
/* tearDown runs after every test */ | ||
void tearDown(void) | ||
{ | ||
/* some FreeRTOS stuff is cleaned up by idle task */ | ||
vTaskDelay(5); | ||
|
||
/* clean up some of the newlib's lazy allocations */ | ||
esp_reent_cleanup(); | ||
|
||
/* check if unit test has caused heap corruption in any heap */ | ||
TEST_ASSERT_MESSAGE( heap_caps_check_integrity(MALLOC_CAP_INVALID, true), "The test has corrupted the heap"); | ||
|
||
test_utils_finish_and_evaluate_leaks(test_utils_get_leak_level(ESP_LEAK_TYPE_WARNING, ESP_COMP_LEAK_ALL), | ||
test_utils_get_leak_level(ESP_LEAK_TYPE_CRITICAL, ESP_COMP_LEAK_ALL)); | ||
|
||
} | ||
|
||
void app_main(void) | ||
{ | ||
unity_run_menu(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD | ||
# SPDX-License-Identifier: Apache-2.0 | ||
import pytest | ||
from pytest_embedded import Dut | ||
|
||
|
||
@pytest.mark.supported_targets | ||
@pytest.mark.generic | ||
def test_esp_tls(dut: Dut) -> None: | ||
dut.expect_exact('Press ENTER to see the list of tests') | ||
dut.write('*') | ||
dut.expect_unity_test_output() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 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_ESP_TLS_SERVER=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls | ||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs lwip spiffs experimental_cpp_component perfmon esp-tls test_utils | ||
TEST_EXCLUDE_COMPONENTS=bt app_update esp_pm freertos esp_hw_support esp_ipc esp_system esp_timer driver heap pthread soc spi_flash vfs lwip spiffs experimental_cpp_component perfmon test_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs experimental_cpp_component esp-tls | ||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs experimental_cpp_component esp-tls test_utils | ||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp32s3 esp_ipc esp_pm esp_system esp_timer driver heap pthread soc spi_flash vfs experimental_cpp_component test_utils |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls | ||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_ipc esp_pm esp_system esp_timer driver heap pthread 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 heap pthread soc spi_flash vfs test_utils experimental_cpp_component esp-tls | ||
TEST_EXCLUDE_COMPONENTS=bt app_update freertos esp_hw_support esp_system esp_pm esp_ipc esp_timer driver heap pthread soc spi_flash vfs test_utils experimental_cpp_component | ||
CONFIG_MEMMAP_SMP=n | ||
CONFIG_FREERTOS_UNICORE=y | ||
CONFIG_ESP32_RTCDATA_IN_FAST_MEM=y |