cleaning up unittest build
fsfw/fsfw/pipeline/head This commit looks good Details

This commit is contained in:
Ulrich Mohr 2023-01-20 16:05:04 +01:00
parent e6af6200ae
commit 6d85fa155e
9 changed files with 27 additions and 21 deletions

View File

@ -153,11 +153,7 @@ if(FSFW_BUILD_TESTS)
"${MSG_PREFIX} Building the FSFW unittests in addition to the static library"
)
# Check whether the user has already installed Catch2 first
# Suppress this check for rtems, because rtems is cross compiled
# 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()
find_package(Catch2 ${FSFW_CATCH2_LIB_MAJOR_VERSION} QUIET)
# Not installed, so use FetchContent to download and provide Catch2
if(NOT Catch2_FOUND)
message(
@ -221,11 +217,7 @@ message(
)
# 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)
endif()
# Not installed, so use FetchContent to download and provide etl
if(NOT ${FSFW_ETL_LIB_NAME}_FOUND)
message(

View File

@ -2,6 +2,8 @@
#include <rtems/rtems/sem.h>
//TODO
BinarySemaphore::BinarySemaphore() {}
BinarySemaphore::~BinarySemaphore() {}

View File

@ -18,7 +18,9 @@ SemaphoreFactory* SemaphoreFactory::instance() {
}
SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) {
return new BinarySemaphore();
return nullptr;
//TODO
//return new BinarySemaphore();
}
SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, uint8_t initCount,

View File

@ -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){
if ( source == RTEMS_FATAL_SOURCE_EXIT ) {

View File

@ -1,2 +1,5 @@
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestSemaphore.cpp
TestClock.cpp)
target_sources(${FSFW_TEST_TGT} PRIVATE testMq.cpp TestClock.cpp)
if(FSFW_OSAL MATCHES "linux" OR FSFW_OSAL MATCHES "freertos")
target_sources(${FSFW_TEST_TGT} PRIVATE TestSemaphore.cpp)
endif()

View File

@ -4,8 +4,6 @@
#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]") {
// perform set-up here
@ -33,6 +31,4 @@ TEST_CASE("Binary Semaphore Test", "[BinSemaphore]") {
TEST_CASE("Counting Semaphore Test", "[CountingSemaph]") {
SECTION("Simple Test") {}
}
#endif
}

View File

@ -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")

View File

@ -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_PROCESSOR a72)
@ -7,19 +7,30 @@ set(CMAKE_SYSTEM_PROCESSOR a72)
set(CMAKE_C_COMPILER aarch64-rtems6-gcc)
set(CMAKE_CXX_COMPILER aarch64-rtems6-g++)
# built in tests fail
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
# adjust the default behavior of the FIND_XXX() commands:
# 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
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY 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
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
"${CMAKE_CURRENT_SOURCE_DIR}/unittests/testcfg/rtems/cmake")