mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-06 11:36:51 +03:00
fix(unity-test): Run unity tests in dedicated task
Avoid running out of heap
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
#include <unity.h>
|
||||
|
||||
#include "components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_flowpostprocessing.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_flow_pp_negative.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_getReadoutRawString.cpp"
|
||||
// SD-Card ////////////////////
|
||||
#include "nvs_flash.h"
|
||||
#include "esp_vfs_fat.h"
|
||||
@@ -15,6 +10,18 @@
|
||||
#define __SD_USE_ONE_LINE_MODE__
|
||||
#include "server_GPIO.h"
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
// Include files with functions to test
|
||||
//*****************************************************************************
|
||||
#include "components/jomjol-flowcontroll/test_flow_postrocess_helper.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_flowpostprocessing.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_flow_pp_negative.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_PointerEvalAnalogToDigitNew.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_getReadoutRawString.cpp"
|
||||
#include "components/jomjol-flowcontroll/test_cnnflowcontroll.cpp"
|
||||
|
||||
|
||||
bool Init_NVS_SDCard()
|
||||
{
|
||||
esp_err_t ret = nvs_flash_init();
|
||||
@@ -81,7 +88,6 @@ bool Init_NVS_SDCard()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void initGPIO()
|
||||
{
|
||||
gpio_config_t io_conf;
|
||||
@@ -96,31 +102,56 @@ void initGPIO()
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief startup the test. Like a test-suite
|
||||
* all test methods must be called here
|
||||
*/
|
||||
void task_UnityTesting(void *pvParameter)
|
||||
{
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(test_getReadoutRawString);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
|
||||
RUN_TEST(test_ZeigerEval);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_ZeigerEvalHybrid);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
|
||||
RUN_TEST(testNegative_Issues);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(testNegative);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
|
||||
RUN_TEST(test_analogToDigit_Standard);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_analogToDigit_Transition);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
|
||||
RUN_TEST(test_doFlowPP);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP1);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP2);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP3);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP4);
|
||||
UNITY_END();
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief main task
|
||||
*/
|
||||
extern "C" void app_main()
|
||||
{
|
||||
initGPIO();
|
||||
Init_NVS_SDCard();
|
||||
esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to ERROR level
|
||||
initGPIO();
|
||||
Init_NVS_SDCard();
|
||||
esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to DEBUG level
|
||||
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(testNegative_Issues);
|
||||
/* RUN_TEST(testNegative);
|
||||
|
||||
RUN_TEST(test_analogToDigit_Standard);
|
||||
RUN_TEST(test_analogToDigit_Transition);
|
||||
RUN_TEST(test_doFlowPP);
|
||||
RUN_TEST(test_doFlowPP1);
|
||||
RUN_TEST(test_doFlowPP2);
|
||||
RUN_TEST(test_doFlowPP3);
|
||||
RUN_TEST(test_doFlowPP4);
|
||||
|
||||
// getReadoutRawString test
|
||||
RUN_TEST(test_getReadoutRawString);
|
||||
*/
|
||||
UNITY_END();
|
||||
// Create dedicated testing task (heap size can be configured - large enough to handle a lot of testing cases)
|
||||
// ********************************************
|
||||
xTaskCreate(&task_UnityTesting, "task_UnityTesting", 12 * 1024, NULL, tskIDLE_PRIORITY+2, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user