unittests running but failing
This commit is contained in:
parent
a993c4e0d4
commit
39dad5f45b
@ -193,7 +193,6 @@ if(FSFW_BUILD_TESTS)
|
|||||||
|
|
||||||
set(LIB_OS_NAME FreeRTOS)
|
set(LIB_OS_NAME FreeRTOS)
|
||||||
target_include_directories(FreeRTOS PUBLIC unittests/testcfg/freertos)
|
target_include_directories(FreeRTOS PUBLIC unittests/testcfg/freertos)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(${FSFW_TEST_TGT} CXX C)
|
project(${FSFW_TEST_TGT} CXX C)
|
||||||
@ -385,6 +384,9 @@ if(FSFW_BUILD_TESTS)
|
|||||||
endif()
|
endif()
|
||||||
target_link_libraries(${FSFW_TEST_TGT} PRIVATE Catch2::Catch2
|
target_link_libraries(${FSFW_TEST_TGT} PRIVATE Catch2::Catch2
|
||||||
${LIB_FSFW_NAME})
|
${LIB_FSFW_NAME})
|
||||||
|
if(FSFW_OSAL MATCHES "freertos")
|
||||||
|
target_link_libraries(${FSFW_TEST_TGT} PRIVATE FreeRTOS)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. If
|
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. If
|
||||||
|
@ -11,15 +11,55 @@
|
|||||||
#define CATCH_CONFIG_COLOUR_WINDOWS
|
#define CATCH_CONFIG_COLOUR_WINDOWS
|
||||||
|
|
||||||
#include <catch2/catch_session.hpp>
|
#include <catch2/catch_session.hpp>
|
||||||
|
#include <fsfw/osal/osal.h>
|
||||||
|
|
||||||
|
#ifdef FSFW_OSAL_FREERTOS
|
||||||
|
#include <FreeRTOS.h>
|
||||||
|
#include "task.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
extern int customSetup();
|
extern int customSetup();
|
||||||
extern int customTeardown();
|
extern int customTeardown();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FSFW_OSAL_FREERTOS
|
||||||
|
struct Taskparameters {
|
||||||
|
int argc; char** argv;
|
||||||
|
} taskParameters;
|
||||||
|
|
||||||
|
void unittestTaskFunction( void *pvParameters ) {
|
||||||
|
puts("go");
|
||||||
|
Taskparameters* parameters = (Taskparameters*)pvParameters;
|
||||||
|
int result = Catch::Session().run(parameters->argc, parameters->argv);
|
||||||
|
puts("gone");
|
||||||
|
vTaskDelete( NULL );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
customSetup();
|
customSetup();
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
puts("pre");
|
||||||
|
|
||||||
|
#ifdef FSFW_OSAL_FREERTOS
|
||||||
|
puts("task");
|
||||||
|
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. */
|
||||||
|
NULL ); /* The task handle is not required, so NULL is passed. */
|
||||||
|
taskParameters.argc = argc;
|
||||||
|
taskParameters.argv = argv;
|
||||||
|
vTaskStartScheduler();
|
||||||
|
#else
|
||||||
|
puts("nom");
|
||||||
// Catch internal function call
|
// Catch internal function call
|
||||||
int result = Catch::Session().run(argc, argv);
|
result = Catch::Session().run(argc, argv);
|
||||||
|
#endif
|
||||||
|
|
||||||
// global clean-up
|
// global clean-up
|
||||||
customTeardown();
|
customTeardown();
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <gcov.h>
|
#include <gcov.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "fsfw/objectmanager/ObjectManager.h"
|
#include "fsfw/objectmanager/ObjectManager.h"
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
// binary semaphores currently only supported on linux
|
// binary semaphores currently only supported on linux
|
||||||
#ifdef FSFW_OSAL_LINUX
|
#if defined(FSFW_OSAL_LINUX) || defined(FSFW_OSAL_FREERTOS)
|
||||||
|
|
||||||
TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
|
TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
|
||||||
// perform set-up here
|
// perform set-up here
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
|
#define configTASK_NOTIFICATION_ARRAY_ENTRIES 3
|
||||||
#define configUSE_MUTEXES 1
|
#define configUSE_MUTEXES 1
|
||||||
#define configUSE_RECURSIVE_MUTEXES 0
|
#define configUSE_RECURSIVE_MUTEXES 0
|
||||||
#define configUSE_COUNTING_SEMAPHORES 0
|
#define configUSE_COUNTING_SEMAPHORES 1
|
||||||
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
|
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
|
||||||
#define configQUEUE_REGISTRY_SIZE 10
|
#define configQUEUE_REGISTRY_SIZE 10
|
||||||
#define configUSE_QUEUE_SETS 0
|
#define configUSE_QUEUE_SETS 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user