cleaning up unittest build
This commit is contained in:
parent
e6af6200ae
commit
6d85fa155e
@ -153,11 +153,7 @@ if(FSFW_BUILD_TESTS)
|
|||||||
"${MSG_PREFIX} Building the FSFW unittests in addition to the static library"
|
"${MSG_PREFIX} Building the FSFW unittests in addition to the static library"
|
||||||
)
|
)
|
||||||
# Check whether the user has already installed Catch2 first
|
# Check whether the user has already installed Catch2 first
|
||||||
# Suppress this check for rtems, because rtems is cross compiled
|
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} QUIET)
|
||||||
# on CI with preinstalled Catch which needs to be cross compiled
|
|
||||||
if(NOT FSFW_OSAL MATCHES "rtems")
|
|
||||||
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION})
|
|
||||||
endif()
|
|
||||||
# Not installed, so use FetchContent to download and provide Catch2
|
# Not installed, so use FetchContent to download and provide Catch2
|
||||||
if(NOT Catch2_FOUND)
|
if(NOT Catch2_FOUND)
|
||||||
message(
|
message(
|
||||||
@ -221,11 +217,7 @@ message(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Check whether the user has already installed ETL first
|
# Check whether the user has already installed ETL first
|
||||||
# Suppress this check for rtems, because rtems is cross compiled
|
|
||||||
# on CI with preinstalled etl which is not found when cross compiling
|
|
||||||
if(NOT FSFW_OSAL MATCHES "rtems")
|
|
||||||
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET)
|
||||||
endif()
|
|
||||||
# Not installed, so use FetchContent to download and provide etl
|
# Not installed, so use FetchContent to download and provide etl
|
||||||
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
|
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
|
||||||
message(
|
message(
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include <rtems/rtems/sem.h>
|
#include <rtems/rtems/sem.h>
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
|
||||||
BinarySemaphore::BinarySemaphore() {}
|
BinarySemaphore::BinarySemaphore() {}
|
||||||
|
|
||||||
BinarySemaphore::~BinarySemaphore() {}
|
BinarySemaphore::~BinarySemaphore() {}
|
||||||
|
@ -18,7 +18,9 @@ SemaphoreFactory* SemaphoreFactory::instance() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) {
|
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) {
|
||||||
return new BinarySemaphore();
|
return nullptr;
|
||||||
|
//TODO
|
||||||
|
//return new BinarySemaphore();
|
||||||
}
|
}
|
||||||
|
|
||||||
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, uint8_t initCount,
|
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, uint8_t initCount,
|
||||||
|
@ -72,7 +72,7 @@ void exit_qemu_failing(int error) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "testcfg/rtems/rtemsConfig.h"
|
#include <rtemsConfig.h>
|
||||||
|
|
||||||
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code){
|
void user_handle_fatal(Internal_errors_Source source, bool internal, Internal_errors_t error_code){
|
||||||
if ( source == RTEMS_FATAL_SOURCE_EXIT ) {
|
if ( source == RTEMS_FATAL_SOURCE_EXIT ) {
|
||||||
|
@ -1,2 +1,5 @@
|
|||||||
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestSemaphore.cpp
|
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestClock.cpp)
|
||||||
TestClock.cpp)
|
|
||||||
|
if(FSFW_OSAL MATCHES "linux" OR FSFW_OSAL MATCHES "freertos")
|
||||||
|
target_sources(${FSFW_TEST_TGT} PRIVATE TestSemaphore.cpp)
|
||||||
|
endif()
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
// binary semaphores currently only supported on 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
|
||||||
@ -34,5 +32,3 @@ TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
|
|||||||
TEST_CASE("Counting Semaphore Test", "[CountingSemaph]") {
|
TEST_CASE("Counting Semaphore Test", "[CountingSemaph]") {
|
||||||
SECTION("Simple Test") {}
|
SECTION("Simple Test") {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
@ -1,3 +1,3 @@
|
|||||||
add_compile_options("-mcpu=cortex-a72" "-I/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib/include" "-I${CMAKE_SOURCE_DIR}/unittests/testcfg/rtems/include")
|
add_compile_options("-mcpu=cortex-a72" "-I/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib/include")
|
||||||
|
|
||||||
add_link_options("-B/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib" "-qrtems")
|
add_link_options("-B/opt/rtems/6/aarch64-rtems6/a72_lp64_qemu/lib" "-qrtems")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# the name of the target operating system
|
## the name of the target operating system
|
||||||
set(CMAKE_SYSTEM_NAME a72_lp64_qemu)
|
set(CMAKE_SYSTEM_NAME a72_lp64_qemu)
|
||||||
|
|
||||||
set(CMAKE_SYSTEM_PROCESSOR a72)
|
set(CMAKE_SYSTEM_PROCESSOR a72)
|
||||||
@ -7,19 +7,30 @@ set(CMAKE_SYSTEM_PROCESSOR a72)
|
|||||||
set(CMAKE_C_COMPILER aarch64-rtems6-gcc)
|
set(CMAKE_C_COMPILER aarch64-rtems6-gcc)
|
||||||
set(CMAKE_CXX_COMPILER aarch64-rtems6-g++)
|
set(CMAKE_CXX_COMPILER aarch64-rtems6-g++)
|
||||||
|
|
||||||
|
# built in tests fail
|
||||||
set(CMAKE_C_COMPILER_WORKS 1)
|
set(CMAKE_C_COMPILER_WORKS 1)
|
||||||
set(CMAKE_CXX_COMPILER_WORKS 1)
|
set(CMAKE_CXX_COMPILER_WORKS 1)
|
||||||
|
|
||||||
# adjust the default behavior of the FIND_XXX() commands:
|
# adjust the default behavior of the FIND_XXX() commands:
|
||||||
# search programs in the host environment
|
# search programs in the host environment
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||||
|
|
||||||
# search headers and libraries in the target environment
|
# search headers and libraries in the target environment
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
||||||
|
|
||||||
|
# ignore host installed libraries
|
||||||
|
# makes find_package() ignore the <package>Config.cmake files
|
||||||
|
set(CMAKE_IGNORE_PATH /usr/local)
|
||||||
|
|
||||||
|
|
||||||
# supress errors
|
# supress errors
|
||||||
add_compile_definitions("__STDC_VERSION__")
|
add_compile_definitions("__STDC_VERSION__")
|
||||||
|
|
||||||
|
# make newlib behave like glib with an intercepted cmath
|
||||||
|
add_compile_options("-I${CMAKE_SOURCE_DIR}/unittests/testcfg/rtems/include")
|
||||||
|
|
||||||
|
# we supply an a72_lp64_qemu.cmake there
|
||||||
list(APPEND CMAKE_MODULE_PATH
|
list(APPEND CMAKE_MODULE_PATH
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/unittests/testcfg/rtems/cmake")
|
"${CMAKE_CURRENT_SOURCE_DIR}/unittests/testcfg/rtems/cmake")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user