mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
8df4625c84
* Decomposed tests into atomic unit tests * Made tests less time-dependent, hence more robust on different platforms (ESP32, QEMU, Linux) * Ported most of the tests to linux * Removed some redundant tests * Fixed bug the tests discovered * Simplified parts of the tests to be more clear * Partially used C++ to simplify setup/teardown * Unified setup/teardown in general
49 lines
1.0 KiB
C
49 lines
1.0 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include "unity.h"
|
|
#include "unity_test_runner.h"
|
|
#include "unity_test_utils_memory.h"
|
|
#include "esp_log.h"
|
|
#ifdef CONFIG_HEAP_TRACING
|
|
#include "memory_checks.h"
|
|
#include "esp_heap_trace.h"
|
|
#endif
|
|
|
|
static const char* TAG = "event_test_app";
|
|
|
|
void setUp(void)
|
|
{
|
|
// If heap tracing is enabled in kconfig, leak trace the test
|
|
#ifdef CONFIG_HEAP_TRACING
|
|
setup_heap_record();
|
|
heap_trace_start(HEAP_TRACE_LEAKS);
|
|
#endif
|
|
|
|
unity_utils_set_leak_level(0);
|
|
unity_utils_record_free_mem();
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
#ifdef CONFIG_HEAP_TRACING
|
|
heap_trace_stop();
|
|
heap_trace_dump();
|
|
#endif
|
|
|
|
unity_utils_evaluate_leaks();
|
|
}
|
|
|
|
void app_main(void)
|
|
{
|
|
ESP_LOGI(TAG, "Running esp-event test app");
|
|
// rand() seems to do a one-time allocation. Call it here so that the memory it allocates
|
|
// is not counted as a leak.
|
|
unsigned int _rand __attribute__((unused)) = rand();
|
|
|
|
unity_run_menu();
|
|
}
|