mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(spi_flash): add common test_flash_utils component
This commit is contained in:
parent
5948c4b8ff
commit
5d3f2c7571
@ -0,0 +1,5 @@
|
||||
set(srcs "test_flash_utils.c")
|
||||
|
||||
idf_component_register(SRCS ${srcs}
|
||||
INCLUDE_DIRS include
|
||||
REQUIRES esp_partition)
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <esp_types.h>
|
||||
#include "esp_partition.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Return the 'flash_test' custom data partition
|
||||
* defined in the custom partition table.
|
||||
*
|
||||
* @return partition handle
|
||||
*/
|
||||
const esp_partition_t *get_test_flash_partition(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,17 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "test_flash_utils.h"
|
||||
|
||||
const esp_partition_t *get_test_flash_partition(void)
|
||||
{
|
||||
/* This finds "flash_test" partition defined in custom partitions.csv */
|
||||
const esp_partition_t *result = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
|
||||
ESP_PARTITION_SUBTYPE_ANY, "flash_test");
|
||||
assert(result != NULL); /* means partition table set wrong */
|
||||
return result;
|
||||
}
|
@ -1,7 +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")
|
||||
set(EXTRA_COMPONENT_DIRS "$ENV{IDF_PATH}/components/spi_flash/test_apps/components")
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
|
@ -4,4 +4,5 @@ set(srcs "test_app_main.c"
|
||||
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
|
||||
# the component can be registered as WHOLE_ARCHIVE
|
||||
idf_component_register(SRCS ${srcs}
|
||||
PRIV_REQUIRES test_flash_utils spi_flash unity
|
||||
WHOLE_ARCHIVE)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -15,9 +15,9 @@
|
||||
#include "esp_check.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_partition.h"
|
||||
#include "test_flash_utils.h"
|
||||
|
||||
portMUX_TYPE s_test_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
portMUX_TYPE static s_test_spinlock = portMUX_INITIALIZER_UNLOCKED;
|
||||
|
||||
/*---------------------------------------------------------------
|
||||
ESP Flash API Concurrency Pressure Test
|
||||
@ -33,17 +33,6 @@ typedef struct {
|
||||
const esp_partition_t *part;
|
||||
} test_concurrency_ctx_t;
|
||||
|
||||
|
||||
static const esp_partition_t *get_test_flash_partition(void)
|
||||
{
|
||||
/* This finds "flash_test" partition defined in partition_table_unit_test_app.csv */
|
||||
const esp_partition_t *result = esp_partition_find_first(ESP_PARTITION_TYPE_DATA,
|
||||
ESP_PARTITION_SUBTYPE_ANY, "flash_test");
|
||||
assert(result != NULL); /* means partition table set wrong */
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void s_test_flash_ops_task(void *arg)
|
||||
{
|
||||
test_concurrency_ctx_t *test_ctx = (test_concurrency_ctx_t *)arg;
|
||||
|
Loading…
Reference in New Issue
Block a user