Skip to content

Commit 9eca8fe

Browse files
committed
Merge branch 'fix/add_wait_chip_enter_sleep_delay_in_ut' into 'master'
fix(esp_hw_support): fix gpio/ext1 wakeup test UT high failure rate Closes IDFCI-2848 and IDFCI-2847 See merge request espressif/esp-idf!38482
2 parents 465b159 + f554d77 commit 9eca8fe

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

components/esp_hw_support/test_apps/wakeup_tests/main/src/io_wakeup_cmd.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Unlicense OR CC0-1.0
55
*/
@@ -38,9 +38,13 @@ static int process_sleep(int argc, char **argv)
3838

3939
if (sleep_args.mode->count == 1) {
4040
if (sleep_args.mode->ival[0] == 0) {
41+
ESP_LOGI(TAG, "enter light sleep");
42+
fflush(stdout);
43+
fsync(fileno(stdout));
4144
esp_light_sleep_start();
42-
ESP_LOGI(TAG, "esp_light_sleep_start");
45+
ESP_LOGI(TAG, "wakeup from lightsleep");
4346
} else if (sleep_args.mode->ival[0] == 1) {
47+
ESP_LOGI(TAG, "enter deep sleep");
4448
esp_deep_sleep_start();
4549
} else {
4650
ESP_LOGE(TAG, "no valid arguments");
@@ -128,7 +132,7 @@ static void register_ext1_wakeup(void)
128132

129133
const esp_console_cmd_t cmd = {
130134
.command = "ext1",
131-
.help = "configue ext1 wakeup",
135+
.help = "configure ext1 wakeup",
132136
.hint = NULL,
133137
.func = &process_ext1_wakeup,
134138
.argtable = &ext1_wakeup_args
@@ -202,7 +206,7 @@ static void register_rtcio_wakeup(void)
202206

203207
const esp_console_cmd_t cmd = {
204208
.command = "rtcio",
205-
.help = "configue rtcio wakeup",
209+
.help = "configure rtcio wakeup",
206210
.hint = NULL,
207211
.func = &process_rtcio_wakeup,
208212
.argtable = &rtcio_wakeup_args
@@ -277,7 +281,7 @@ static void register_gpio_wakeup(void)
277281

278282
const esp_console_cmd_t cmd = {
279283
.command = "gpio",
280-
.help = "configue gpio wakeup",
284+
.help = "configure gpio wakeup",
281285
.hint = NULL,
282286
.func = &process_gpio_wakeup,
283287
.argtable = &gpio_wakeup_args
@@ -336,7 +340,7 @@ static void register_gpio_control(void)
336340

337341
const esp_console_cmd_t cmd = {
338342
.command = "gpio_control",
339-
.help = "configue gpio control",
343+
.help = "configure gpio control",
340344
.hint = NULL,
341345
.func = &process_gpio_control,
342346
.argtable = &gpio_control_args

components/esp_hw_support/test_apps/wakeup_tests/pytest_wakeup_tests.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,14 @@ def test_rtcio_deepsleep(dut: Tuple[IdfDut, IdfDut]) -> None:
113113
waker.expect(f'io_level = {sleep_level}', timeout=10)
114114

115115
wakee.write('sleep -m 1')
116+
wakee.expect('enter deep sleep', timeout=10)
117+
sleep(2)
116118

117119
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
118120
waker.expect(f'io_num = {gpio_num}', timeout=10)
119121
waker.expect(f'io_level = {wakeup_level}', timeout=10)
120-
121122
wakee.expect('io_wakeup_test>', timeout=10)
122123

123-
sleep(2)
124-
125124
wakee.write('cause')
126125
wakee.expect('Wake up from GPIO', timeout=10)
127126
wakee.write(f'rtcio -p {gpio_num} -d')
@@ -156,12 +155,13 @@ def test_gpio_wakeup_enable_lightsleep(dut: Tuple[IdfDut, IdfDut]) -> None:
156155
waker.expect(f'io_level = {sleep_level}', timeout=10)
157156

158157
wakee.write('sleep -m 0')
158+
wakee.expect('enter light sleep', timeout=10)
159+
sleep(1)
159160

160161
waker.write(f'gpio_control -p {gpio_num} -l {wakeup_level}')
161162
waker.expect(f'io_num = {gpio_num}', timeout=10)
162163
waker.expect(f'io_level = {wakeup_level}', timeout=10)
163-
164-
wakee.expect('esp_light_sleep_start', timeout=10)
164+
wakee.expect('wakeup from lightsleep', timeout=10)
165165

166166
wakee.write('cause')
167167
wakee.expect('Wake up from GPIO', timeout=10)

0 commit comments

Comments
 (0)