Skip to content

Commit

Permalink
Merge branch 'test/move_gpspi_to_pytest_app' into 'master'
Browse files Browse the repository at this point in the history
spi: move spi related unit test into itself pytest app

Closes IDF-5499 and IDFCI-1377

See merge request espressif/esp-idf!19341
  • Loading branch information
wanckl committed Nov 11, 2022
2 parents bae4a5c + de2f5ac commit c093224
Show file tree
Hide file tree
Showing 61 changed files with 741 additions and 320 deletions.
13 changes: 0 additions & 13 deletions .gitlab/ci/rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1874,19 +1874,6 @@
when: never
- <<: *if-label-unit_test_esp32c2

.rules:test:unit_test-esp32c2-spi_multi:
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-target_test
- <<: *if-label-unit_test
- <<: *if-label-unit_test_esp32c2
- <<: *if-dev-push
changes: *patterns-unit_test-spi_multi

.rules:test:unit_test-esp32c3:
rules:
- <<: *if-revert-branch
Expand Down
67 changes: 8 additions & 59 deletions .gitlab/ci/target-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,14 @@ component_ut_pytest_esp32c2_adc:
- build_pytest_components_esp32c2
tags: [ esp32c2, adc ]

component_ut_pytest_esp32c2_generic_multi_device:
extends:
- .pytest_components_dir_template
- .rules:test:component_ut-esp32c2
needs:
- build_pytest_components_esp32c2
tags: [ esp32c2, generic_multi_device, xtal_40mhz ]

component_ut_pytest_esp32c2_xtal_26mhz:
extends:
- .pytest_components_dir_template
Expand Down Expand Up @@ -975,13 +983,6 @@ UT_018:
- UT_T1_1
- 8Mpsram

UT_020:
extends: .unit_test_esp32_template
tags:
- ESP32_IDF
- Example_SPI_Multi_device
- psram

UT_022:
extends: .unit_test_esp32_template
tags:
Expand Down Expand Up @@ -1060,37 +1061,6 @@ UT_045:
- UT_SDIO
- psram

UT_S2_SPI_DUAL:
extends: .unit_test_esp32s2_template
tags:
- ESP32S2_IDF
- Example_SPI_Multi_device

UT_S2_SPI_QUAD:
extends: .unit_test_esp32s2_template
tags:
- ESP32S2_IDF
- Example_SPI_Quad_Multi_device

UT_S3_SPI_QUAD:
extends: .unit_test_esp32s3_template
tags:
- ESP32S3_IDF
- Example_SPI_Quad_Multi_device

UT_C2_SPI_QUAD:
extends: .unit_test_esp32c2_template
tags:
- ESP32C2_IDF
- Example_SPI_Quad_Multi_device
- xtal_40mhz

UT_C3_SPI_QUAD:
extends: .unit_test_esp32c3_template
tags:
- ESP32C3_IDF
- Example_SPI_Quad_Multi_device

UT_S2_SDSPI:
extends: .unit_test_esp32s2_template
tags:
Expand All @@ -1105,15 +1075,6 @@ UT_C2:
- UT_T1_1
- xtal_40mhz

UT_C2_SPI_DUAL:
extends:
- .unit_test_esp32c2_template
- .rules:test:unit_test-esp32c2-spi_multi
tags:
- ESP32C2_IDF
- Example_SPI_Multi_device
- xtal_40mhz

UT_C2_26M:
extends: .unit_test_esp32c2_template
tags:
Expand Down Expand Up @@ -1142,12 +1103,6 @@ UT_C3_FLASH:
- ESP32C3_IDF
- UT_T1_ESP_FLASH

UT_C3_SPI_DUAL:
extends: .unit_test_esp32c3_template
tags:
- ESP32C3_IDF
- Example_SPI_Multi_device

UT_C3_I2C:
extends: .unit_test_esp32c3_template
tags:
Expand Down Expand Up @@ -1181,12 +1136,6 @@ UT_S3_QUAD_PSRAM:
- UT_T1_1
- quad_psram

UT_S3_SPI_DUAL:
extends: .unit_test_esp32s3_template
tags:
- ESP32S3_IDF
- Example_SPI_Multi_device

UT_S3_FLASH:
extends: .unit_test_esp32s3_template
tags:
Expand Down
12 changes: 5 additions & 7 deletions components/driver/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
idf_component_register(SRC_DIRS . param_test
PRIV_INCLUDE_DIRS include param_test/include
PRIV_REQUIRES cmock test_utils driver nvs_flash
esp_timer esp_adc esp_event esp_wifi spi_flash)
idf_component_register(
SRC_DIRS .
PRIV_INCLUDE_DIRS include
PRIV_REQUIRES test_utils driver nvs_flash esp_timer esp_event test_driver_utils esp_serial_slave_link
)
target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format")

# A local copy of idf-extra-components esp_serial_slave_link, for stabilities of the SDIO test
add_subdirectory(esp_serial_slave_link)
11 changes: 0 additions & 11 deletions components/driver/test/esp_serial_slave_link/CMakeLists.txt

This file was deleted.

4 changes: 1 addition & 3 deletions components/driver/test/test_sdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include "unity.h"
#include "test_utils.h"
#include "param_test.h"
#include "test_spi_utils.h"
#include "esp_log.h"
#include "esp_timer.h"
#include "soc/soc_caps.h"
Expand Down Expand Up @@ -115,8 +115,6 @@ const sdio_test_config_t* default_config = &test_cfg_array[0];

#define TEST_SIZE (sizeof(test_cfg_array)/sizeof(sdio_test_config_t))

static const char MASTER_TAG[] = "master";
static const char SLAVE_TAG[] = "slave";

/*******************************************************************************
* Master
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
idf_component_register(
SRCS "essl.c" "essl_sdio.c" "essl_spi.c"
INCLUDE_DIRS "include"
PRIV_INCLUDE_DIRS "." "include/esp_serial_slave_link"
REQUIRES sdmmc driver
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/

#include "essl.h"
#include "essl_internal.h"
#include "esp_log.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#include "essl.h"
#include "essl_internal.h"

#define TIME_EXPIRED_SINCE_CORE(start, end, timeout, max) (bool)((end)>=(start)? \
((end)-(start)>(timeout)) :\
((max)-(timeout)>(start)-(end)))
Expand Down Expand Up @@ -142,7 +144,7 @@ esp_err_t essl_get_tx_buffer_num(essl_handle_t handle, uint32_t *out_tx_num, uin
if (handle == NULL || out_tx_num == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (handle->update_tx_buffer_num == NULL|| handle->get_tx_buffer_num == NULL) {
if (handle->update_tx_buffer_num == NULL || handle->get_tx_buffer_num == NULL) {
return ESP_ERR_NOT_SUPPORTED;
}

Expand All @@ -160,7 +162,7 @@ esp_err_t essl_get_rx_data_size(essl_handle_t handle, uint32_t *out_rx_size, uin
if (handle == NULL || out_rx_size == NULL) {
return ESP_ERR_INVALID_ARG;
}
if (handle->update_rx_data_size == NULL|| handle->get_rx_data_size == NULL) {
if (handle->update_rx_data_size == NULL || handle->get_rx_data_size == NULL) {
return ESP_ERR_NOT_SUPPORTED;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@
/** Context used by the ``esp_serial_slave_link`` component.
*/
struct essl_dev_t {
void* args;
void *args;

esp_err_t (*init)(void* ctx, uint32_t wait_ms);
esp_err_t (*init)(void *ctx, uint32_t wait_ms);

esp_err_t (*wait_for_ready)(void *ctx, uint32_t wait_ms);
esp_err_t (*update_tx_buffer_num)(void *ctx, uint32_t wait_ms);
esp_err_t (*update_rx_data_size)(void *ctx, uint32_t wait_ms);
esp_err_t (*send_packet)(void *ctx, const void* start, size_t length, uint32_t wait_ms);
esp_err_t (*get_packet)(void *ctx, void* out_data, size_t size, uint32_t wait_ms);
esp_err_t (*write_reg)(void *ctx, uint8_t addr, uint8_t value, uint8_t* value_o, uint32_t wait_ms);
esp_err_t (*send_packet)(void *ctx, const void *start, size_t length, uint32_t wait_ms);
esp_err_t (*get_packet)(void *ctx, void *out_data, size_t size, uint32_t wait_ms);
esp_err_t (*write_reg)(void *ctx, uint8_t addr, uint8_t value, uint8_t *value_o, uint32_t wait_ms);
esp_err_t (*read_reg)(void *ctx, uint8_t add, uint8_t *value_o, uint32_t wait_ms);
esp_err_t (*wait_int)(void *ctx, uint32_t wait_ms);
esp_err_t (*clear_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
esp_err_t (*get_intr)(void* ctx, uint32_t* intr_raw, uint32_t *intr_st, uint32_t wait_ms);
esp_err_t (*set_intr_ena)(void* ctx, uint32_t ena_mask, uint32_t wait_ms);
esp_err_t (*get_intr_ena)(void* ctx, uint32_t* ena_mask_o, uint32_t wait_ms);
esp_err_t (*send_slave_intr)(void* ctx, uint32_t intr_mask, uint32_t wait_ms);
esp_err_t (*clear_intr)(void *ctx, uint32_t intr_mask, uint32_t wait_ms);
esp_err_t (*get_intr)(void *ctx, uint32_t *intr_raw, uint32_t *intr_st, uint32_t wait_ms);
esp_err_t (*set_intr_ena)(void *ctx, uint32_t ena_mask, uint32_t wait_ms);
esp_err_t (*get_intr_ena)(void *ctx, uint32_t *ena_mask_o, uint32_t wait_ms);
esp_err_t (*send_slave_intr)(void *ctx, uint32_t intr_mask, uint32_t wait_ms);

uint32_t (*get_tx_buffer_num)(void *ctx);
uint32_t (*get_rx_data_size)(void *ctx);
Expand Down

0 comments on commit c093224

Please sign in to comment.