Skip to content

Commit 4c6cf06

Browse files
committed
Merge branch 'fix/fix_esp_pm_case_high_fail_ratio_v5.3' into 'release/v5.3'
fix(esp_pm): fix esp_pm test cases high fail ratio (v5.3) See merge request espressif/esp-idf!30672
2 parents 464f4c9 + 7aed3eb commit 4c6cf06

File tree

1 file changed

+7
-4
lines changed
  • components/esp_pm/test_apps/esp_pm/main

1 file changed

+7
-4
lines changed

components/esp_pm/test_apps/esp_pm/main/test_pm.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,9 @@ TEST_CASE("Can wake up from automatic light sleep by GPIO", "[pm][ignore]")
226226
printf("%lld %lld %u\n", end_rtc - start_rtc, end_hs - start_hs, end_tick - start_tick);
227227

228228
TEST_ASSERT_INT32_WITHIN(3, delay_ticks, end_tick - start_tick);
229-
TEST_ASSERT_INT32_WITHIN(2 * portTICK_PERIOD_MS * 1000, delay_ms * 1000, end_hs - start_hs);
230-
TEST_ASSERT_INT32_WITHIN(2 * portTICK_PERIOD_MS * 1000, delay_ms * 1000, end_rtc - start_rtc);
229+
// Error tolerance is 2 tick + duration * 5%
230+
TEST_ASSERT_INT32_WITHIN((2 * portTICK_PERIOD_MS + delay_ms / 20) * 1000, delay_ms * 1000, end_hs - start_hs);
231+
TEST_ASSERT_INT32_WITHIN((2 * portTICK_PERIOD_MS + delay_ms / 20) * 1000, delay_ms * 1000, end_rtc - start_rtc);
231232
}
232233
REG_CLR_BIT(rtc_io_desc[rtcio_num].reg, rtc_io_desc[rtcio_num].hold_force);
233234
rtc_gpio_deinit(ext1_wakeup_gpio);
@@ -277,13 +278,15 @@ TEST_CASE("vTaskDelay duration is correct with light sleep enabled", "[pm]")
277278
xTaskCreatePinnedToCore(test_delay_task, "", 2048, (void *) &args, 3, NULL, 0);
278279
TEST_ASSERT( xSemaphoreTake(done_sem, delay_ms * 10 / portTICK_PERIOD_MS) );
279280
printf("CPU0: %d %d\n", args.delay_us, args.result);
280-
TEST_ASSERT_INT32_WITHIN(1000 * portTICK_PERIOD_MS * 2, args.delay_us, args.result);
281+
// Error tolerance is 2 tick + duration * 5%
282+
TEST_ASSERT_INT32_WITHIN((portTICK_PERIOD_MS * 2 + args.delay_us / 20) * 1000, args.delay_us, args.result);
281283

282284
#if CONFIG_FREERTOS_NUMBER_OF_CORES == 2
283285
xTaskCreatePinnedToCore(test_delay_task, "", 2048, (void *) &args, 3, NULL, 1);
284286
TEST_ASSERT( xSemaphoreTake(done_sem, delay_ms * 10 / portTICK_PERIOD_MS) );
285287
printf("CPU1: %d %d\n", args.delay_us, args.result);
286-
TEST_ASSERT_INT32_WITHIN(1000 * portTICK_PERIOD_MS * 2, args.delay_us, args.result);
288+
// Error tolerance is 2 tick + duration * 5%
289+
TEST_ASSERT_INT32_WITHIN((portTICK_PERIOD_MS * 2 + args.delay_us / 20) * 1000, args.delay_us, args.result);
287290
#endif
288291
}
289292
vSemaphoreDelete(done_sem);

0 commit comments

Comments
 (0)