Skip to content

Commit 6e1b2aa

Browse files
committed
ci(esp_wifi): Extend eloop test to verify wifi deinit properly
1 parent 859d18a commit 6e1b2aa

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/wpa_supplicant/test_apps/main/test_eloop.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -25,7 +25,6 @@ static int executed_order[6];
2525
static int t;
2626
static struct os_reltime ts;
2727

28-
2928
/* there is only single instance of esp_timer so no need of protection */
3029
static void callback(void *a, void *b)
3130
{
@@ -80,6 +79,15 @@ TEST_CASE("Test eloop timers run", "[eloop]")
8079
os_sleep(20, 0);
8180
/* check the execution order, this will also check whether they were fired at correct time */
8281
TEST_ASSERT(memcmp(execution_order, executed_order, 6 * sizeof(int)) == 0);
82+
83+
/* Add timers to check deinit happens gracefully */
84+
for (int i = 0; i < 6; i++) {
85+
eloop_register_timeout(timeouts_sec[i], timeouts_usec[i],
86+
callback, &index[i], NULL);
87+
}
88+
89+
/* Stop wifi before all the timers have run */
90+
os_sleep(2, 0);
8391
TEST_ESP_OK(esp_wifi_stop());
8492
TEST_ESP_OK(esp_wifi_deinit());
8593
os_sleep(3, 0);

0 commit comments

Comments
 (0)