mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'refactor/simplify_mock_build_tests' into 'master'
refactor(cmock): simplified mock build tests See merge request espressif/esp-idf!30038
This commit is contained in:
commit
d9a6ae2b3c
@ -20,10 +20,6 @@ tools/test_apps/build_system/ld_non_contiguous_memory:
|
||||
disable:
|
||||
- if: SOC_MEM_NON_CONTIGUOUS_SRAM != 1
|
||||
|
||||
tools/test_apps/linux_compatible/driver_mock:
|
||||
enable:
|
||||
- if: IDF_TARGET == "linux"
|
||||
|
||||
tools/test_apps/linux_compatible/generic_build_test:
|
||||
enable:
|
||||
- if: IDF_TARGET in ["esp32", "esp32c3", "linux"]
|
||||
@ -34,11 +30,9 @@ tools/test_apps/linux_compatible/linux_freertos:
|
||||
enable:
|
||||
- if: IDF_TARGET == "linux"
|
||||
|
||||
tools/test_apps/linux_compatible/wifi_build_test:
|
||||
tools/test_apps/linux_compatible/mock_build_test:
|
||||
enable:
|
||||
- if: IDF_TARGET == "linux"
|
||||
disable_test:
|
||||
- if: IDF_TARGET == "linux"
|
||||
|
||||
tools/test_apps/peripherals/i2c_wifi:
|
||||
disable:
|
||||
|
@ -1,10 +0,0 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(COMPONENTS main)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/driver)
|
||||
|
||||
project(linux_driver_mock)
|
@ -1,2 +0,0 @@
|
||||
| Supported Targets | Linux |
|
||||
| ----------------- | ----- |
|
@ -1,3 +0,0 @@
|
||||
idf_component_register(SRCS "driver_mock_main.c"
|
||||
INCLUDE_DIRS ""
|
||||
REQUIRES driver)
|
@ -1,11 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(COMPONENTS main)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/esp_wifi)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/esp_netif)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/esp_event)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/lwip)
|
||||
list(APPEND EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/tools/mocks/driver)
|
||||
|
||||
project(wifi_build_test)
|
||||
project(mock_build_test)
|
@ -0,0 +1,4 @@
|
||||
| Supported Targets | Linux |
|
||||
| ----------------- | ----- |
|
||||
|
||||
This application is a build test. It checks that all the mocks can be built correctly. Running it is possible but not useful.
|
@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS "mock_build_test.c"
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES driver esp_wifi)
|
@ -1,10 +1,13 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: CC0-1.0
|
||||
*/
|
||||
|
||||
/* Test that mock headers can be included */
|
||||
#include <stdio.h>
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_wifi.h"
|
||||
|
||||
#include "driver/i2c.h"
|
||||
#include "driver/i2c.h"
|
||||
#include "driver/spi_master.h"
|
||||
@ -12,6 +15,17 @@
|
||||
#include "driver/usb_serial_jtag.h"
|
||||
#include "driver/gpio.h"
|
||||
|
||||
/* Test that mock headers can be included */
|
||||
#include "Mockesp_wifi.h"
|
||||
#include "Mockesp_wifi_default.h"
|
||||
#include "Mockesp_wifi_netif.h"
|
||||
#include "Mockesp_wifi_he.h"
|
||||
#include "Mockesp_wifi_ap_get_sta_list.h"
|
||||
#include "Mockesp_netif.h"
|
||||
#include "Mockesp_mesh.h"
|
||||
#include "Mockesp_now.h"
|
||||
#include "Mockesp_smartconfig.h"
|
||||
#include "Mocksmartconfig_ack.h"
|
||||
#include "Mockrmt_encoder.h"
|
||||
#include "Mockrmt_common.h"
|
||||
#include "Mockrmt_tx.h"
|
||||
@ -20,6 +34,7 @@
|
||||
/* Test that mock functions exist and that required definitions are available */
|
||||
void app_main(void)
|
||||
{
|
||||
// Drivers
|
||||
i2c_driver_delete(0);
|
||||
int nc_gpio_num = GPIO_NUM_NC;
|
||||
(void)nc_gpio_num;
|
||||
@ -69,4 +84,51 @@ void app_main(void)
|
||||
rmt_new_tx_channel(NULL, NULL);
|
||||
|
||||
usb_serial_jtag_driver_install(NULL);
|
||||
|
||||
// WiFi
|
||||
esp_netif_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
|
||||
esp_netif_create_default_wifi_sta_IgnoreAndReturn(ESP_OK);
|
||||
esp_netif_create_default_wifi_sta();
|
||||
|
||||
esp_netif_create_default_wifi_ap_IgnoreAndReturn(ESP_OK);
|
||||
esp_netif_create_default_wifi_ap();
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_wifi_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
esp_wifi_set_mode_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_set_config_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_start_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, NULL) );
|
||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||
|
||||
esp_wifi_connect_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_connect();
|
||||
|
||||
esp_wifi_create_if_driver_IgnoreAndReturn(NULL);
|
||||
esp_wifi_create_if_driver((wifi_interface_t) NULL);
|
||||
|
||||
esp_wifi_ap_get_sta_list_with_ip_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_ap_get_sta_list_with_ip(NULL, NULL);
|
||||
|
||||
esp_wifi_sta_itwt_setup_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_sta_itwt_setup((wifi_twt_setup_config_t*) NULL);
|
||||
|
||||
sc_send_ack_stop_Ignore();
|
||||
sc_send_ack_stop();
|
||||
|
||||
esp_smartconfig_get_version_IgnoreAndReturn(NULL);
|
||||
esp_smartconfig_get_version();
|
||||
|
||||
esp_mesh_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_mesh_init());
|
||||
|
||||
esp_now_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_now_init());
|
||||
|
||||
printf("Mock build test done\n");
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
| Supported Targets | Linux |
|
||||
| ----------------- | ----- |
|
||||
|
||||
This application is a build test. It checks that the WiFi mocks can be built correctly. Running it is possible but not useful.
|
@ -1,3 +0,0 @@
|
||||
idf_component_register(SRCS "wifi_build_test.c"
|
||||
INCLUDE_DIRS "."
|
||||
PRIV_REQUIRES esp_wifi)
|
@ -1,68 +0,0 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
#include <stdio.h>
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "Mockesp_wifi.h"
|
||||
#include "Mockesp_wifi_default.h"
|
||||
#include "Mockesp_wifi_netif.h"
|
||||
#include "Mockesp_wifi_he.h"
|
||||
#include "Mockesp_wifi_ap_get_sta_list.h"
|
||||
#include "Mockesp_netif.h"
|
||||
#include "Mockesp_mesh.h"
|
||||
#include "Mockesp_now.h"
|
||||
#include "Mockesp_smartconfig.h"
|
||||
#include "Mocksmartconfig_ack.h"
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
esp_netif_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
|
||||
esp_netif_create_default_wifi_sta_IgnoreAndReturn(ESP_OK);
|
||||
esp_netif_create_default_wifi_sta();
|
||||
|
||||
esp_netif_create_default_wifi_ap_IgnoreAndReturn(ESP_OK);
|
||||
esp_netif_create_default_wifi_ap();
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
esp_wifi_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
|
||||
esp_wifi_set_mode_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_set_config_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_start_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, NULL) );
|
||||
ESP_ERROR_CHECK(esp_wifi_start() );
|
||||
|
||||
esp_wifi_connect_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_connect();
|
||||
|
||||
esp_wifi_create_if_driver_IgnoreAndReturn(NULL);
|
||||
esp_wifi_create_if_driver((wifi_interface_t) NULL);
|
||||
|
||||
esp_wifi_ap_get_sta_list_with_ip_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_ap_get_sta_list_with_ip(NULL, NULL);
|
||||
|
||||
esp_wifi_sta_itwt_setup_IgnoreAndReturn(ESP_OK);
|
||||
esp_wifi_sta_itwt_setup((wifi_twt_setup_config_t*) NULL);
|
||||
|
||||
sc_send_ack_stop_Ignore();
|
||||
sc_send_ack_stop();
|
||||
|
||||
esp_smartconfig_get_version_IgnoreAndReturn(NULL);
|
||||
esp_smartconfig_get_version();
|
||||
|
||||
esp_mesh_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_mesh_init());
|
||||
|
||||
esp_now_init_IgnoreAndReturn(ESP_OK);
|
||||
ESP_ERROR_CHECK(esp_now_init());
|
||||
|
||||
printf("WiFi build test done\n");
|
||||
}
|
Loading…
Reference in New Issue
Block a user