Merge branch 'refactor/esp_event_astyle_format' into 'master'

change(esp_event): formatted files with astyle

See merge request espressif/esp-idf!28801
This commit is contained in:
Jakob Hasse
2024-02-01 11:20:05 +08:00
9 changed files with 611 additions and 612 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -76,7 +76,6 @@ esp_err_t esp_event_post(esp_event_base_t event_base, int32_t event_id,
event_data, event_data_size, ticks_to_wait);
}
#if CONFIG_ESP_EVENT_POST_FROM_ISR
esp_err_t esp_event_isr_post(esp_event_base_t event_base, int32_t event_id,
const void* event_data, size_t event_data_size, BaseType_t* task_unblocked)
@@ -90,7 +89,6 @@ esp_err_t esp_event_isr_post(esp_event_base_t event_base, int32_t event_id,
}
#endif
esp_err_t esp_event_loop_create_default(void)
{
if (s_default_loop) {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -24,7 +24,7 @@
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
// LOOP @<address, name> rx:<recieved events no.> dr:<dropped events no.>
#define LOOP_DUMP_FORMAT "LOOP @%p,%s rx:%" PRIu32 " dr:%" PRIu32 "\n"
// handler @<address> ev:<base, id> inv:<times invoked> time:<runtime>
// handler @<address> ev:<base, id> inv:<times invoked> time:<runtime>
#define HANDLER_DUMP_FORMAT " HANDLER @%p ev:%s,%s inv:%" PRIu32 " time:%lld us\n"
#define PRINT_DUMP_INFO(dst, sz, ...) do { \
@@ -46,12 +46,10 @@ static SLIST_HEAD(esp_event_loop_instance_list_t, esp_event_loop_instance) s_eve
static portMUX_TYPE s_event_loops_spinlock = portMUX_INITIALIZER_UNLOCKED;
#endif
/* ------------------------- Static Functions ------------------------------- */
#ifdef CONFIG_ESP_EVENT_LOOP_PROFILING
static int esp_event_dump_prepare(void)
{
esp_event_loop_instance_t* loop_it;
@@ -103,7 +101,7 @@ static void esp_event_loop_run_task(void* args)
ESP_LOGD(TAG, "running task for loop %p", event_loop);
while(1) {
while (1) {
err = esp_event_loop_run(event_loop, portMAX_DELAY);
if (err != ESP_OK) {
break;
@@ -151,7 +149,7 @@ static void handler_execute(esp_event_loop_instance_t* loop, esp_event_handler_n
esp_event_handler_node_t* handler_node;
SLIST_FOREACH(loop_node, &(loop->loop_nodes), next) {
SLIST_FOREACH(handler_node, &(loop_node->handlers), next) {
if(handler_node == handler) {
if (handler_node == handler) {
handler->invoked++;
handler->time += diff;
}
@@ -166,7 +164,9 @@ static esp_err_t handler_instances_add(esp_event_handler_nodes_t* handlers, esp_
{
esp_event_handler_node_t *handler_instance = calloc(1, sizeof(*handler_instance));
if (!handler_instance) return ESP_ERR_NO_MEM;
if (!handler_instance) {
return ESP_ERR_NO_MEM;
}
esp_event_handler_instance_context_t *context = calloc(1, sizeof(*context));
@@ -181,13 +181,12 @@ static esp_err_t handler_instances_add(esp_event_handler_nodes_t* handlers, esp_
if (SLIST_EMPTY(handlers)) {
SLIST_INSERT_HEAD(handlers, handler_instance, next);
}
else {
} else {
esp_event_handler_node_t *it = NULL, *last = NULL;
SLIST_FOREACH(it, handlers, next) {
if (legacy) {
if(event_handler == it->handler_ctx->handler) {
if (event_handler == it->handler_ctx->handler) {
it->handler_ctx->arg = event_handler_arg;
ESP_LOGW(TAG, "handler already registered, overwriting");
free(handler_instance);
@@ -219,8 +218,7 @@ static esp_err_t base_node_add_handler(esp_event_base_node_t* base_node,
{
if (id == ESP_EVENT_ANY_ID) {
return handler_instances_add(&(base_node->handlers), event_handler, event_handler_arg, handler_ctx, legacy);
}
else {
} else {
esp_err_t err = ESP_OK;
esp_event_id_node_t *it = NULL, *id_node = NULL, *last_id_node = NULL;
@@ -248,8 +246,7 @@ static esp_err_t base_node_add_handler(esp_event_base_node_t* base_node,
if (err == ESP_OK) {
if (!last_id_node) {
SLIST_INSERT_HEAD(&(base_node->id_nodes), id_node, next);
}
else {
} else {
SLIST_INSERT_AFTER(last_id_node, id_node, next);
}
} else {
@@ -257,8 +254,7 @@ static esp_err_t base_node_add_handler(esp_event_base_node_t* base_node,
}
return err;
}
else {
} else {
return handler_instances_add(&(id_node->handlers), event_handler, event_handler_arg, handler_ctx, legacy);
}
}
@@ -274,8 +270,7 @@ static esp_err_t loop_node_add_handler(esp_event_loop_node_t* loop_node,
{
if (base == esp_event_any_base && id == ESP_EVENT_ANY_ID) {
return handler_instances_add(&(loop_node->handlers), event_handler, event_handler_arg, handler_ctx, legacy);
}
else {
} else {
esp_err_t err = ESP_OK;
esp_event_base_node_t *it = NULL, *base_node = NULL, *last_base_node = NULL;
@@ -307,8 +302,7 @@ static esp_err_t loop_node_add_handler(esp_event_loop_node_t* loop_node,
if (err == ESP_OK) {
if (!last_base_node) {
SLIST_INSERT_HEAD(&(loop_node->base_nodes), base_node, next);
}
else {
} else {
SLIST_INSERT_AFTER(last_base_node, base_node, next);
}
} else {
@@ -347,13 +341,11 @@ static esp_err_t handler_instances_remove(esp_event_handler_nodes_t* handlers, e
return ESP_ERR_NOT_FOUND;
}
static esp_err_t base_node_remove_handler(esp_event_base_node_t* base_node, int32_t id, esp_event_handler_instance_context_t* handler_ctx, bool legacy)
{
if (id == ESP_EVENT_ANY_ID) {
return handler_instances_remove(&(base_node->handlers), handler_ctx, legacy);
}
else {
} else {
esp_event_id_node_t *it, *temp;
SLIST_FOREACH_SAFE(it, &(base_node->id_nodes), next, temp) {
if (it->id == id) {
@@ -377,8 +369,7 @@ static esp_err_t loop_node_remove_handler(esp_event_loop_node_t* loop_node, esp_
{
if (base == esp_event_any_base && id == ESP_EVENT_ANY_ID) {
return handler_instances_remove(&(loop_node->handlers), handler_ctx, legacy);
}
else {
} else {
esp_event_base_node_t *it, *temp;
SLIST_FOREACH_SAFE(it, &(loop_node->base_nodes), next, temp) {
if (it->base == base) {
@@ -469,7 +460,7 @@ esp_err_t esp_event_loop_create(const esp_event_loop_args_t* event_loop_args, es
return err;
}
loop->queue = xQueueCreate(event_loop_args->queue_size , sizeof(esp_event_post_instance_t));
loop->queue = xQueueCreate(event_loop_args->queue_size, sizeof(esp_event_post_instance_t));
if (loop->queue == NULL) {
ESP_LOGE(TAG, "create event loop queue failed");
goto on_err;
@@ -566,7 +557,7 @@ esp_err_t esp_event_loop_run(esp_event_loop_handle_t event_loop, TickType_t tick
int64_t remaining_ticks = ticks_to_run;
#endif
while(xQueueReceive(loop->queue, &post, ticks_to_run) == pdTRUE) {
while (xQueueReceive(loop->queue, &post, ticks_to_run) == pdTRUE) {
// The event has already been unqueued, so ensure it gets executed.
xSemaphoreTakeRecursive(loop->mutex, portMAX_DELAY);
@@ -674,7 +665,7 @@ esp_err_t esp_event_loop_delete(esp_event_loop_handle_t event_loop)
// Drop existing posts on the queue
esp_event_post_instance_t post;
while(xQueueReceive(loop->queue, &post, 0) == pdTRUE) {
while (xQueueReceive(loop->queue, &post, 0) == pdTRUE) {
post_instance_delete(&post);
}
@@ -740,15 +731,13 @@ esp_err_t esp_event_handler_register_with_internal(esp_event_loop_handle_t event
if (err == ESP_OK) {
if (!last_loop_node) {
SLIST_INSERT_HEAD(&(loop->loop_nodes), loop_node, next);
}
else {
} else {
SLIST_INSERT_AFTER(last_loop_node, loop_node, next);
}
} else {
free(loop_node);
}
}
else {
} else {
err = loop_node_add_handler(last_loop_node, event_base, event_id, event_handler, event_handler_arg, handler_ctx_arg, legacy);
}
@@ -819,7 +808,9 @@ esp_err_t esp_event_handler_unregister_with(esp_event_loop_handle_t event_loop,
esp_err_t esp_event_handler_instance_unregister_with(esp_event_loop_handle_t event_loop, esp_event_base_t event_base,
int32_t event_id, esp_event_handler_instance_t handler_ctx_arg)
{
if (!handler_ctx_arg) return ESP_ERR_INVALID_ARG;
if (!handler_ctx_arg) {
return ESP_ERR_INVALID_ARG;
}
return esp_event_handler_unregister_with_internal(event_loop, event_base, event_id, (esp_event_handler_instance_context_t*) handler_ctx_arg, false);
}
@@ -976,7 +967,7 @@ esp_err_t esp_event_dump(FILE* file)
events_recieved = atomic_load(&loop_it->events_recieved);
events_dropped = atomic_load(&loop_it->events_dropped);
PRINT_DUMP_INFO(dst, sz, LOOP_DUMP_FORMAT, loop_it, loop_it->task != NULL ? loop_it->name : "none" ,
PRINT_DUMP_INFO(dst, sz, LOOP_DUMP_FORMAT, loop_it, loop_it->task != NULL ? loop_it->name : "none",
events_recieved, events_dropped);
int sz_bak = sz;
@@ -989,7 +980,7 @@ esp_err_t esp_event_dump(FILE* file)
SLIST_FOREACH(base_node_it, &(loop_node_it->base_nodes), next) {
SLIST_FOREACH(handler_it, &(base_node_it->handlers), next) {
PRINT_DUMP_INFO(dst, sz, HANDLER_DUMP_FORMAT, handler_it->handler_ctx->handler, base_node_it->base ,
PRINT_DUMP_INFO(dst, sz, HANDLER_DUMP_FORMAT, handler_it->handler_ctx->handler, base_node_it->base,
"ESP_EVENT_ANY_ID", handler_it->invoked, handler_it->time);
}
@@ -998,7 +989,7 @@ esp_err_t esp_event_dump(FILE* file)
memset(id_str_buf, 0, sizeof(id_str_buf));
snprintf(id_str_buf, sizeof(id_str_buf), "%" PRIi32, id_node_it->id);
PRINT_DUMP_INFO(dst, sz, HANDLER_DUMP_FORMAT, handler_it->handler_ctx->handler, base_node_it->base ,
PRINT_DUMP_INFO(dst, sz, HANDLER_DUMP_FORMAT, handler_it->handler_ctx->handler, base_node_it->base,
id_str_buf, handler_it->invoked, handler_it->time);
}
}

View File

@@ -22,8 +22,7 @@ bool esp_event_is_handler_registered(esp_event_loop_handle_t event_loop, esp_eve
SLIST_FOREACH(loop_node, &(loop->loop_nodes), next) {
SLIST_FOREACH(handler, &(loop_node->handlers), next) {
if(event_base == ESP_EVENT_ANY_BASE && event_id == ESP_EVENT_ANY_ID && handler->handler_ctx->handler == event_handler)
{
if (event_base == ESP_EVENT_ANY_BASE && event_id == ESP_EVENT_ANY_ID && handler->handler_ctx->handler == event_handler) {
result = true;
goto out;
}
@@ -32,18 +31,16 @@ bool esp_event_is_handler_registered(esp_event_loop_handle_t event_loop, esp_eve
SLIST_FOREACH(base_node, &(loop_node->base_nodes), next) {
if (base_node->base == event_base) {
SLIST_FOREACH(handler, &(base_node->handlers), next) {
if(event_id == ESP_EVENT_ANY_ID && handler->handler_ctx->handler == event_handler)
{
if (event_id == ESP_EVENT_ANY_ID && handler->handler_ctx->handler == event_handler) {
result = true;
goto out;
}
}
SLIST_FOREACH(id_node, &(base_node->id_nodes), next) {
if(id_node->id == event_id) {
if (id_node->id == event_id) {
SLIST_FOREACH(handler, &(id_node->handlers), next) {
if(handler->handler_ctx->handler == event_handler)
{
if (handler->handler_ctx->handler == event_handler) {
result = true;
goto out;
}

View File

@@ -7,7 +7,6 @@
CONDITIONS OF ANY KIND, either express or implied.
*/
#include <stdio.h>
#include "esp_event.h"
@@ -20,7 +19,6 @@ extern "C" {
#include "Mockqueue.h"
}
namespace {
const uint32_t QUEUE_SIZE = 32;
@@ -45,7 +43,8 @@ void dummy_handler(void* event_handler_arg, esp_event_base_t event_base, int32_t
}
// TODO: IDF-2693, function definition just to satisfy linker, implement esp_common instead
const char *esp_err_to_name(esp_err_t code) {
const char *esp_err_to_name(esp_err_t code)
{
return "test";
}
@@ -141,7 +140,8 @@ TEST_CASE("test esp_event_loop_create with_task(void)")
xQueueGiveMutexRecursive_StopIgnore();
}
TEST_CASE("registering with ANY_BASE but specific ID fails") {
TEST_CASE("registering with ANY_BASE but specific ID fails")
{
esp_event_loop_handle_t loop = reinterpret_cast<esp_event_loop_handle_t>(1);
CHECK(esp_event_handler_register_with(loop,
ESP_EVENT_ANY_BASE,

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2018-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -48,14 +48,16 @@ static esp_event_loop_args_t test_event_get_default_loop_args(void)
struct EV_LoopFix {
public:
EV_LoopFix(size_t queue_size = CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE, const char *task_name = NULL) {
EV_LoopFix(size_t queue_size = CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE, const char *task_name = NULL)
{
esp_event_loop_args_t loop_args = test_event_get_default_loop_args();
loop_args.task_name = task_name;
loop_args.queue_size = queue_size;
TEST_ESP_OK(esp_event_loop_create(&loop_args, &loop));
}
~EV_LoopFix() {
~EV_LoopFix()
{
esp_event_loop_delete(loop);
}
@@ -126,7 +128,8 @@ static void test_handler_inc(void* event_handler_arg, esp_event_base_t event_bas
(*target)++;
}
TEST_CASE("registering event handler instance without instance context works", "[event][linux]") {
TEST_CASE("registering event handler instance without instance context works", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
@@ -148,7 +151,8 @@ TEST_CASE("registering event handler instance without instance context works", "
* This aims to verify: 1) Handler's argument to be updated
* 2) Registration not to leak memory
*/
TEST_CASE("registering event twice with same handler yields updated handler arg", "[event][linux]") {
TEST_CASE("registering event twice with same handler yields updated handler arg", "[event][linux]")
{
EV_LoopFix loop_fix;
int count_first = 0;
@@ -179,7 +183,8 @@ TEST_CASE("registering event twice with same handler yields updated handler arg"
TEST_ASSERT_EQUAL(1, count_second);
}
TEST_CASE("registering event handler instance twice works", "[event][linux]") {
TEST_CASE("registering event handler instance twice works", "[event][linux]")
{
EV_LoopFix loop_fix;
int count_1 = 0;
int count_2 = 0;
@@ -207,7 +212,8 @@ TEST_CASE("registering event handler instance twice works", "[event][linux]") {
TEST_ASSERT_EQUAL(1, count_2);
}
TEST_CASE("registering with ANY_BASE but specific ID fails", "[event][linux]") {
TEST_CASE("registering with ANY_BASE but specific ID fails", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -232,7 +238,8 @@ TEST_CASE("registering with ANY_BASE but specific ID fails", "[event][linux]") {
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("registration of ANY_BASE and ANY_ID always called", "[event][linux]") {
TEST_CASE("registration of ANY_BASE and ANY_ID always called", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -263,7 +270,8 @@ TEST_CASE("registration of ANY_BASE and ANY_ID always called", "[event][linux]")
TEST_ASSERT_EQUAL(4, count_instance);
}
TEST_CASE("registration of ANY_ID not called from wrong base", "[event][linux]") {
TEST_CASE("registration of ANY_ID not called from wrong base", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -291,7 +299,8 @@ TEST_CASE("registration of ANY_ID not called from wrong base", "[event][linux]")
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("registration of ANY_ID called from correct base", "[event][linux]") {
TEST_CASE("registration of ANY_ID called from correct base", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -319,7 +328,8 @@ TEST_CASE("registration of ANY_ID called from correct base", "[event][linux]") {
TEST_ASSERT_EQUAL(2, count_instance);
}
TEST_CASE("registering specific event posting different base and different event ID", "[event][linux]") {
TEST_CASE("registering specific event posting different base and different event ID", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -345,7 +355,8 @@ TEST_CASE("registering specific event posting different base and different event
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("registering specific event posting different base", "[event][linux]") {
TEST_CASE("registering specific event posting different base", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -373,7 +384,8 @@ TEST_CASE("registering specific event posting different base", "[event][linux]")
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("registering specific event posting incorrect event ID", "[event][linux]") {
TEST_CASE("registering specific event posting incorrect event ID", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -399,7 +411,8 @@ TEST_CASE("registering specific event posting incorrect event ID", "[event][linu
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("registering specific event posting correct event and base", "[event][linux]") {
TEST_CASE("registering specific event posting correct event and base", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -425,7 +438,8 @@ TEST_CASE("registering specific event posting correct event and base", "[event][
TEST_ASSERT_EQUAL(1, count_instance);
}
TEST_CASE("posting ANY_EVENT or ANY_ID fails", "[event][linux]") {
TEST_CASE("posting ANY_EVENT or ANY_ID fails", "[event][linux]")
{
EV_LoopFix loop_fix;
int count = 0;
int count_instance = 0;
@@ -467,7 +481,8 @@ TEST_CASE("posting ANY_EVENT or ANY_ID fails", "[event][linux]") {
TEST_ASSERT_EQUAL(0, count_instance);
}
TEST_CASE("posting to loop with multiple registrations at every level", "[event][linux]") {
TEST_CASE("posting to loop with multiple registrations at every level", "[event][linux]")
{
EV_LoopFix loop_fix;
int count_loop = 0;
int count_loop_inst = 0;
@@ -1227,7 +1242,8 @@ static void test_handler_give_sem(void* handler_arg, esp_event_base_t base, int3
const TickType_t ONE_TICK = 1;
static void wait_taken(SemaphoreHandle_t sem, TickType_t delay_ticks_if_not_taken) {
static void wait_taken(SemaphoreHandle_t sem, TickType_t delay_ticks_if_not_taken)
{
while (xSemaphoreTake(sem, ONE_TICK) == pdTRUE) {
xSemaphoreGive(sem);
vTaskDelay(delay_ticks_if_not_taken);
@@ -1564,7 +1580,8 @@ TEST_CASE("default loop: registering/unregistering event works", "[event][defaul
TEST_ESP_OK(esp_event_loop_delete_default());
}
TEST_CASE("default event loop: registering event handler instance without instance context works", "[event][default][linux]") {
TEST_CASE("default event loop: registering event handler instance without instance context works", "[event][default][linux]")
{
TEST_ESP_OK(esp_event_loop_create_default());
if (TEST_PROTECT()) {

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Unlicense OR CC0-1.0
*/
@@ -30,7 +30,6 @@
#include "test_utils.h"
static const char* TAG = "test_event";
static const TickType_t ZERO_DELAY = 0;
@@ -154,7 +153,7 @@ static void test_event_simple_handler_registration_task(void* args)
xSemaphoreTake(arg->start, portMAX_DELAY);
for(int i = 0; i < data->num; i++) {
for (int i = 0; i < data->num; i++) {
if (data->is_registration) {
TEST_ESP_OK(esp_event_handler_register_with(data->loop, data->base, data->id, data->handles[i], NULL));
} else {
@@ -261,7 +260,7 @@ TEST_CASE("can register/unregister handlers simultaneously", "[event]")
registration_data[i].is_registration = true;
for (int j = 0; j < TEST_CONFIG_ITEMS_TO_REGISTER; j++) {
registration_data[i].handles[j] = (void*) (i * TEST_CONFIG_ITEMS_TO_REGISTER) + (j + TEST_CONFIG_ITEMS_TO_REGISTER);
registration_data[i].handles[j] = (void*)(i * TEST_CONFIG_ITEMS_TO_REGISTER) + (j + TEST_CONFIG_ITEMS_TO_REGISTER);
}
registration_arg[i].start = xSemaphoreCreateBinary();
@@ -381,8 +380,7 @@ TEST_CASE("can post and run events simultaneously", "[event]")
post_event_data_t* post_event_data = calloc(TEST_CONFIG_TASKS_TO_SPAWN, sizeof(*post_event_data));
task_arg_t* post_event_arg = calloc(TEST_CONFIG_TASKS_TO_SPAWN, sizeof(*post_event_arg));
for (int i = 0; i < TEST_CONFIG_TASKS_TO_SPAWN; i++)
{
for (int i = 0; i < TEST_CONFIG_TASKS_TO_SPAWN; i++) {
post_event_data[i].base = s_test_base1;
post_event_data[i].id = TEST_EVENT_BASE1_EV1;
post_event_data[i].loop = loop;
@@ -459,8 +457,7 @@ TEST_CASE("can post and run events simultaneously with instances", "[event]")
post_event_data_t* post_event_data = calloc(TEST_CONFIG_TASKS_TO_SPAWN, sizeof(*post_event_data));
task_arg_t* post_event_arg = calloc(TEST_CONFIG_TASKS_TO_SPAWN, sizeof(*post_event_arg));
for (int i = 0; i < TEST_CONFIG_TASKS_TO_SPAWN; i++)
{
for (int i = 0; i < TEST_CONFIG_TASKS_TO_SPAWN; i++) {
post_event_data[i].base = s_test_base1;
post_event_data[i].id = TEST_EVENT_BASE1_EV1;
post_event_data[i].loop = loop;
@@ -514,7 +511,7 @@ static void loop_run_task(void* args)
{
esp_event_loop_handle_t event_loop = (esp_event_loop_handle_t) args;
while(1) {
while (1) {
esp_event_loop_run(event_loop, portMAX_DELAY);
}
}
@@ -527,8 +524,8 @@ static void performance_test(bool dedicated_task)
const char test_base[] = "qwertyuiopasdfghjklzxvbnmmnbvcxz";
#define TEST_CONFIG_BASES (sizeof(test_base) - 1)
#define TEST_CONFIG_IDS (TEST_CONFIG_BASES / 2)
#define TEST_CONFIG_BASES (sizeof(test_base) - 1)
#define TEST_CONFIG_IDS (TEST_CONFIG_BASES / 2)
// Create loop
esp_event_loop_args_t loop_args = test_event_get_default_loop_args();
@@ -583,7 +580,7 @@ static void performance_test(bool dedicated_task)
int rand_b = rand() % bases;
int temp = post_bases[rand_a];
post_bases[rand_a]= post_bases[rand_b];
post_bases[rand_a] = post_bases[rand_b];
post_bases[rand_b] = temp;
}
@@ -592,7 +589,7 @@ static void performance_test(bool dedicated_task)
int rand_b = rand() % ids;
int temp = post_ids[rand_a];
post_ids[rand_a]= post_ids[rand_b];
post_ids[rand_a] = post_ids[rand_b];
post_ids[rand_b] = temp;
}
@@ -617,7 +614,7 @@ static void performance_test(bool dedicated_task)
}
}
int average = (int) (running_sum / (running_count));
int average = (int)(running_sum / (running_count));
if (!dedicated_task) {
((esp_event_loop_instance_t*) loop)->task = mtask;
@@ -700,7 +697,7 @@ static void test_handler_post_from_isr(void* event_handler_arg, esp_event_base_t
SemaphoreHandle_t *sem = (SemaphoreHandle_t*) event_handler_arg;
// Event data is just the address value (maybe have been truncated due to casting).
int *data = (int*) event_data;
TEST_ASSERT_EQUAL(*data, (int) (*sem));
TEST_ASSERT_EQUAL(*data, (int)(*sem));
xSemaphoreGive(*sem);
}

View File

@@ -54,7 +54,6 @@ components_not_formatted_temporary:
- "/components/efuse/"
- "/components/esp_coex/"
- "/components/esp_eth/"
- "/components/esp_event/"
- "/components/esp_gdbstub/"
- "/components/esp_hid/"
- "/components/esp_http_client/"