mirror of
https://github.com/espressif/esp-idf.git
synced 2025-10-02 18:10:57 +02:00
fix(unit_test): Fix esp_wifi and wpa_supplicant unit tests
- Fixed offchan and eloop unit tests - Added more targets for wpa_supplicant unit tests - Removed ESP_WIFI_TESTING_OPTIONS from esp_wifi Kconfig
This commit is contained in:
@@ -827,12 +827,6 @@ menu "Wi-Fi"
|
|||||||
Enabling this could increase the build size ~60kb
|
Enabling this could increase the build size ~60kb
|
||||||
depending on the project logging level.
|
depending on the project logging level.
|
||||||
|
|
||||||
config ESP_WIFI_TESTING_OPTIONS
|
|
||||||
bool "Add DPP testing code"
|
|
||||||
default n
|
|
||||||
help
|
|
||||||
Select this to enable unity test for DPP.
|
|
||||||
|
|
||||||
config ESP_WIFI_ENTERPRISE_SUPPORT
|
config ESP_WIFI_ENTERPRISE_SUPPORT
|
||||||
bool "Enable enterprise option"
|
bool "Enable enterprise option"
|
||||||
default y
|
default y
|
||||||
|
@@ -35,7 +35,6 @@ CONFIG_WPA_MBEDTLS_TLS_CLIENT CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT
|
|||||||
CONFIG_WPA_WAPI_PSK CONFIG_ESP_WIFI_WAPI_PSK
|
CONFIG_WPA_WAPI_PSK CONFIG_ESP_WIFI_WAPI_PSK
|
||||||
CONFIG_WPA_SUITE_B_192 CONFIG_ESP_WIFI_SUITE_B_192
|
CONFIG_WPA_SUITE_B_192 CONFIG_ESP_WIFI_SUITE_B_192
|
||||||
CONFIG_WPA_DEBUG_PRINT CONFIG_ESP_WIFI_DEBUG_PRINT
|
CONFIG_WPA_DEBUG_PRINT CONFIG_ESP_WIFI_DEBUG_PRINT
|
||||||
CONFIG_WPA_TESTING_OPTIONS CONFIG_ESP_WIFI_TESTING_OPTIONS
|
|
||||||
CONFIG_WPA_WPS_STRICT CONFIG_ESP_WIFI_WPS_STRICT
|
CONFIG_WPA_WPS_STRICT CONFIG_ESP_WIFI_WPS_STRICT
|
||||||
CONFIG_WPA_11KV_SUPPORT CONFIG_ESP_WIFI_11KV_SUPPORT
|
CONFIG_WPA_11KV_SUPPORT CONFIG_ESP_WIFI_11KV_SUPPORT
|
||||||
CONFIG_WPA_SCAN_CACHE CONFIG_ESP_WIFI_SCAN_CACHE
|
CONFIG_WPA_SCAN_CACHE CONFIG_ESP_WIFI_SCAN_CACHE
|
||||||
|
@@ -1,4 +1,10 @@
|
|||||||
idf_component_register(SRC_DIRS .
|
idf_component_register(SRCS
|
||||||
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
"app_main.c"
|
||||||
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_wifi esp_event
|
"test_wifi_conn.c"
|
||||||
WHOLE_ARCHIVE)
|
"test_bss_max_idle.c"
|
||||||
|
|
||||||
|
PRIV_INCLUDE_DIRS . ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
PRIV_REQUIRES cmock test_utils nvs_flash ulp esp_common esp_wifi esp_event
|
||||||
|
WHOLE_ARCHIVE)
|
||||||
|
|
||||||
|
add_definitions(-DCONFIG_ESP_WIFI_BSS_MAX_IDLE_SUPPORT)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
# ignore task watchdog triggered by unity_run_menu
|
# ignore task watchdog triggered by unity_run_menu
|
||||||
CONFIG_ESP_TASK_WDT_EN=n
|
CONFIG_ESP_TASK_WDT_EN=n
|
||||||
CONFIG_ESP_WIFI_BSS_MAX_IDLE_SUPPORT=y
|
|
||||||
CONFIG_FREERTOS_HZ=1000
|
CONFIG_FREERTOS_HZ=1000
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
config ESP_WIFI_TESTING_OPTIONS
|
||||||
|
bool
|
||||||
|
default y
|
@@ -37,6 +37,10 @@ static void callback(void *a, void *b)
|
|||||||
int32_t ms_diff = (age.sec - timeouts_sec[*i]) * 1000 +
|
int32_t ms_diff = (age.sec - timeouts_sec[*i]) * 1000 +
|
||||||
(age.usec - timeouts_usec[*i]) / 1000;
|
(age.usec - timeouts_usec[*i]) / 1000;
|
||||||
|
|
||||||
|
if (t > 5) {
|
||||||
|
TEST_ASSERT(0);
|
||||||
|
}
|
||||||
|
|
||||||
/* let's give 50 ms offset for this small block */
|
/* let's give 50 ms offset for this small block */
|
||||||
if (ms_diff > 50) {
|
if (ms_diff > 50) {
|
||||||
executed_order[t] = -1;
|
executed_order[t] = -1;
|
||||||
@@ -80,6 +84,7 @@ TEST_CASE("Test eloop timers run", "[eloop]")
|
|||||||
/* check the execution order, this will also check whether they were fired at correct time */
|
/* check the execution order, this will also check whether they were fired at correct time */
|
||||||
TEST_ASSERT(memcmp(execution_order, executed_order, 6 * sizeof(int)) == 0);
|
TEST_ASSERT(memcmp(execution_order, executed_order, 6 * sizeof(int)) == 0);
|
||||||
|
|
||||||
|
t = 0;
|
||||||
/* Add timers to check deinit happens gracefully */
|
/* Add timers to check deinit happens gracefully */
|
||||||
for (int i = 0; i < 6; i++) {
|
for (int i = 0; i < 6; i++) {
|
||||||
eloop_register_timeout(timeouts_sec[i], timeouts_usec[i],
|
eloop_register_timeout(timeouts_sec[i], timeouts_usec[i],
|
||||||
|
@@ -89,10 +89,12 @@ TEST_CASE("Test pbkdf2", "[crypto-pbkdf2]")
|
|||||||
}
|
}
|
||||||
TEST_ASSERT(memcmp(PMK, expected_pmk, PMK_LEN) == 0);
|
TEST_ASSERT(memcmp(PMK, expected_pmk, PMK_LEN) == 0);
|
||||||
|
|
||||||
|
#if 0
|
||||||
start_time = esp_timer_get_time();
|
start_time = esp_timer_get_time();
|
||||||
fastpbkdf2_hmac_sha1((const u8 *)passphrase, os_strlen((char *)passphrase), ssid, ssid_len, 4096, PMK, PMK_LEN);
|
fastpbkdf2_hmac_sha1((const u8 *)passphrase, os_strlen((char *)passphrase), ssid, ssid_len, 4096, PMK, PMK_LEN);
|
||||||
end_time = esp_timer_get_time();
|
end_time = esp_timer_get_time();
|
||||||
total_time_fast_pbkdf2 += (end_time - start_time);
|
total_time_fast_pbkdf2 += (end_time - start_time);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate average time for pbkdf2_sha1
|
// Calculate average time for pbkdf2_sha1
|
||||||
|
@@ -28,16 +28,13 @@
|
|||||||
#include "test_wpa_supplicant_common.h"
|
#include "test_wpa_supplicant_common.h"
|
||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
#define WIFI_START_EVENT 0x00000001
|
#define WIFI_START_EVENT BIT(0)
|
||||||
#define WIFI_ROC_DONE_EVENT 0x00000002
|
#define WIFI_ROC_DONE_EVENT BIT(1)
|
||||||
#define WIFI_ACTION_RX_EVENT 0x00000003
|
#define WIFI_ACTION_RX_EVENT BIT(2)
|
||||||
#define WIFI_SCAN_DONE_EVENT 0x00000004
|
#define WIFI_SCAN_DONE_EVENT BIT(3)
|
||||||
|
|
||||||
#define TEST_LISTEN_CHANNEL 6
|
#define TEST_LISTEN_CHANNEL 6
|
||||||
|
|
||||||
/* No runners; IDF-5046 */
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
|
||||||
|
|
||||||
static const char *TAG = "test_offchan";
|
static const char *TAG = "test_offchan";
|
||||||
esp_netif_t *wifi_netif;
|
esp_netif_t *wifi_netif;
|
||||||
static EventGroupHandle_t wifi_event;
|
static EventGroupHandle_t wifi_event;
|
||||||
@@ -268,5 +265,3 @@ static void test_wifi_roc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE_MULTIPLE_DEVICES("test ROC and Offchannel Action Frame Tx", "[Offchan][test_env=wifi_two_dut][timeout=90]", test_wifi_roc, test_wifi_offchan_tx);
|
TEST_CASE_MULTIPLE_DEVICES("test ROC and Offchannel Action Frame Tx", "[Offchan][test_env=wifi_two_dut][timeout=90]", test_wifi_roc, test_wifi_offchan_tx);
|
||||||
|
|
||||||
#endif //CONFIG_IDF_TARGET_ESP32
|
|
||||||
|
@@ -24,7 +24,11 @@ def test_wpa_supplicant_ut(dut: Dut) -> None:
|
|||||||
],
|
],
|
||||||
indirect=True,
|
indirect=True,
|
||||||
)
|
)
|
||||||
@idf_parametrize('target', ['esp32'], indirect=['target'])
|
@idf_parametrize(
|
||||||
|
'target',
|
||||||
|
['esp32', 'esp32s2', 'esp32s3', 'esp32c6', 'esp32c61', 'esp32c5'],
|
||||||
|
indirect=['target'],
|
||||||
|
)
|
||||||
def test_wpa_supplicant_ut_offchan(case_tester: CaseTester) -> None:
|
def test_wpa_supplicant_ut_offchan(case_tester: CaseTester) -> None:
|
||||||
for case in case_tester.test_menu:
|
for case in case_tester.test_menu:
|
||||||
if case.attributes.get('test_env') == 'wifi_two_dut':
|
if case.attributes.get('test_env') == 'wifi_two_dut':
|
||||||
|
0
components/wpa_supplicant/test_apps/sdkconfig.ci
Normal file
0
components/wpa_supplicant/test_apps/sdkconfig.ci
Normal file
@@ -1,5 +1,5 @@
|
|||||||
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
||||||
CONFIG_ESP_TASK_WDT=n
|
CONFIG_ESP_TASK_WDT_EN=n
|
||||||
CONFIG_ESP_WIFI_TESTING_OPTIONS=y
|
CONFIG_ESP_WIFI_TESTING_OPTIONS=y
|
||||||
CONFIG_ESP_WIFI_DPP_SUPPORT=y
|
CONFIG_ESP_WIFI_DPP_SUPPORT=y
|
||||||
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y
|
CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y
|
||||||
|
Reference in New Issue
Block a user