Merge branch 'bugfix/time_ut_wakeup_from_deep_sleep' into 'master'

esp32/test: Reduces a unit test execution time

See merge request idf/esp-idf!2776
This commit is contained in:
Ivan Grokhotkov 2018-07-17 18:39:15 +08:00
commit ea452920bb

View file

@ -343,19 +343,21 @@ TEST_CASE("disable source trigger behavior", "[deepsleep]")
static RTC_DATA_ATTR struct timeval start; static RTC_DATA_ATTR struct timeval start;
static void trigger_deepsleep(void) static void trigger_deepsleep(void)
{ {
printf("Trigger deep sleep. Waiting 30 sec ...\n"); printf("Trigger deep sleep. Waiting for 10 sec ...\n");
// Simulate the dispersion of the calibration coefficients at start-up. // Simulate the dispersion of the calibration coefficients at start-up.
// Corrupt the calibration factor. // Corrupt the calibration factor.
esp_clk_slowclk_cal_set(esp_clk_slowclk_cal_get() - 1000000); esp_clk_slowclk_cal_set(esp_clk_slowclk_cal_get() / 2);
esp_set_time_from_rtc(); esp_set_time_from_rtc();
// Delay for time error accumulation. // Delay for time error accumulation.
vTaskDelay(30000/portTICK_RATE_MS); vTaskDelay(10000/portTICK_RATE_MS);
// Save start time. Deep sleep. // Save start time. Deep sleep.
gettimeofday(&start, NULL); gettimeofday(&start, NULL);
esp_sleep_enable_timer_wakeup(1000); esp_sleep_enable_timer_wakeup(1000);
// In function esp_deep_sleep_start() uses function esp_sync_counters_rtc_and_frc()
// to prevent a negative time after wake up.
esp_deep_sleep_start(); esp_deep_sleep_start();
} }
@ -371,4 +373,4 @@ static void check_time_deepsleep(void)
TEST_ASSERT_MESSAGE(dt_ms > 0, "Time in deep sleep is negative"); TEST_ASSERT_MESSAGE(dt_ms > 0, "Time in deep sleep is negative");
} }
TEST_CASE_MULTIPLE_STAGES("check a time after wakeup from deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET][timeout=60]", trigger_deepsleep, check_time_deepsleep); TEST_CASE_MULTIPLE_STAGES("check a time after wakeup from deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]", trigger_deepsleep, check_time_deepsleep);