diff --git a/CHANGELOG.md b/CHANGELOG.md index 3854dc79..a3f94255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,7 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). the message queue. Also streamlined and simplified `MessageQueue` implementation for all OSALs PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/583 - Internal API change: Moved the `fsfw_hal` to the `src` folder and integration and internal - tests part of `fsfw_tests` to `src`. Unittests are now in a deciated folder called `unittests` + tests part of `fsfw_tests` to `src`. Unittests are now in a dedicated folder called `unittests` PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/653 ### Task Module Refactoring diff --git a/CMakeLists.txt b/CMakeLists.txt index 066f1028..ebdf809b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,11 +104,11 @@ if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() -option(FSFW_BUILD_UNITTESTS +option(FSFW_BUILD_TESTS "Build unittest binary in addition to static library" OFF) option(FSFW_CICD_BUILD "Build for CI/CD. This can disable problematic test" OFF) option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF) -if(FSFW_BUILD_UNITTESTS) +if(FSFW_BUILD_TESTS) option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON) endif() @@ -147,7 +147,7 @@ if(IPO_SUPPORTED AND FSFW_ENABLE_IPO) TRUE) endif() -if(FSFW_BUILD_UNITTESTS) +if(FSFW_BUILD_TESTS) message( STATUS "${MSG_PREFIX} Building the FSFW unittests in addition to the static library" @@ -170,10 +170,9 @@ if(FSFW_BUILD_UNITTESTS) list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2) endif() - set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg) - configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h) - configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in - tests/TestsConfig.h) + set(FSFW_CONFIG_PATH unittests/testcfg) + configure_file(unittests/testcfg/FSFWConfig.h.in FSFWConfig.h) + configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) project(${FSFW_TEST_TGT} CXX C) add_executable(${FSFW_TEST_TGT}) @@ -289,16 +288,15 @@ message( ) add_subdirectory(src) -add_subdirectory(tests) -if(FSFW_ADD_HAL) - add_subdirectory(hal) -endif() add_subdirectory(contrib) +if(FSFW_BUILD_TESTS) + add_subdirectory(unittests) +endif() if(FSFW_BUILD_DOCS) add_subdirectory(docs) endif() -if(FSFW_BUILD_UNITTESTS) +if(FSFW_BUILD_TESTS) if(FSFW_TESTS_GEN_COV) if(CMAKE_COMPILER_IS_GNUCXX) include(CodeCoverage) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 7101958e..c5dcbe02 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { stage('Configure') { steps { dir(BUILDDIR) { - sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON -DFSFW_CICD_BUILD=ON ..' + sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON -DFSFW_CICD_BUILD=ON ..' } } } diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt deleted file mode 100644 index 7a97ae0f..00000000 --- a/hal/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -cmake_minimum_required(VERSION 3.13) - -# Can also be changed by upper CMakeLists.txt file -find_library(LIB_FSFW_NAME fsfw REQUIRED) - -option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Requires gpiod library" OFF) -# On by default for now because I did not have an issue including and compiling those files -# and libraries on a Desktop Linux system and the primary target of the FSFW is still embedded -# Linux. The only exception from this is the gpiod library which requires a dedicated installation, -# but CMake is able to determine whether this library is installed with find_library. -option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add peripheral drivers for embedded Linux" ON) -option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Target implements libgpiod" ON) - -option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF) -option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) -option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) - -set(LINUX_HAL_PATH_NAME linux) -set(STM32H7_PATH_NAME stm32h7) - -add_subdirectory(src) - -foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) - if(IS_ABSOLUTE ${INCLUDE_PATH}) - set(CURR_ABS_INC_PATH "${INCLUDE_PATH}") - else() - get_filename_component(CURR_ABS_INC_PATH - ${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) - endif() - - if(CMAKE_VERBOSE) - message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}") - endif() - - list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH}) -endforeach() - -target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${FSFW_HAL_ADD_INC_PATHS_ABS} -) - -target_compile_definitions(${LIB_FSFW_NAME} PRIVATE - ${FSFW_HAL_DEFINES} -) - -target_link_libraries(${LIB_FSFW_NAME} PRIVATE - ${FSFW_HAL_LINK_LIBS} -) diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt deleted file mode 100644 index 76ee45c6..00000000 --- a/hal/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_subdirectory(fsfw_hal) diff --git a/scripts/helper.py b/scripts/helper.py index 56cf352b..0ac616b6 100755 --- a/scripts/helper.py +++ b/scripts/helper.py @@ -165,10 +165,10 @@ def create_tests_build_cfg(args): os.mkdir(UNITTEST_FOLDER_NAME) os.chdir(UNITTEST_FOLDER_NAME) if args.windows: - cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON \ + cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON \ -DGCOVR_PATH="py -m gcovr" ..' else: - cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' + cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_TESTS=ON ..' cmd_runner(cmake_cmd) os.chdir("..") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 34f21c2f..57b24bd5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,3 +4,8 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(fsfw) +if(FSFW_ADD_HAL) + add_subdirectory(fsfw_hal) +endif() + +add_subdirectory(fsfw_tests) diff --git a/hal/src/fsfw_hal/CMakeLists.txt b/src/fsfw_hal/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/CMakeLists.txt rename to src/fsfw_hal/CMakeLists.txt diff --git a/hal/src/fsfw_hal/common/CMakeLists.txt b/src/fsfw_hal/common/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/common/CMakeLists.txt rename to src/fsfw_hal/common/CMakeLists.txt diff --git a/hal/src/fsfw_hal/common/gpio/CMakeLists.txt b/src/fsfw_hal/common/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/common/gpio/CMakeLists.txt rename to src/fsfw_hal/common/gpio/CMakeLists.txt diff --git a/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp b/src/fsfw_hal/common/gpio/GpioCookie.cpp similarity index 100% rename from hal/src/fsfw_hal/common/gpio/GpioCookie.cpp rename to src/fsfw_hal/common/gpio/GpioCookie.cpp diff --git a/hal/src/fsfw_hal/common/gpio/GpioCookie.h b/src/fsfw_hal/common/gpio/GpioCookie.h similarity index 100% rename from hal/src/fsfw_hal/common/gpio/GpioCookie.h rename to src/fsfw_hal/common/gpio/GpioCookie.h diff --git a/hal/src/fsfw_hal/common/gpio/GpioIF.h b/src/fsfw_hal/common/gpio/GpioIF.h similarity index 100% rename from hal/src/fsfw_hal/common/gpio/GpioIF.h rename to src/fsfw_hal/common/gpio/GpioIF.h diff --git a/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h b/src/fsfw_hal/common/gpio/gpioDefinitions.h similarity index 100% rename from hal/src/fsfw_hal/common/gpio/gpioDefinitions.h rename to src/fsfw_hal/common/gpio/gpioDefinitions.h diff --git a/hal/src/fsfw_hal/common/spi/spiCommon.h b/src/fsfw_hal/common/spi/spiCommon.h similarity index 100% rename from hal/src/fsfw_hal/common/spi/spiCommon.h rename to src/fsfw_hal/common/spi/spiCommon.h diff --git a/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt b/src/fsfw_hal/devicehandlers/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/CMakeLists.txt rename to src/fsfw_hal/devicehandlers/CMakeLists.txt diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp b/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp rename to src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h b/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h rename to src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp rename to src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h rename to src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp rename to src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h rename to src/fsfw_hal/devicehandlers/MgmRM3100Handler.h diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h rename to src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h rename to src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h similarity index 100% rename from hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h rename to src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h diff --git a/hal/src/fsfw_hal/host/CMakeLists.txt b/src/fsfw_hal/host/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/host/CMakeLists.txt rename to src/fsfw_hal/host/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/CMakeLists.txt b/src/fsfw_hal/linux/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/CMakeLists.txt rename to src/fsfw_hal/linux/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/CommandExecutor.cpp b/src/fsfw_hal/linux/CommandExecutor.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/CommandExecutor.cpp rename to src/fsfw_hal/linux/CommandExecutor.cpp diff --git a/hal/src/fsfw_hal/linux/CommandExecutor.h b/src/fsfw_hal/linux/CommandExecutor.h similarity index 100% rename from hal/src/fsfw_hal/linux/CommandExecutor.h rename to src/fsfw_hal/linux/CommandExecutor.h diff --git a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp b/src/fsfw_hal/linux/UnixFileGuard.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/UnixFileGuard.cpp rename to src/fsfw_hal/linux/UnixFileGuard.cpp diff --git a/hal/src/fsfw_hal/linux/UnixFileGuard.h b/src/fsfw_hal/linux/UnixFileGuard.h similarity index 100% rename from hal/src/fsfw_hal/linux/UnixFileGuard.h rename to src/fsfw_hal/linux/UnixFileGuard.h diff --git a/hal/src/fsfw_hal/linux/gpio/CMakeLists.txt b/src/fsfw_hal/linux/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/gpio/CMakeLists.txt rename to src/fsfw_hal/linux/gpio/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp b/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp rename to src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h b/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h rename to src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h diff --git a/hal/src/fsfw_hal/linux/i2c/CMakeLists.txt b/src/fsfw_hal/linux/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/i2c/CMakeLists.txt rename to src/fsfw_hal/linux/i2c/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp b/src/fsfw_hal/linux/i2c/I2cComIF.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp rename to src/fsfw_hal/linux/i2c/I2cComIF.cpp diff --git a/hal/src/fsfw_hal/linux/i2c/I2cComIF.h b/src/fsfw_hal/linux/i2c/I2cComIF.h similarity index 100% rename from hal/src/fsfw_hal/linux/i2c/I2cComIF.h rename to src/fsfw_hal/linux/i2c/I2cComIF.h diff --git a/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp b/src/fsfw_hal/linux/i2c/I2cCookie.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp rename to src/fsfw_hal/linux/i2c/I2cCookie.cpp diff --git a/hal/src/fsfw_hal/linux/i2c/I2cCookie.h b/src/fsfw_hal/linux/i2c/I2cCookie.h similarity index 100% rename from hal/src/fsfw_hal/linux/i2c/I2cCookie.h rename to src/fsfw_hal/linux/i2c/I2cCookie.h diff --git a/hal/src/fsfw_hal/linux/rpi/CMakeLists.txt b/src/fsfw_hal/linux/rpi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/rpi/CMakeLists.txt rename to src/fsfw_hal/linux/rpi/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp b/src/fsfw_hal/linux/rpi/GpioRPi.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp rename to src/fsfw_hal/linux/rpi/GpioRPi.cpp diff --git a/hal/src/fsfw_hal/linux/rpi/GpioRPi.h b/src/fsfw_hal/linux/rpi/GpioRPi.h similarity index 100% rename from hal/src/fsfw_hal/linux/rpi/GpioRPi.h rename to src/fsfw_hal/linux/rpi/GpioRPi.h diff --git a/hal/src/fsfw_hal/linux/spi/CMakeLists.txt b/src/fsfw_hal/linux/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/spi/CMakeLists.txt rename to src/fsfw_hal/linux/spi/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/src/fsfw_hal/linux/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/spi/SpiComIF.cpp rename to src/fsfw_hal/linux/spi/SpiComIF.cpp diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.h b/src/fsfw_hal/linux/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw_hal/linux/spi/SpiComIF.h rename to src/fsfw_hal/linux/spi/SpiComIF.h diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp b/src/fsfw_hal/linux/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/spi/SpiCookie.cpp rename to src/fsfw_hal/linux/spi/SpiCookie.cpp diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.h b/src/fsfw_hal/linux/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw_hal/linux/spi/SpiCookie.h rename to src/fsfw_hal/linux/spi/SpiCookie.h diff --git a/hal/src/fsfw_hal/linux/spi/spiDefinitions.h b/src/fsfw_hal/linux/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw_hal/linux/spi/spiDefinitions.h rename to src/fsfw_hal/linux/spi/spiDefinitions.h diff --git a/hal/src/fsfw_hal/linux/uart/CMakeLists.txt b/src/fsfw_hal/linux/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/uart/CMakeLists.txt rename to src/fsfw_hal/linux/uart/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp b/src/fsfw_hal/linux/uart/UartComIF.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/uart/UartComIF.cpp rename to src/fsfw_hal/linux/uart/UartComIF.cpp diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.h b/src/fsfw_hal/linux/uart/UartComIF.h similarity index 100% rename from hal/src/fsfw_hal/linux/uart/UartComIF.h rename to src/fsfw_hal/linux/uart/UartComIF.h diff --git a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp b/src/fsfw_hal/linux/uart/UartCookie.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/uart/UartCookie.cpp rename to src/fsfw_hal/linux/uart/UartCookie.cpp diff --git a/hal/src/fsfw_hal/linux/uart/UartCookie.h b/src/fsfw_hal/linux/uart/UartCookie.h similarity index 100% rename from hal/src/fsfw_hal/linux/uart/UartCookie.h rename to src/fsfw_hal/linux/uart/UartCookie.h diff --git a/hal/src/fsfw_hal/linux/uio/CMakeLists.txt b/src/fsfw_hal/linux/uio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/linux/uio/CMakeLists.txt rename to src/fsfw_hal/linux/uio/CMakeLists.txt diff --git a/hal/src/fsfw_hal/linux/uio/UioMapper.cpp b/src/fsfw_hal/linux/uio/UioMapper.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/uio/UioMapper.cpp rename to src/fsfw_hal/linux/uio/UioMapper.cpp diff --git a/hal/src/fsfw_hal/linux/uio/UioMapper.h b/src/fsfw_hal/linux/uio/UioMapper.h similarity index 100% rename from hal/src/fsfw_hal/linux/uio/UioMapper.h rename to src/fsfw_hal/linux/uio/UioMapper.h diff --git a/hal/src/fsfw_hal/linux/utility.cpp b/src/fsfw_hal/linux/utility.cpp similarity index 100% rename from hal/src/fsfw_hal/linux/utility.cpp rename to src/fsfw_hal/linux/utility.cpp diff --git a/hal/src/fsfw_hal/linux/utility.h b/src/fsfw_hal/linux/utility.h similarity index 100% rename from hal/src/fsfw_hal/linux/utility.h rename to src/fsfw_hal/linux/utility.h diff --git a/hal/src/fsfw_hal/stm32h7/CMakeLists.txt b/src/fsfw_hal/stm32h7/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/CMakeLists.txt rename to src/fsfw_hal/stm32h7/CMakeLists.txt diff --git a/hal/src/fsfw_hal/stm32h7/definitions.h b/src/fsfw_hal/stm32h7/definitions.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/definitions.h rename to src/fsfw_hal/stm32h7/definitions.h diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt b/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt rename to src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp b/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp rename to src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h b/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h rename to src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h diff --git a/hal/src/fsfw_hal/stm32h7/dma.cpp b/src/fsfw_hal/stm32h7/dma.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/dma.cpp rename to src/fsfw_hal/stm32h7/dma.cpp diff --git a/hal/src/fsfw_hal/stm32h7/dma.h b/src/fsfw_hal/stm32h7/dma.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/dma.h rename to src/fsfw_hal/stm32h7/dma.h diff --git a/hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt b/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt rename to src/fsfw_hal/stm32h7/gpio/CMakeLists.txt diff --git a/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp b/src/fsfw_hal/stm32h7/gpio/gpio.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp rename to src/fsfw_hal/stm32h7/gpio/gpio.cpp diff --git a/hal/src/fsfw_hal/stm32h7/gpio/gpio.h b/src/fsfw_hal/stm32h7/gpio/gpio.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/gpio/gpio.h rename to src/fsfw_hal/stm32h7/gpio/gpio.h diff --git a/hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt b/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt rename to src/fsfw_hal/stm32h7/i2c/CMakeLists.txt diff --git a/hal/src/fsfw_hal/stm32h7/interrupts.h b/src/fsfw_hal/stm32h7/interrupts.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/interrupts.h rename to src/fsfw_hal/stm32h7/interrupts.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt b/src/fsfw_hal/stm32h7/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt rename to src/fsfw_hal/stm32h7/spi/CMakeLists.txt diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp b/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp rename to src/fsfw_hal/stm32h7/spi/SpiComIF.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h b/src/fsfw_hal/stm32h7/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h rename to src/fsfw_hal/stm32h7/spi/SpiComIF.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp b/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp rename to src/fsfw_hal/stm32h7/spi/SpiCookie.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h b/src/fsfw_hal/stm32h7/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h rename to src/fsfw_hal/stm32h7/spi/SpiCookie.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp b/src/fsfw_hal/stm32h7/spi/mspInit.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp rename to src/fsfw_hal/stm32h7/spi/mspInit.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/mspInit.h b/src/fsfw_hal/stm32h7/spi/mspInit.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/mspInit.h rename to src/fsfw_hal/stm32h7/spi/mspInit.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp b/src/fsfw_hal/stm32h7/spi/spiCore.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp rename to src/fsfw_hal/stm32h7/spi/spiCore.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiCore.h b/src/fsfw_hal/stm32h7/spi/spiCore.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiCore.h rename to src/fsfw_hal/stm32h7/spi/spiCore.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp b/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp rename to src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h b/src/fsfw_hal/stm32h7/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h rename to src/fsfw_hal/stm32h7/spi/spiDefinitions.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp b/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp rename to src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.h b/src/fsfw_hal/stm32h7/spi/spiInterrupts.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.h rename to src/fsfw_hal/stm32h7/spi/spiInterrupts.h diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp b/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp rename to src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.h b/src/fsfw_hal/stm32h7/spi/stm32h743zi.h similarity index 100% rename from hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.h rename to src/fsfw_hal/stm32h7/spi/stm32h743zi.h diff --git a/hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt b/src/fsfw_hal/stm32h7/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt rename to src/fsfw_hal/stm32h7/uart/CMakeLists.txt diff --git a/tests/src/fsfw_tests/CMakeLists.txt b/src/fsfw_tests/CMakeLists.txt similarity index 65% rename from tests/src/fsfw_tests/CMakeLists.txt rename to src/fsfw_tests/CMakeLists.txt index f6e1b8ab..5e16e0a7 100644 --- a/tests/src/fsfw_tests/CMakeLists.txt +++ b/src/fsfw_tests/CMakeLists.txt @@ -2,8 +2,6 @@ if(FSFW_ADD_INTERNAL_TESTS) add_subdirectory(internal) endif() -if(FSFW_BUILD_UNITTESTS) - add_subdirectory(unit) -else() +if(NOT FSFW_BUILD_TESTS) add_subdirectory(integration) endif() diff --git a/tests/src/fsfw_tests/integration/CMakeLists.txt b/src/fsfw_tests/integration/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/integration/CMakeLists.txt rename to src/fsfw_tests/integration/CMakeLists.txt diff --git a/tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt b/src/fsfw_tests/integration/assemblies/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt rename to src/fsfw_tests/integration/assemblies/CMakeLists.txt diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp b/src/fsfw_tests/integration/assemblies/TestAssembly.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp rename to src/fsfw_tests/integration/assemblies/TestAssembly.cpp diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.h b/src/fsfw_tests/integration/assemblies/TestAssembly.h similarity index 100% rename from tests/src/fsfw_tests/integration/assemblies/TestAssembly.h rename to src/fsfw_tests/integration/assemblies/TestAssembly.h diff --git a/tests/src/fsfw_tests/integration/controller/CMakeLists.txt b/src/fsfw_tests/integration/controller/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/integration/controller/CMakeLists.txt rename to src/fsfw_tests/integration/controller/CMakeLists.txt diff --git a/tests/src/fsfw_tests/integration/controller/TestController.cpp b/src/fsfw_tests/integration/controller/TestController.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/controller/TestController.cpp rename to src/fsfw_tests/integration/controller/TestController.cpp diff --git a/tests/src/fsfw_tests/integration/controller/TestController.h b/src/fsfw_tests/integration/controller/TestController.h similarity index 100% rename from tests/src/fsfw_tests/integration/controller/TestController.h rename to src/fsfw_tests/integration/controller/TestController.h diff --git a/tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h b/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h similarity index 100% rename from tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h rename to src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h diff --git a/tests/src/fsfw_tests/integration/devices/CMakeLists.txt b/src/fsfw_tests/integration/devices/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/integration/devices/CMakeLists.txt rename to src/fsfw_tests/integration/devices/CMakeLists.txt diff --git a/tests/src/fsfw_tests/integration/devices/TestCookie.cpp b/src/fsfw_tests/integration/devices/TestCookie.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestCookie.cpp rename to src/fsfw_tests/integration/devices/TestCookie.cpp diff --git a/tests/src/fsfw_tests/integration/devices/TestCookie.h b/src/fsfw_tests/integration/devices/TestCookie.h similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestCookie.h rename to src/fsfw_tests/integration/devices/TestCookie.h diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp b/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp rename to src/fsfw_tests/integration/devices/TestDeviceHandler.cpp diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h b/src/fsfw_tests/integration/devices/TestDeviceHandler.h similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h rename to src/fsfw_tests/integration/devices/TestDeviceHandler.h diff --git a/tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp b/src/fsfw_tests/integration/devices/TestEchoComIF.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp rename to src/fsfw_tests/integration/devices/TestEchoComIF.cpp diff --git a/tests/src/fsfw_tests/integration/devices/TestEchoComIF.h b/src/fsfw_tests/integration/devices/TestEchoComIF.h similarity index 100% rename from tests/src/fsfw_tests/integration/devices/TestEchoComIF.h rename to src/fsfw_tests/integration/devices/TestEchoComIF.h diff --git a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h b/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h similarity index 100% rename from tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h rename to src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h diff --git a/tests/src/fsfw_tests/integration/task/CMakeLists.txt b/src/fsfw_tests/integration/task/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/integration/task/CMakeLists.txt rename to src/fsfw_tests/integration/task/CMakeLists.txt diff --git a/tests/src/fsfw_tests/integration/task/TestTask.cpp b/src/fsfw_tests/integration/task/TestTask.cpp similarity index 100% rename from tests/src/fsfw_tests/integration/task/TestTask.cpp rename to src/fsfw_tests/integration/task/TestTask.cpp diff --git a/tests/src/fsfw_tests/integration/task/TestTask.h b/src/fsfw_tests/integration/task/TestTask.h similarity index 100% rename from tests/src/fsfw_tests/integration/task/TestTask.h rename to src/fsfw_tests/integration/task/TestTask.h diff --git a/tests/src/fsfw_tests/internal/CMakeLists.txt b/src/fsfw_tests/internal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/internal/CMakeLists.txt rename to src/fsfw_tests/internal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp b/src/fsfw_tests/internal/InternalUnitTester.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/InternalUnitTester.cpp rename to src/fsfw_tests/internal/InternalUnitTester.cpp diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.h b/src/fsfw_tests/internal/InternalUnitTester.h similarity index 100% rename from tests/src/fsfw_tests/internal/InternalUnitTester.h rename to src/fsfw_tests/internal/InternalUnitTester.h diff --git a/tests/src/fsfw_tests/internal/UnittDefinitions.cpp b/src/fsfw_tests/internal/UnittDefinitions.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/UnittDefinitions.cpp rename to src/fsfw_tests/internal/UnittDefinitions.cpp diff --git a/tests/src/fsfw_tests/internal/UnittDefinitions.h b/src/fsfw_tests/internal/UnittDefinitions.h similarity index 100% rename from tests/src/fsfw_tests/internal/UnittDefinitions.h rename to src/fsfw_tests/internal/UnittDefinitions.h diff --git a/tests/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt b/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt rename to src/fsfw_tests/internal/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp b/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp rename to src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp diff --git a/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h b/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h rename to src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/tests/src/fsfw_tests/internal/osal/CMakeLists.txt b/src/fsfw_tests/internal/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/internal/osal/CMakeLists.txt rename to src/fsfw_tests/internal/osal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/internal/osal/testMq.cpp b/src/fsfw_tests/internal/osal/testMq.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testMq.cpp rename to src/fsfw_tests/internal/osal/testMq.cpp diff --git a/tests/src/fsfw_tests/internal/osal/testMq.h b/src/fsfw_tests/internal/osal/testMq.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testMq.h rename to src/fsfw_tests/internal/osal/testMq.h diff --git a/tests/src/fsfw_tests/internal/osal/testMutex.cpp b/src/fsfw_tests/internal/osal/testMutex.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testMutex.cpp rename to src/fsfw_tests/internal/osal/testMutex.cpp diff --git a/tests/src/fsfw_tests/internal/osal/testMutex.h b/src/fsfw_tests/internal/osal/testMutex.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testMutex.h rename to src/fsfw_tests/internal/osal/testMutex.h diff --git a/tests/src/fsfw_tests/internal/osal/testSemaphore.cpp b/src/fsfw_tests/internal/osal/testSemaphore.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testSemaphore.cpp rename to src/fsfw_tests/internal/osal/testSemaphore.cpp diff --git a/tests/src/fsfw_tests/internal/osal/testSemaphore.h b/src/fsfw_tests/internal/osal/testSemaphore.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/testSemaphore.h rename to src/fsfw_tests/internal/osal/testSemaphore.h diff --git a/tests/src/fsfw_tests/internal/serialize/CMakeLists.txt b/src/fsfw_tests/internal/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/internal/serialize/CMakeLists.txt rename to src/fsfw_tests/internal/serialize/CMakeLists.txt diff --git a/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp b/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp similarity index 100% rename from tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp rename to src/fsfw_tests/internal/serialize/IntTestSerialization.cpp diff --git a/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.h b/src/fsfw_tests/internal/serialize/IntTestSerialization.h similarity index 100% rename from tests/src/fsfw_tests/internal/serialize/IntTestSerialization.h rename to src/fsfw_tests/internal/serialize/IntTestSerialization.h diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index febd4f0a..00000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(src) diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt deleted file mode 100644 index 6673f1e4..00000000 --- a/tests/src/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -add_subdirectory(fsfw_tests) diff --git a/tests/src/fsfw_tests/unit/CMakeLists.txt b/unittests/CMakeLists.txt similarity index 86% rename from tests/src/fsfw_tests/unit/CMakeLists.txt rename to unittests/CMakeLists.txt index f54e1fc9..f32c6e08 100644 --- a/tests/src/fsfw_tests/unit/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -2,7 +2,7 @@ target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp printChar.cpp - version.cpp + testVersion.cpp ) target_sources(${FSFW_TEST_TGT} PRIVATE @@ -27,3 +27,5 @@ add_subdirectory(cfdp) add_subdirectory(hal) add_subdirectory(internalerror) add_subdirectory(devicehandler) + +target_include_directories(${FSFW_TEST_TGT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/tests/src/fsfw_tests/unit/CatchDefinitions.cpp b/unittests/CatchDefinitions.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchDefinitions.cpp rename to unittests/CatchDefinitions.cpp diff --git a/tests/src/fsfw_tests/unit/CatchDefinitions.h b/unittests/CatchDefinitions.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchDefinitions.h rename to unittests/CatchDefinitions.h diff --git a/tests/src/fsfw_tests/unit/CatchFactory.cpp b/unittests/CatchFactory.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchFactory.cpp rename to unittests/CatchFactory.cpp diff --git a/tests/src/fsfw_tests/unit/CatchFactory.h b/unittests/CatchFactory.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchFactory.h rename to unittests/CatchFactory.h diff --git a/tests/src/fsfw_tests/unit/CatchRunner.cpp b/unittests/CatchRunner.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchRunner.cpp rename to unittests/CatchRunner.cpp diff --git a/tests/src/fsfw_tests/unit/CatchRunner.h b/unittests/CatchRunner.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchRunner.h rename to unittests/CatchRunner.h diff --git a/tests/src/fsfw_tests/unit/CatchSetup.cpp b/unittests/CatchSetup.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchSetup.cpp rename to unittests/CatchSetup.cpp diff --git a/tests/src/fsfw_tests/unit/action/CMakeLists.txt b/unittests/action/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/action/CMakeLists.txt rename to unittests/action/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp b/unittests/action/TestActionHelper.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/action/TestActionHelper.cpp rename to unittests/action/TestActionHelper.cpp index 923b7436..6461a195 100644 --- a/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp +++ b/unittests/action/TestActionHelper.cpp @@ -6,7 +6,7 @@ #include #include -#include "fsfw_tests/unit/mocks/MessageQueueMockBase.h" +#include "mocks/MessageQueueMockBase.h" TEST_CASE("Action Helper", "[ActionHelper]") { ActionHelperOwnerMockBase testDhMock; diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.h b/unittests/action/TestActionHelper.h similarity index 96% rename from tests/src/fsfw_tests/unit/action/TestActionHelper.h rename to unittests/action/TestActionHelper.h index 243f030a..75a9f3fe 100644 --- a/tests/src/fsfw_tests/unit/action/TestActionHelper.h +++ b/unittests/action/TestActionHelper.h @@ -6,7 +6,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" class ActionHelperOwnerMockBase : public HasActionsIF { public: diff --git a/tests/src/fsfw_tests/unit/cfdp/CMakeLists.txt b/unittests/cfdp/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/CMakeLists.txt rename to unittests/cfdp/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/cfdp/testAckPdu.cpp b/unittests/cfdp/testAckPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testAckPdu.cpp rename to unittests/cfdp/testAckPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testCfdp.cpp b/unittests/cfdp/testCfdp.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/cfdp/testCfdp.cpp rename to unittests/cfdp/testCfdp.cpp index 19b1ec7f..6ca95fbc 100644 --- a/tests/src/fsfw_tests/unit/cfdp/testCfdp.cpp +++ b/unittests/cfdp/testCfdp.cpp @@ -9,7 +9,7 @@ #include "fsfw/cfdp/pdu/HeaderSerializer.h" #include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/serialize/SerializeAdapter.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("CFDP Base", "[CfdpBase]") { using namespace cfdp; diff --git a/tests/src/fsfw_tests/unit/cfdp/testEofPdu.cpp b/unittests/cfdp/testEofPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testEofPdu.cpp rename to unittests/cfdp/testEofPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testFileData.cpp b/unittests/cfdp/testFileData.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testFileData.cpp rename to unittests/cfdp/testFileData.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp b/unittests/cfdp/testFinishedPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp rename to unittests/cfdp/testFinishedPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp b/unittests/cfdp/testKeepAlivePdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp rename to unittests/cfdp/testKeepAlivePdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp b/unittests/cfdp/testMetadataPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp rename to unittests/cfdp/testMetadataPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testNakPdu.cpp b/unittests/cfdp/testNakPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testNakPdu.cpp rename to unittests/cfdp/testNakPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp b/unittests/cfdp/testPromptPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp rename to unittests/cfdp/testPromptPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp b/unittests/cfdp/testTlvsLvs.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp rename to unittests/cfdp/testTlvsLvs.cpp diff --git a/tests/src/fsfw_tests/unit/container/CMakeLists.txt b/unittests/container/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/container/CMakeLists.txt rename to unittests/container/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/unittests/container/RingBufferTest.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/container/RingBufferTest.cpp rename to unittests/container/RingBufferTest.cpp index a83fa2ac..ff5db76b 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/unittests/container/RingBufferTest.cpp @@ -3,7 +3,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Ring Buffer Test", "[RingBufferTest]") { uint8_t testData[13] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; diff --git a/tests/src/fsfw_tests/unit/container/TestArrayList.cpp b/unittests/container/TestArrayList.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/container/TestArrayList.cpp rename to unittests/container/TestArrayList.cpp index 2c5a37d9..4daf59d4 100644 --- a/tests/src/fsfw_tests/unit/container/TestArrayList.cpp +++ b/unittests/container/TestArrayList.cpp @@ -3,7 +3,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" /** * @brief Array List test diff --git a/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp b/unittests/container/TestDynamicFifo.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp rename to unittests/container/TestDynamicFifo.cpp index 540ea31e..6769c247 100644 --- a/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp +++ b/unittests/container/TestDynamicFifo.cpp @@ -4,7 +4,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Dynamic Fifo Tests", "[TestDynamicFifo]") { INFO("Dynamic Fifo Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestFifo.cpp b/unittests/container/TestFifo.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/container/TestFifo.cpp rename to unittests/container/TestFifo.cpp index a9eb7956..0b4b41af 100644 --- a/tests/src/fsfw_tests/unit/container/TestFifo.cpp +++ b/unittests/container/TestFifo.cpp @@ -4,7 +4,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Static Fifo Tests", "[TestFifo]") { INFO("Fifo Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp b/unittests/container/TestFixedArrayList.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp rename to unittests/container/TestFixedArrayList.cpp index 42ae01d5..6beb8d5d 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp +++ b/unittests/container/TestFixedArrayList.cpp @@ -3,7 +3,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("FixedArrayList Tests", "[TestFixedArrayList]") { INFO("FixedArrayList Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp b/unittests/container/TestFixedMap.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/container/TestFixedMap.cpp rename to unittests/container/TestFixedMap.cpp index 4c3cad1e..d3c65760 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp +++ b/unittests/container/TestFixedMap.cpp @@ -3,7 +3,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" template class FixedMap; diff --git a/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp b/unittests/container/TestFixedOrderedMultimap.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp rename to unittests/container/TestFixedOrderedMultimap.cpp index 7dd63b34..88b32694 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp +++ b/unittests/container/TestFixedOrderedMultimap.cpp @@ -3,7 +3,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("FixedOrderedMultimap Tests", "[TestFixedOrderedMultimap]") { INFO("FixedOrderedMultimap Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp b/unittests/container/TestPlacementFactory.cpp similarity index 97% rename from tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp rename to unittests/container/TestPlacementFactory.cpp index 0140ce05..1333567e 100644 --- a/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp +++ b/unittests/container/TestPlacementFactory.cpp @@ -5,7 +5,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("PlacementFactory Tests", "[TestPlacementFactory]") { INFO("PlacementFactory Tests"); diff --git a/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt b/unittests/datapoollocal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt rename to unittests/datapoollocal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/unittests/datapoollocal/DataSetTest.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp rename to unittests/datapoollocal/DataSetTest.cpp index 902d59ef..c56ed768 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp +++ b/unittests/datapoollocal/DataSetTest.cpp @@ -9,7 +9,7 @@ #include #include "LocalPoolOwnerBase.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" #include "tests/TestsConfig.h" TEST_CASE("DataSetTest", "[DataSetTest]") { diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/unittests/datapoollocal/LocalPoolManagerTest.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp rename to unittests/datapoollocal/LocalPoolManagerTest.cpp index f2a5c18a..019c9b59 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp +++ b/unittests/datapoollocal/LocalPoolManagerTest.cpp @@ -12,7 +12,7 @@ #include #include "LocalPoolOwnerBase.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("LocalPoolManagerTest", "[LocManTest]") { LocalPoolOwnerBase* poolOwner = diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp b/unittests/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp rename to unittests/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h b/unittests/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h rename to unittests/datapoollocal/LocalPoolOwnerBase.h diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/unittests/datapoollocal/LocalPoolVariableTest.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp rename to unittests/datapoollocal/LocalPoolVariableTest.cpp index 73d51d92..86bd6a1e 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp +++ b/unittests/datapoollocal/LocalPoolVariableTest.cpp @@ -4,11 +4,11 @@ #include #include "LocalPoolOwnerBase.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { - LocalPoolOwnerBase* poolOwner = + auto* poolOwner = ObjectManager::instance()->get(objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner != nullptr); REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/unittests/datapoollocal/LocalPoolVectorTest.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp rename to unittests/datapoollocal/LocalPoolVectorTest.cpp index 5932db44..3a06c826 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp +++ b/unittests/datapoollocal/LocalPoolVectorTest.cpp @@ -4,7 +4,7 @@ #include #include "LocalPoolOwnerBase.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { diff --git a/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt b/unittests/devicehandler/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt rename to unittests/devicehandler/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/unittests/devicehandler/ComIFMock.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp rename to unittests/devicehandler/ComIFMock.cpp index 4d985f94..650b74bd 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp +++ b/unittests/devicehandler/ComIFMock.cpp @@ -1,46 +1,46 @@ -#include "ComIFMock.h" - -#include "DeviceHandlerMock.h" - -ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {} - -ComIFMock::~ComIFMock() {} - -ReturnValue_t ComIFMock::initializeInterface(CookieIF *cookie) { return RETURN_OK; } - -ReturnValue_t ComIFMock::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { - data = *sendData; - return RETURN_OK; -} - -ReturnValue_t ComIFMock::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } - -ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { - return RETURN_OK; -} - -ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { - switch (testCase) { - case TestCase::MISSED_REPLY: { - *size = 0; - return RETURN_OK; - } - case TestCase::SIMPLE_COMMAND_NOMINAL: { - *size = 1; - data = DeviceHandlerMock::SIMPLE_COMMAND_DATA; - *buffer = &data; - break; - } - case TestCase::PERIODIC_REPLY_NOMINAL: { - *size = 1; - data = DeviceHandlerMock::PERIODIC_REPLY_DATA; - *buffer = &data; - break; - } - default: - break; - } - return RETURN_OK; -} - -void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; } +#include "ComIFMock.h" + +#include "DeviceHandlerMock.h" + +ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {} + +ComIFMock::~ComIFMock() {} + +ReturnValue_t ComIFMock::initializeInterface(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFMock::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + data = *sendData; + return RETURN_OK; +} + +ReturnValue_t ComIFMock::getSendSuccess(CookieIF *cookie) { return RETURN_OK; } + +ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return RETURN_OK; +} + +ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + switch (testCase) { + case TestCase::MISSED_REPLY: { + *size = 0; + return RETURN_OK; + } + case TestCase::SIMPLE_COMMAND_NOMINAL: { + *size = 1; + data = DeviceHandlerMock::SIMPLE_COMMAND_DATA; + *buffer = &data; + break; + } + case TestCase::PERIODIC_REPLY_NOMINAL: { + *size = 1; + data = DeviceHandlerMock::PERIODIC_REPLY_DATA; + *buffer = &data; + break; + } + default: + break; + } + return RETURN_OK; +} + +void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h b/unittests/devicehandler/ComIFMock.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h rename to unittests/devicehandler/ComIFMock.h index 1463deb6..d16cc0a6 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h +++ b/unittests/devicehandler/ComIFMock.h @@ -1,37 +1,37 @@ -#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ -#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ - -#include -#include - -/** - * @brief The ComIFMock supports the simulation of various device communication error cases - * like incomplete or wrong replies and can be used to test the - * DeviceHandlerBase. - */ -class ComIFMock : public DeviceCommunicationIF, public SystemObject { - public: - enum class TestCase { SIMPLE_COMMAND_NOMINAL, PERIODIC_REPLY_NOMINAL, MISSED_REPLY }; - - ComIFMock(object_id_t objectId); - virtual ~ComIFMock(); - - virtual ReturnValue_t initializeInterface(CookieIF *cookie) override; - virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, - size_t sendLen) override; - virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; - virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; - virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, - size_t *size) override; - void setTestCase(TestCase testCase_); - - private: - TestCase testCase = TestCase::SIMPLE_COMMAND_NOMINAL; - - static const uint8_t SIMPLE_COMMAND_DATA = 1; - static const uint8_t PERIODIC_REPLY_DATA = 2; - - uint8_t data = 0; -}; - -#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ */ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ + +#include +#include + +/** + * @brief The ComIFMock supports the simulation of various device communication error cases + * like incomplete or wrong replies and can be used to test the + * DeviceHandlerBase. + */ +class ComIFMock : public DeviceCommunicationIF, public SystemObject { + public: + enum class TestCase { SIMPLE_COMMAND_NOMINAL, PERIODIC_REPLY_NOMINAL, MISSED_REPLY }; + + ComIFMock(object_id_t objectId); + virtual ~ComIFMock(); + + virtual ReturnValue_t initializeInterface(CookieIF *cookie) override; + virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData, + size_t sendLen) override; + virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; + virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override; + virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + void setTestCase(TestCase testCase_); + + private: + TestCase testCase = TestCase::SIMPLE_COMMAND_NOMINAL; + + static const uint8_t SIMPLE_COMMAND_DATA = 1; + static const uint8_t PERIODIC_REPLY_DATA = 2; + + uint8_t data = 0; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp b/unittests/devicehandler/CookieIFMock.cpp similarity index 94% rename from tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp rename to unittests/devicehandler/CookieIFMock.cpp index e9b03a6c..1ae2eb6e 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp +++ b/unittests/devicehandler/CookieIFMock.cpp @@ -1,5 +1,5 @@ -#include "CookieIFMock.h" - -CookieIFMock::CookieIFMock() {} - -CookieIFMock::~CookieIFMock() {} +#include "CookieIFMock.h" + +CookieIFMock::CookieIFMock() {} + +CookieIFMock::~CookieIFMock() {} diff --git a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h b/unittests/devicehandler/CookieIFMock.h similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h rename to unittests/devicehandler/CookieIFMock.h index 5c868932..1243b0a7 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h +++ b/unittests/devicehandler/CookieIFMock.h @@ -1,12 +1,12 @@ -#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ -#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ - -#include "fsfw/devicehandlers/CookieIF.h" - -class CookieIFMock : public CookieIF { - public: - CookieIFMock(); - virtual ~CookieIFMock(); -}; - -#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ */ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ + +#include "fsfw/devicehandlers/CookieIF.h" + +class CookieIFMock : public CookieIF { + public: + CookieIFMock(); + virtual ~CookieIFMock(); +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp b/unittests/devicehandler/DeviceFdirMock.cpp similarity index 89% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp rename to unittests/devicehandler/DeviceFdirMock.cpp index dfef7cd3..e3ac39ac 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp +++ b/unittests/devicehandler/DeviceFdirMock.cpp @@ -1,6 +1,6 @@ #include "DeviceFdirMock.h" -#include +#include "devicehandler/DeviceFdirMock.h" DeviceFdirMock::DeviceFdirMock(object_id_t owner, object_id_t parent) : DeviceHandlerFailureIsolation(owner, parent) {} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h b/unittests/devicehandler/DeviceFdirMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h rename to unittests/devicehandler/DeviceFdirMock.h diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/unittests/devicehandler/DeviceHandlerCommander.cpp similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp rename to unittests/devicehandler/DeviceHandlerCommander.cpp index 4540a388..d38166ad 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp +++ b/unittests/devicehandler/DeviceHandlerCommander.cpp @@ -1,64 +1,64 @@ -#include "DeviceHandlerCommander.h" - -#include - -DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId) - : SystemObject(objectId), commandActionHelper(this) { - auto mqArgs = MqArgs(this->getObjectId()); - commandQueue = QueueFactory::instance()->createMessageQueue( - QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); -} - -DeviceHandlerCommander::~DeviceHandlerCommander() {} - -ReturnValue_t DeviceHandlerCommander::performOperation(uint8_t operationCode) { - readCommandQueue(); - return RETURN_OK; -} - -ReturnValue_t DeviceHandlerCommander::initialize() { - ReturnValue_t result = commandActionHelper.initialize(); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - return HasReturnvaluesIF::RETURN_OK; -} - -MessageQueueIF* DeviceHandlerCommander::getCommandQueuePtr() { return commandQueue; } - -void DeviceHandlerCommander::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {} - -void DeviceHandlerCommander::stepFailedReceived(ActionId_t actionId, uint8_t step, - ReturnValue_t returnCode) {} - -void DeviceHandlerCommander::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { -} - -void DeviceHandlerCommander::completionSuccessfulReceived(ActionId_t actionId) { - lastReplyReturnCode = RETURN_OK; -} - -void DeviceHandlerCommander::completionFailedReceived(ActionId_t actionId, - ReturnValue_t returnCode) { - lastReplyReturnCode = returnCode; -} - -void DeviceHandlerCommander::readCommandQueue() { - CommandMessage message; - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK; - result = commandQueue->receiveMessage(&message)) { - result = commandActionHelper.handleReply(&message); - if (result == HasReturnvaluesIF::RETURN_OK) { - continue; - } - } -} - -ReturnValue_t DeviceHandlerCommander::sendCommand(object_id_t target, ActionId_t actionId) { - return commandActionHelper.commandAction(target, actionId, nullptr, 0); -} - -ReturnValue_t DeviceHandlerCommander::getReplyReturnCode() { return lastReplyReturnCode; } - -void DeviceHandlerCommander::resetReplyReturnCode() { lastReplyReturnCode = RETURN_FAILED; } +#include "DeviceHandlerCommander.h" + +#include + +DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId) + : SystemObject(objectId), commandActionHelper(this) { + auto mqArgs = MqArgs(this->getObjectId()); + commandQueue = QueueFactory::instance()->createMessageQueue( + QUEUE_SIZE, MessageQueueMessage::MAX_MESSAGE_SIZE, &mqArgs); +} + +DeviceHandlerCommander::~DeviceHandlerCommander() {} + +ReturnValue_t DeviceHandlerCommander::performOperation(uint8_t operationCode) { + readCommandQueue(); + return RETURN_OK; +} + +ReturnValue_t DeviceHandlerCommander::initialize() { + ReturnValue_t result = commandActionHelper.initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + return HasReturnvaluesIF::RETURN_OK; +} + +MessageQueueIF* DeviceHandlerCommander::getCommandQueuePtr() { return commandQueue; } + +void DeviceHandlerCommander::stepSuccessfulReceived(ActionId_t actionId, uint8_t step) {} + +void DeviceHandlerCommander::stepFailedReceived(ActionId_t actionId, uint8_t step, + ReturnValue_t returnCode) {} + +void DeviceHandlerCommander::dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) { +} + +void DeviceHandlerCommander::completionSuccessfulReceived(ActionId_t actionId) { + lastReplyReturnCode = RETURN_OK; +} + +void DeviceHandlerCommander::completionFailedReceived(ActionId_t actionId, + ReturnValue_t returnCode) { + lastReplyReturnCode = returnCode; +} + +void DeviceHandlerCommander::readCommandQueue() { + CommandMessage message; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK; + result = commandQueue->receiveMessage(&message)) { + result = commandActionHelper.handleReply(&message); + if (result == HasReturnvaluesIF::RETURN_OK) { + continue; + } + } +} + +ReturnValue_t DeviceHandlerCommander::sendCommand(object_id_t target, ActionId_t actionId) { + return commandActionHelper.commandAction(target, actionId, nullptr, 0); +} + +ReturnValue_t DeviceHandlerCommander::getReplyReturnCode() { return lastReplyReturnCode; } + +void DeviceHandlerCommander::resetReplyReturnCode() { lastReplyReturnCode = RETURN_FAILED; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h b/unittests/devicehandler/DeviceHandlerCommander.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h rename to unittests/devicehandler/DeviceHandlerCommander.h index 82183baf..435d0017 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h +++ b/unittests/devicehandler/DeviceHandlerCommander.h @@ -1,50 +1,50 @@ -#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ -#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ - -#include "fsfw/action/CommandActionHelper.h" -#include "fsfw/action/CommandsActionsIF.h" -#include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/returnvalues/HasReturnvaluesIF.h" -#include "fsfw/tasks/ExecutableObjectIF.h" - -class DeviceHandlerCommander : public ExecutableObjectIF, - public SystemObject, - public CommandsActionsIF, - public HasReturnvaluesIF { - public: - DeviceHandlerCommander(object_id_t objectId); - virtual ~DeviceHandlerCommander(); - - ReturnValue_t performOperation(uint8_t operationCode = 0); - ReturnValue_t initialize() override; - MessageQueueIF* getCommandQueuePtr() override; - void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override; - void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override; - void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override; - void completionSuccessfulReceived(ActionId_t actionId) override; - void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override; - - /** - * @brief Calling this function will send the command to the device handler object. - * - * @param target Object ID of the device handler - * @param actionId Action ID of the command to send - */ - ReturnValue_t sendCommand(object_id_t target, ActionId_t actionId); - - ReturnValue_t getReplyReturnCode(); - void resetReplyReturnCode(); - - private: - static const uint32_t QUEUE_SIZE = 20; - - MessageQueueIF* commandQueue = nullptr; - - CommandActionHelper commandActionHelper; - - ReturnValue_t lastReplyReturnCode = RETURN_FAILED; - - void readCommandQueue(); -}; - -#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ */ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ + +#include "fsfw/action/CommandActionHelper.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" + +class DeviceHandlerCommander : public ExecutableObjectIF, + public SystemObject, + public CommandsActionsIF, + public HasReturnvaluesIF { + public: + DeviceHandlerCommander(object_id_t objectId); + virtual ~DeviceHandlerCommander(); + + ReturnValue_t performOperation(uint8_t operationCode = 0); + ReturnValue_t initialize() override; + MessageQueueIF* getCommandQueuePtr() override; + void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override; + void stepFailedReceived(ActionId_t actionId, uint8_t step, ReturnValue_t returnCode) override; + void dataReceived(ActionId_t actionId, const uint8_t* data, uint32_t size) override; + void completionSuccessfulReceived(ActionId_t actionId) override; + void completionFailedReceived(ActionId_t actionId, ReturnValue_t returnCode) override; + + /** + * @brief Calling this function will send the command to the device handler object. + * + * @param target Object ID of the device handler + * @param actionId Action ID of the command to send + */ + ReturnValue_t sendCommand(object_id_t target, ActionId_t actionId); + + ReturnValue_t getReplyReturnCode(); + void resetReplyReturnCode(); + + private: + static const uint32_t QUEUE_SIZE = 20; + + MessageQueueIF* commandQueue = nullptr; + + CommandActionHelper commandActionHelper; + + ReturnValue_t lastReplyReturnCode = RETURN_FAILED; + + void readCommandQueue(); +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/unittests/devicehandler/DeviceHandlerMock.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp rename to unittests/devicehandler/DeviceHandlerMock.cpp index 1e05f8f3..ea30ff6a 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/unittests/devicehandler/DeviceHandlerMock.cpp @@ -1,103 +1,103 @@ -#include "DeviceHandlerMock.h" - -#include - -DeviceHandlerMock::DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, - CookieIF *comCookie, FailureIsolationBase *fdirInstance) - : DeviceHandlerBase(objectId, deviceCommunication, comCookie, fdirInstance) { - mode = MODE_ON; -} - -DeviceHandlerMock::~DeviceHandlerMock() {} - -void DeviceHandlerMock::doStartUp() { setMode(_MODE_TO_ON); } - -void DeviceHandlerMock::doShutDown() { setMode(_MODE_POWER_DOWN); } - -ReturnValue_t DeviceHandlerMock::buildNormalDeviceCommand(DeviceCommandId_t *id) { - return NOTHING_TO_SEND; -} - -ReturnValue_t DeviceHandlerMock::buildTransitionDeviceCommand(DeviceCommandId_t *id) { - return NOTHING_TO_SEND; -} - -ReturnValue_t DeviceHandlerMock::buildCommandFromCommand(DeviceCommandId_t deviceCommand, - const uint8_t *commandData, - size_t commandDataLen) { - switch (deviceCommand) { - case SIMPLE_COMMAND: { - commandBuffer[0] = SIMPLE_COMMAND_DATA; - rawPacket = commandBuffer; - rawPacketLen = sizeof(SIMPLE_COMMAND_DATA); - break; - } - default: - WARN("DeviceHandlerMock::buildCommandFromCommand: Invalid device command"); - break; - } - return RETURN_OK; -} - -ReturnValue_t DeviceHandlerMock::scanForReply(const uint8_t *start, size_t len, - DeviceCommandId_t *foundId, size_t *foundLen) { - switch (*start) { - case SIMPLE_COMMAND_DATA: { - *foundId = SIMPLE_COMMAND; - *foundLen = sizeof(SIMPLE_COMMAND_DATA); - return RETURN_OK; - break; - } - case PERIODIC_REPLY_DATA: { - *foundId = PERIODIC_REPLY; - *foundLen = sizeof(PERIODIC_REPLY_DATA); - return RETURN_OK; - break; - } - default: - break; - } - return RETURN_FAILED; -} - -ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { - switch (id) { - case SIMPLE_COMMAND: - case PERIODIC_REPLY: { - periodicReplyReceived = true; - break; - } - default: - break; - } - return RETURN_OK; -} - -void DeviceHandlerMock::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0, - &simpleCommandReplyTimeout); - insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0, - &periodicReplyCountdown); -} - -uint32_t DeviceHandlerMock::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } - -void DeviceHandlerMock::changePeriodicReplyCountdown(uint32_t timeout) { - periodicReplyCountdown.setTimeout(timeout); -} - -void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) { - simpleCommandReplyTimeout.setTimeout(timeout); -} - -void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = false; } - -bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; } - -ReturnValue_t DeviceHandlerMock::enablePeriodicReply(DeviceCommandId_t replyId) { - return updatePeriodicReply(true, replyId); -} - -ReturnValue_t DeviceHandlerMock::disablePeriodicReply(DeviceCommandId_t replyId) { - return updatePeriodicReply(false, replyId); -} +#include "DeviceHandlerMock.h" + +#include + +DeviceHandlerMock::DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, + CookieIF *comCookie, FailureIsolationBase *fdirInstance) + : DeviceHandlerBase(objectId, deviceCommunication, comCookie, fdirInstance) { + mode = MODE_ON; +} + +DeviceHandlerMock::~DeviceHandlerMock() {} + +void DeviceHandlerMock::doStartUp() { setMode(_MODE_TO_ON); } + +void DeviceHandlerMock::doShutDown() { setMode(_MODE_POWER_DOWN); } + +ReturnValue_t DeviceHandlerMock::buildNormalDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t DeviceHandlerMock::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + return NOTHING_TO_SEND; +} + +ReturnValue_t DeviceHandlerMock::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, + size_t commandDataLen) { + switch (deviceCommand) { + case SIMPLE_COMMAND: { + commandBuffer[0] = SIMPLE_COMMAND_DATA; + rawPacket = commandBuffer; + rawPacketLen = sizeof(SIMPLE_COMMAND_DATA); + break; + } + default: + WARN("DeviceHandlerMock::buildCommandFromCommand: Invalid device command"); + break; + } + return RETURN_OK; +} + +ReturnValue_t DeviceHandlerMock::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + switch (*start) { + case SIMPLE_COMMAND_DATA: { + *foundId = SIMPLE_COMMAND; + *foundLen = sizeof(SIMPLE_COMMAND_DATA); + return RETURN_OK; + break; + } + case PERIODIC_REPLY_DATA: { + *foundId = PERIODIC_REPLY; + *foundLen = sizeof(PERIODIC_REPLY_DATA); + return RETURN_OK; + break; + } + default: + break; + } + return RETURN_FAILED; +} + +ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + switch (id) { + case SIMPLE_COMMAND: + case PERIODIC_REPLY: { + periodicReplyReceived = true; + break; + } + default: + break; + } + return RETURN_OK; +} + +void DeviceHandlerMock::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0, + &simpleCommandReplyTimeout); + insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0, + &periodicReplyCountdown); +} + +uint32_t DeviceHandlerMock::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +void DeviceHandlerMock::changePeriodicReplyCountdown(uint32_t timeout) { + periodicReplyCountdown.setTimeout(timeout); +} + +void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) { + simpleCommandReplyTimeout.setTimeout(timeout); +} + +void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = false; } + +bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; } + +ReturnValue_t DeviceHandlerMock::enablePeriodicReply(DeviceCommandId_t replyId) { + return updatePeriodicReply(true, replyId); +} + +ReturnValue_t DeviceHandlerMock::disablePeriodicReply(DeviceCommandId_t replyId) { + return updatePeriodicReply(false, replyId); +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/unittests/devicehandler/DeviceHandlerMock.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h rename to unittests/devicehandler/DeviceHandlerMock.h index f5fcb4aa..ef1649c3 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/unittests/devicehandler/DeviceHandlerMock.h @@ -1,46 +1,46 @@ -#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ -#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ - -#include - -class DeviceHandlerMock : public DeviceHandlerBase { - public: - static const DeviceCommandId_t SIMPLE_COMMAND = 1; - static const DeviceCommandId_t PERIODIC_REPLY = 2; - - static const uint8_t SIMPLE_COMMAND_DATA = 1; - static const uint8_t PERIODIC_REPLY_DATA = 2; - - DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie, - FailureIsolationBase *fdirInstance); - virtual ~DeviceHandlerMock(); - void changePeriodicReplyCountdown(uint32_t timeout); - void changeSimpleCommandReplyCountdown(uint32_t timeout); - void resetPeriodicReplyState(); - bool getPeriodicReplyReceived(); - ReturnValue_t enablePeriodicReply(DeviceCommandId_t replyId); - ReturnValue_t disablePeriodicReply(DeviceCommandId_t replyId); - - protected: - void doStartUp() override; - void doShutDown() override; - ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; - ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, - size_t commandDataLen) override; - ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, - size_t *foundLen) override; - ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; - void fillCommandAndReplyMap() override; - uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; - - private: - Countdown simpleCommandReplyTimeout = Countdown(1000); - Countdown periodicReplyCountdown = Countdown(1000); - - uint8_t commandBuffer[1]; - - bool periodicReplyReceived = false; -}; - -#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ */ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ + +#include + +class DeviceHandlerMock : public DeviceHandlerBase { + public: + static const DeviceCommandId_t SIMPLE_COMMAND = 1; + static const DeviceCommandId_t PERIODIC_REPLY = 2; + + static const uint8_t SIMPLE_COMMAND_DATA = 1; + static const uint8_t PERIODIC_REPLY_DATA = 2; + + DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie, + FailureIsolationBase *fdirInstance); + virtual ~DeviceHandlerMock(); + void changePeriodicReplyCountdown(uint32_t timeout); + void changeSimpleCommandReplyCountdown(uint32_t timeout); + void resetPeriodicReplyState(); + bool getPeriodicReplyReceived(); + ReturnValue_t enablePeriodicReply(DeviceCommandId_t replyId); + ReturnValue_t disablePeriodicReply(DeviceCommandId_t replyId); + + protected: + void doStartUp() override; + void doShutDown() override; + ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + void fillCommandAndReplyMap() override; + uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; + + private: + Countdown simpleCommandReplyTimeout = Countdown(1000); + Countdown periodicReplyCountdown = Countdown(1000); + + uint8_t commandBuffer[1]; + + bool periodicReplyReceived = false; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/unittests/devicehandler/TestDeviceHandlerBase.cpp similarity index 92% rename from tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp rename to unittests/devicehandler/TestDeviceHandlerBase.cpp index 873329c3..328bc4dc 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/unittests/devicehandler/TestDeviceHandlerBase.cpp @@ -1,95 +1,95 @@ -#include - -#include "ComIFMock.h" -#include "DeviceFdirMock.h" -#include "fsfw_tests/unit/devicehandler/CookieIFMock.h" -#include "fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h" -#include "fsfw_tests/unit/devicehandler/DeviceHandlerMock.h" -#include "fsfw_tests/unit/testcfg/objects/systemObjectList.h" - -TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { - // Will be deleted with DHB destructor - CookieIFMock* cookieIFMock = new CookieIFMock; - ComIFMock comIF(objects::COM_IF_MOCK); - DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT); - DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, - cookieIFMock, &deviceFdirMock); - ReturnValue_t result = deviceHandlerMock.initialize(); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER); - result = deviceHandlerCommander.initialize(); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - - SECTION("Commanding nominal") { - comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL); - result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, - DeviceHandlerMock::SIMPLE_COMMAND); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); - deviceHandlerCommander.performOperation(); - result = deviceHandlerCommander.getReplyReturnCode(); - uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); - REQUIRE(missedReplies == 0); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - } - - SECTION("Commanding missed reply") { - comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); - deviceHandlerCommander.resetReplyReturnCode(); - // Set the timeout to 0 to immediately timeout the reply - deviceHandlerMock.changeSimpleCommandReplyCountdown(0); - result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, - DeviceHandlerMock::SIMPLE_COMMAND); - REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerCommander.performOperation(); - result = deviceHandlerCommander.getReplyReturnCode(); - REQUIRE(result == DeviceHandlerIF::TIMEOUT); - uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); - REQUIRE(missedReplies == 1); - } - - SECTION("Periodic reply nominal") { - comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL); - deviceHandlerMock.enablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); - REQUIRE(deviceHandlerMock.getPeriodicReplyReceived() == true); - } - - SECTION("Missed periodic reply") { - comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); - // Set the timeout to 0 to immediately timeout the reply - deviceHandlerMock.changePeriodicReplyCountdown(0); - deviceHandlerMock.enablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); - uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); - REQUIRE(missedReplies == 1); - // Test if disabling of periodic reply - deviceHandlerMock.disablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); - deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); - deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); - deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); - missedReplies = deviceFdirMock.getMissedReplyCount(); - // Should still be 1 because periodic reply is now disabled - REQUIRE(missedReplies == 1); - } -} +#include + +#include "ComIFMock.h" +#include "DeviceFdirMock.h" +#include "devicehandler/CookieIFMock.h" +#include "DeviceHandlerCommander.h" +#include "DeviceHandlerMock.h" +#include "objects/systemObjectList.h" + +TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { + // Will be deleted with DHB destructor + auto* cookieIFMock = new CookieIFMock; + ComIFMock comIF(objects::COM_IF_MOCK); + DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT); + DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, + cookieIFMock, &deviceFdirMock); + ReturnValue_t result = deviceHandlerMock.initialize(); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER); + result = deviceHandlerCommander.initialize(); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + + SECTION("Commanding nominal") { + comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL); + result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, + DeviceHandlerMock::SIMPLE_COMMAND); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); + deviceHandlerCommander.performOperation(); + result = deviceHandlerCommander.getReplyReturnCode(); + uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); + REQUIRE(missedReplies == 0); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + } + + SECTION("Commanding missed reply") { + comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); + deviceHandlerCommander.resetReplyReturnCode(); + // Set the timeout to 0 to immediately timeout the reply + deviceHandlerMock.changeSimpleCommandReplyCountdown(0); + result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, + DeviceHandlerMock::SIMPLE_COMMAND); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerCommander.performOperation(); + result = deviceHandlerCommander.getReplyReturnCode(); + REQUIRE(result == DeviceHandlerIF::TIMEOUT); + uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); + REQUIRE(missedReplies == 1); + } + + SECTION("Periodic reply nominal") { + comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL); + deviceHandlerMock.enablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); + REQUIRE(deviceHandlerMock.getPeriodicReplyReceived() == true); + } + + SECTION("Missed periodic reply") { + comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); + // Set the timeout to 0 to immediately timeout the reply + deviceHandlerMock.changePeriodicReplyCountdown(0); + deviceHandlerMock.enablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); + uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); + REQUIRE(missedReplies == 1); + // Test if disabling of periodic reply + deviceHandlerMock.disablePeriodicReply(DeviceHandlerMock::PERIODIC_REPLY); + deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); + deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ); + deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ); + missedReplies = deviceFdirMock.getMissedReplyCount(); + // Should still be 1 because periodic reply is now disabled + REQUIRE(missedReplies == 1); + } +} diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/unittests/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt rename to unittests/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp b/unittests/globalfunctions/testBitutil.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp rename to unittests/globalfunctions/testBitutil.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp b/unittests/globalfunctions/testCRC.cpp similarity index 88% rename from tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp rename to unittests/globalfunctions/testCRC.cpp index b163ea1f..884bd281 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp +++ b/unittests/globalfunctions/testCRC.cpp @@ -2,7 +2,7 @@ #include "catch2/catch_test_macros.hpp" #include "fsfw/globalfunctions/CRC.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("CRC", "[CRC]") { std::array testData = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/unittests/globalfunctions/testDleEncoder.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp rename to unittests/globalfunctions/testDleEncoder.cpp index 034cb3a0..1ccaddb5 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/unittests/globalfunctions/testDleEncoder.cpp @@ -2,7 +2,7 @@ #include "catch2/catch_test_macros.hpp" #include "fsfw/globalfunctions/DleEncoder.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" const std::vector TEST_ARRAY_0 = {0, 0, 0, 0, 0}; const std::vector TEST_ARRAY_1 = {0, DleEncoder::DLE_CHAR, 5}; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp b/unittests/globalfunctions/testOpDivider.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp rename to unittests/globalfunctions/testOpDivider.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp b/unittests/globalfunctions/testTimevalOperations.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp rename to unittests/globalfunctions/testTimevalOperations.cpp index 347d2204..155e6b15 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp +++ b/unittests/globalfunctions/testTimevalOperations.cpp @@ -3,7 +3,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("TimevalTest", "[timevalOperations]") { SECTION("Comparison") { diff --git a/tests/src/fsfw_tests/unit/hal/CMakeLists.txt b/unittests/hal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/hal/CMakeLists.txt rename to unittests/hal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp b/unittests/hal/testCommandExecutor.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp rename to unittests/hal/testCommandExecutor.cpp diff --git a/tests/src/fsfw_tests/unit/internalerror/CMakeLists.txt b/unittests/internalerror/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/internalerror/CMakeLists.txt rename to unittests/internalerror/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp b/unittests/internalerror/TestInternalErrorReporter.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp rename to unittests/internalerror/TestInternalErrorReporter.cpp index a993fff6..b52c5336 100644 --- a/tests/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp +++ b/unittests/internalerror/TestInternalErrorReporter.cpp @@ -12,8 +12,8 @@ #include "fsfw/ipc/CommandMessage.h" #include "fsfw/ipc/MessageQueueMessage.h" #include "fsfw/objectmanager/frameworkObjects.h" -#include "fsfw_tests/unit/CatchDefinitions.h" -#include "fsfw_tests/unit/mocks/PeriodicTaskIFMock.h" +#include "CatchDefinitions.h" +#include "mocks/PeriodicTaskIFMock.h" TEST_CASE("Internal Error Reporter", "[TestInternalError]") { PeriodicTaskMock task(10, nullptr); @@ -21,7 +21,7 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") { if (manager == nullptr) { FAIL(); } - InternalErrorReporter* internalErrorReporter = dynamic_cast( + auto* internalErrorReporter = dynamic_cast( ObjectManager::instance()->get(objects::INTERNAL_ERROR_REPORTER)); if (internalErrorReporter == nullptr) { FAIL(); diff --git a/tests/src/fsfw_tests/unit/mocks/CMakeLists.txt b/unittests/mocks/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/CMakeLists.txt rename to unittests/mocks/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h b/unittests/mocks/HkReceiverMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h rename to unittests/mocks/HkReceiverMock.h diff --git a/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h b/unittests/mocks/MessageQueueMockBase.h similarity index 98% rename from tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h rename to unittests/mocks/MessageQueueMockBase.h index 4236593e..60a942d9 100644 --- a/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h +++ b/unittests/mocks/MessageQueueMockBase.h @@ -8,7 +8,7 @@ #include "fsfw/ipc/MessageQueueBase.h" #include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueMessage.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" class MessageQueueMockBase : public MessageQueueBase { public: diff --git a/tests/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h b/unittests/mocks/PeriodicTaskIFMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h rename to unittests/mocks/PeriodicTaskIFMock.h diff --git a/tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp b/unittests/mocks/PowerSwitcherMock.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp rename to unittests/mocks/PowerSwitcherMock.cpp diff --git a/tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h b/unittests/mocks/PowerSwitcherMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h rename to unittests/mocks/PowerSwitcherMock.h diff --git a/tests/src/fsfw_tests/unit/osal/CMakeLists.txt b/unittests/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/osal/CMakeLists.txt rename to unittests/osal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/osal/TestClock.cpp b/unittests/osal/TestClock.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/osal/TestClock.cpp rename to unittests/osal/TestClock.cpp index 38ec3915..9979b28c 100644 --- a/tests/src/fsfw_tests/unit/osal/TestClock.cpp +++ b/unittests/osal/TestClock.cpp @@ -5,7 +5,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("OSAL::Clock Test", "[OSAL::Clock Test]") { SECTION("Test getClock") { diff --git a/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp b/unittests/osal/TestMessageQueue.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp rename to unittests/osal/TestMessageQueue.cpp index 11c0739b..df15b33d 100644 --- a/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp +++ b/unittests/osal/TestMessageQueue.cpp @@ -4,7 +4,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("MessageQueue Basic Test", "[TestMq]") { MessageQueueIF* testSenderMq = QueueFactory::instance()->createMessageQueue(1); diff --git a/tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp b/unittests/osal/TestSemaphore.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp rename to unittests/osal/TestSemaphore.cpp diff --git a/tests/src/fsfw_tests/unit/power/CMakeLists.txt b/unittests/power/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/power/CMakeLists.txt rename to unittests/power/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/power/testPowerSwitcher.cpp b/unittests/power/testPowerSwitcher.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/power/testPowerSwitcher.cpp rename to unittests/power/testPowerSwitcher.cpp index 941055ac..cf2f2148 100644 --- a/tests/src/fsfw_tests/unit/power/testPowerSwitcher.cpp +++ b/unittests/power/testPowerSwitcher.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include "mocks/PowerSwitcherMock.h" #include diff --git a/tests/src/fsfw_tests/unit/printChar.cpp b/unittests/printChar.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/printChar.cpp rename to unittests/printChar.cpp diff --git a/tests/src/fsfw_tests/unit/printChar.h b/unittests/printChar.h similarity index 100% rename from tests/src/fsfw_tests/unit/printChar.h rename to unittests/printChar.h diff --git a/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt b/unittests/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/CMakeLists.txt rename to unittests/serialize/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp b/unittests/serialize/TestSerialBufferAdapter.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp rename to unittests/serialize/TestSerialBufferAdapter.cpp index 9b30427f..2aa76ec8 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp +++ b/unittests/serialize/TestSerialBufferAdapter.cpp @@ -3,7 +3,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" static bool test_value_bool = true; static uint16_t tv_uint16{283}; diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp b/unittests/serialize/TestSerialLinkedPacket.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp rename to unittests/serialize/TestSerialLinkedPacket.cpp index e3bdf882..2d6e476f 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp +++ b/unittests/serialize/TestSerialLinkedPacket.cpp @@ -5,7 +5,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") { // perform set-up here diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h b/unittests/serialize/TestSerialLinkedPacket.h similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h rename to unittests/serialize/TestSerialLinkedPacket.h diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp b/unittests/serialize/TestSerialization.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp rename to unittests/serialize/TestSerialization.cpp index 52cb70f6..a3340a7d 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp +++ b/unittests/serialize/TestSerialization.cpp @@ -5,7 +5,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" static bool testBool = true; static uint8_t tvUint8{5}; diff --git a/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt b/unittests/storagemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt rename to unittests/storagemanager/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/unittests/storagemanager/TestNewAccessor.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp rename to unittests/storagemanager/TestNewAccessor.cpp index 7b90c86e..2cc2e469 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp +++ b/unittests/storagemanager/TestNewAccessor.cpp @@ -4,7 +4,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("New Accessor", "[NewAccessor]") { LocalPool::LocalPoolConfig poolCfg = {{1, 10}}; diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/unittests/storagemanager/TestPool.cpp similarity index 99% rename from tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp rename to unittests/storagemanager/TestPool.cpp index 51130047..e37c6934 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp +++ b/unittests/storagemanager/TestPool.cpp @@ -5,7 +5,7 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Local Pool Simple Tests [1 Pool]", "[TestPool]") { LocalPool::LocalPoolConfig config = {{1, 10}}; diff --git a/tests/src/fsfw_tests/unit/version.cpp b/unittests/testVersion.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/version.cpp rename to unittests/testVersion.cpp index 662b1290..e0b9897b 100644 --- a/tests/src/fsfw_tests/unit/version.cpp +++ b/unittests/testVersion.cpp @@ -4,7 +4,7 @@ #include #include "fsfw/serviceinterface.h" -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Version API Tests", "[TestVersionAPI]") { // Check that major version is non-zero diff --git a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/unittests/testcfg/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt rename to unittests/testcfg/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/unittests/testcfg/FSFWConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in rename to unittests/testcfg/FSFWConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in b/unittests/testcfg/OBSWConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in rename to unittests/testcfg/OBSWConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in b/unittests/testcfg/TestsConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in rename to unittests/testcfg/TestsConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp b/unittests/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp rename to unittests/testcfg/devices/logicalAddresses.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h b/unittests/testcfg/devices/logicalAddresses.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h rename to unittests/testcfg/devices/logicalAddresses.h diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp b/unittests/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp rename to unittests/testcfg/devices/powerSwitcherList.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h b/unittests/testcfg/devices/powerSwitcherList.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h rename to unittests/testcfg/devices/powerSwitcherList.h diff --git a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h b/unittests/testcfg/events/subsystemIdRanges.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h rename to unittests/testcfg/events/subsystemIdRanges.h diff --git a/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp b/unittests/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp rename to unittests/testcfg/ipc/MissionMessageTypes.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h b/unittests/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h rename to unittests/testcfg/ipc/MissionMessageTypes.h diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/unittests/testcfg/objects/systemObjectList.h similarity index 95% rename from tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h rename to unittests/testcfg/objects/systemObjectList.h index 17b980e9..7d12e5c6 100644 --- a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h +++ b/unittests/testcfg/objects/systemObjectList.h @@ -1,34 +1,34 @@ -#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ -#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ - -#include - -#include "fsfw/objectmanager/frameworkObjects.h" - -// The objects will be instantiated in the ID order -namespace objects { -enum sourceObjects : uint32_t { - /* All addresses between start and end are reserved for the FSFW */ - FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION, - FSFW_CONFIG_RESERVED_END = TM_STORE, - - UDP_BRIDGE = 15, - UDP_POLLING_TASK = 16, - - TEST_ECHO_COM_IF = 20, - TEST_DEVICE = 21, - - HK_RECEIVER_MOCK = 22, - TEST_LOCAL_POOL_OWNER_BASE = 25, - - SHARED_SET_ID = 26, - - DUMMY_POWER_SWITCHER = 28, - - DEVICE_HANDLER_MOCK = 29, - COM_IF_MOCK = 30, - DEVICE_HANDLER_COMMANDER = 40, -}; -} - -#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ +#ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ +#define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ + +#include + +#include "fsfw/objectmanager/frameworkObjects.h" + +// The objects will be instantiated in the ID order +namespace objects { +enum sourceObjects : uint32_t { + /* All addresses between start and end are reserved for the FSFW */ + FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION, + FSFW_CONFIG_RESERVED_END = TM_STORE, + + UDP_BRIDGE = 15, + UDP_POLLING_TASK = 16, + + TEST_ECHO_COM_IF = 20, + TEST_DEVICE = 21, + + HK_RECEIVER_MOCK = 22, + TEST_LOCAL_POOL_OWNER_BASE = 25, + + SHARED_SET_ID = 26, + + DUMMY_POWER_SWITCHER = 28, + + DEVICE_HANDLER_MOCK = 29, + COM_IF_MOCK = 30, + DEVICE_HANDLER_COMMANDER = 40, +}; +} + +#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ diff --git a/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp b/unittests/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to unittests/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h b/unittests/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h rename to unittests/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h b/unittests/testcfg/returnvalues/classIds.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h rename to unittests/testcfg/returnvalues/classIds.h diff --git a/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h b/unittests/testcfg/tmtc/apid.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h rename to unittests/testcfg/tmtc/apid.h diff --git a/tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h b/unittests/testcfg/tmtc/pusIds.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h rename to unittests/testcfg/tmtc/pusIds.h diff --git a/tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp b/unittests/testtemplate/TestTemplate.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp rename to unittests/testtemplate/TestTemplate.cpp diff --git a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/unittests/timemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt rename to unittests/timemanager/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp b/unittests/timemanager/TestCCSDSTime.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp rename to unittests/timemanager/TestCCSDSTime.cpp index e96ddfc9..9c457dda 100644 --- a/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp +++ b/unittests/timemanager/TestCCSDSTime.cpp @@ -5,11 +5,11 @@ #include #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("CCSDSTime Tests", "[TestCCSDSTime]") { INFO("CCSDSTime Tests"); - CCSDSTime::Ccs_mseconds cssMilliSecconds; + CCSDSTime::Ccs_mseconds cssMilliSecconds{}; Clock::TimeOfDay_t time; time.year = 2020; time.month = 2; diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp b/unittests/timemanager/TestCountdown.cpp similarity index 94% rename from tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp rename to unittests/timemanager/TestCountdown.cpp index bc39b02e..d0af659d 100644 --- a/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp +++ b/unittests/timemanager/TestCountdown.cpp @@ -2,7 +2,7 @@ #include -#include "fsfw_tests/unit/CatchDefinitions.h" +#include "CatchDefinitions.h" TEST_CASE("Countdown Tests", "[TestCountdown]") { INFO("Countdown Tests"); diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt b/unittests/tmtcpacket/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt rename to unittests/tmtcpacket/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp b/unittests/tmtcpacket/PusTmTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp rename to unittests/tmtcpacket/PusTmTest.cpp diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp b/unittests/tmtcpacket/testCcsds.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp rename to unittests/tmtcpacket/testCcsds.cpp