mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
fix(esp_timer): Fix tests when esp_timer is running on CPU1
This commit is contained in:
parent
4d764caba1
commit
d902a023ba
@ -83,6 +83,7 @@ TEST_CASE("esp_timer orders timers correctly", "[esp_timer]")
|
||||
|
||||
}
|
||||
fclose(stream);
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static const int test_time_sec = 10;
|
||||
@ -159,6 +160,7 @@ TEST_CASE("esp_timer produces correct delay", "[esp_timer]")
|
||||
TEST_ESP_OK(esp_timer_dump(stdout));
|
||||
|
||||
esp_timer_delete(timer1);
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
// no, we can't make this a const size_t (§6.7.5.2)
|
||||
@ -217,6 +219,7 @@ TEST_CASE("periodic esp_timer produces correct delays", "[esp_timer]")
|
||||
|
||||
TEST_ESP_OK(esp_timer_delete(timer1));
|
||||
vSemaphoreDelete(args.done);
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
#undef NUM_INTERVALS
|
||||
|
||||
@ -339,6 +342,7 @@ TEST_CASE("multiple timers are ordered correctly", "[esp_timer]")
|
||||
TEST_ESP_OK(esp_timer_delete(args1.timer));
|
||||
TEST_ESP_OK(esp_timer_delete(args2.timer));
|
||||
TEST_ESP_OK(esp_timer_delete(args3.timer));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
#undef N
|
||||
|
||||
@ -381,6 +385,7 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]")
|
||||
vSemaphoreDelete(semaphore);
|
||||
TEST_ESP_OK(esp_timer_delete(timer1));
|
||||
TEST_ESP_OK(esp_timer_delete(timer2));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]")
|
||||
@ -631,6 +636,7 @@ TEST_CASE("after esp_timer_impl_advance, timers run when expected", "[esp_timer]
|
||||
|
||||
ref_clock_deinit();
|
||||
TEST_ESP_OK(esp_timer_delete(timer));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static esp_timer_handle_t timer1;
|
||||
@ -668,6 +674,7 @@ TEST_CASE("Can start/stop timer from ISR context", "[esp_timer]")
|
||||
esp_deregister_freertos_tick_hook(test_tick_hook);
|
||||
TEST_ESP_OK(esp_timer_delete(timer1));
|
||||
vSemaphoreDelete(sem);
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_FREERTOS_UNICORE) && SOC_DPORT_WORKAROUND
|
||||
@ -857,6 +864,7 @@ TEST_CASE("Test a latency between a call of callback and real event", "[esp_time
|
||||
TEST_ESP_OK(esp_timer_dump(stdout));
|
||||
TEST_ESP_OK(esp_timer_stop(periodic_timer));
|
||||
TEST_ESP_OK(esp_timer_delete(periodic_timer));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static void test_timer_triggered(void* timer1_trig)
|
||||
@ -905,6 +913,7 @@ TEST_CASE("periodic esp_timer can be restarted", "[esp_timer]")
|
||||
|
||||
TEST_ESP_OK(esp_timer_stop(timer1));
|
||||
TEST_ESP_OK(esp_timer_delete(timer1));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
TEST_CASE("one-shot esp_timer can be restarted", "[esp_timer]")
|
||||
@ -939,6 +948,7 @@ TEST_CASE("one-shot esp_timer can be restarted", "[esp_timer]")
|
||||
TEST_ASSERT_EQUAL(0, timer_trig);
|
||||
|
||||
TEST_ESP_OK(esp_timer_delete(timer1));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
|
||||
@ -997,6 +1007,7 @@ TEST_CASE("Test ESP_TIMER_ISR dispatch method", "[esp_timer]")
|
||||
TEST_ESP_OK(esp_timer_delete(periodic_timer2));
|
||||
printf("timers deleted\n");
|
||||
TEST_ESP_OK(esp_timer_dump(stdout));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static void dump_task(void* arg)
|
||||
@ -1057,6 +1068,7 @@ TEST_CASE("Test ESP_TIMER_ISR dispatch method is not blocked", "[esp_timer]")
|
||||
TEST_ESP_OK(esp_timer_delete(periodic_timer1));
|
||||
TEST_ESP_OK(esp_timer_delete(periodic_timer2));
|
||||
printf("timer deleted\n");
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static void isr_callback1(void* arg)
|
||||
@ -1116,6 +1128,7 @@ TEST_CASE("Test ESP_TIMER_ISR, stop API cleans alarm reg if TASK timer list is e
|
||||
TEST_ESP_OK(esp_timer_delete(timer2));
|
||||
vSemaphoreDelete(done);
|
||||
printf("timer deleted\n");
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
static void isr_callback2(void* arg)
|
||||
@ -1171,6 +1184,7 @@ TEST_CASE("Test ESP_TIMER_ISR, stop API cleans alarm reg if ISR timer list is em
|
||||
TEST_ESP_OK(esp_timer_delete(timer2));
|
||||
vSemaphoreDelete(done);
|
||||
printf("timer deleted\n");
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
#ifndef CONFIG_FREERTOS_UNICORE
|
||||
@ -1209,6 +1223,7 @@ TEST_CASE("Test that CPU1 can handle esp_timer ISR even when CPU0 is blocked", "
|
||||
TEST_ESP_OK(esp_timer_dump(stdout));
|
||||
TEST_ASSERT_INT_WITHIN(3, 10, data);
|
||||
TEST_ESP_OK(esp_timer_delete(timer));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
#endif // not CONFIG_FREERTOS_UNICORE
|
||||
|
||||
@ -1280,6 +1295,7 @@ TEST_CASE("Test ISR dispatch callbacks are not blocked even if TASK callbacks ta
|
||||
TEST_ESP_OK(esp_timer_stop(isr_timer_handle));
|
||||
TEST_ESP_OK(esp_timer_delete(task_timer_handle));
|
||||
TEST_ESP_OK(esp_timer_delete(isr_timer_handle));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
#endif // CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/param.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_timer.h"
|
||||
#include "unity.h"
|
||||
#include "esp_rom_sys.h"
|
||||
@ -54,6 +56,7 @@ TEST_CASE("Test the periodic timer does not handle lost events during light slee
|
||||
// times_skipped is about 12 (4 from each sleep time).
|
||||
TEST_ESP_OK(esp_timer_dump(stdout));
|
||||
TEST_ESP_OK(esp_timer_delete(periodic_timer));
|
||||
vTaskDelay(3); // wait for the esp_timer task to delete all timers
|
||||
}
|
||||
|
||||
#endif // SOC_LIGHT_SLEEP_SUPPORTED
|
||||
|
Loading…
Reference in New Issue
Block a user