1
0
forked from fsfw/fsfw
This commit is contained in:
2023-01-16 12:35:14 +01:00
parent a0eae66c35
commit fe9804d922
9 changed files with 107 additions and 111 deletions

View File

@ -10,28 +10,31 @@
#define CATCH_CONFIG_COLOUR_WINDOWS
#include <catch2/catch_session.hpp>
#include <fsfw/osal/osal.h>
#include <catch2/catch_session.hpp>
#ifdef FSFW_OSAL_FREERTOS
#include <FreeRTOS.h>
#include "task.h"
#include <FreeRTOS.h>
#include "task.h"
#endif
extern int customSetup();
extern int customTeardown();
#ifdef FSFW_OSAL_FREERTOS
struct Taskparameters {
int argc; char** argv;TaskHandle_t catchTask;
int argc;
char** argv;
TaskHandle_t catchTask;
} taskParameters;
void unittestTaskFunction( void *pvParameters ) {
void unittestTaskFunction(void* pvParameters) {
Taskparameters* parameters = (Taskparameters*)pvParameters;
int result = Catch::Session().run(parameters->argc, parameters->argv);
vTaskDelay(pdMS_TO_TICKS(10));
vTaskSuspendAll();
vTaskDelete(parameters->catchTask);
@ -40,26 +43,27 @@ void unittestTaskFunction( void *pvParameters ) {
}
#endif
int main(int argc, char* argv[]) {
customSetup();
int result = 0;
#ifdef FSFW_OSAL_FREERTOS
xTaskCreate( unittestTaskFunction, /* The function that implements the task. */
"Unittests", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
&taskParameters, /* The parameter passed to the task - not used in this simple case. */
1, /* The priority assigned to the task. */
&taskParameters.catchTask); /* The task handle is not required, so NULL is passed. */
#ifdef FSFW_OSAL_FREERTOS
xTaskCreate(
unittestTaskFunction, /* The function that implements the task. */
"Unittests", /* The text name assigned to the task - for debug only as it is not used by the
kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
&taskParameters, /* The parameter passed to the task - not used in this simple case. */
1, /* The priority assigned to the task. */
&taskParameters.catchTask); /* The task handle is not required, so NULL is passed. */
taskParameters.argc = argc;
taskParameters.argv = argv;
vTaskStartScheduler();
#else
#else
// Catch internal function call
result = Catch::Session().run(argc, argv);
#endif
#endif
// global clean-up
customTeardown();