Update FSFW #24
@ -10,6 +10,7 @@ endif()
|
||||
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
||||
# Options to exclude parts of the FSFW from compilation.
|
||||
option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON)
|
||||
option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF)
|
||||
option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON)
|
||||
|
||||
# Optional sources
|
||||
|
@ -1,3 +1,16 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
CatchDefinitions.cpp
|
||||
CatchFactory.cpp
|
||||
printChar.cpp
|
||||
)
|
||||
|
||||
if(FSFW_CUSTOM_UNITTEST_RUNNER)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
CatchRunner.cpp
|
||||
CatchSetup.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
add_subdirectory(action)
|
||||
add_subdirectory(container)
|
||||
add_subdirectory(osal)
|
||||
|
@ -1,17 +1,21 @@
|
||||
#include "CatchFactory.h"
|
||||
#include "datapoollocal/LocalPoolOwnerBase.h"
|
||||
#include "mocks/HkReceiverMock.h"
|
||||
|
||||
#include <fsfw/datapoollocal/LocalDataPoolManager.h>
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
|
||||
#include <fsfw/events/EventManager.h>
|
||||
#include <fsfw/health/HealthTable.h>
|
||||
#include <fsfw/internalError/InternalErrorReporter.h>
|
||||
#include <fsfw/internalerror/InternalErrorReporter.h>
|
||||
#include <fsfw/objectmanager/frameworkObjects.h>
|
||||
#include <fsfw/storagemanager/PoolManager.h>
|
||||
#include <fsfw/tmtcpacket/pus/tm/TmPacketStored.h>
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
#include <fsfw/unittest/tests/datapoollocal/LocalPoolOwnerBase.h>
|
||||
#include <fsfw/unittest/tests/mocks/HkReceiverMock.h>
|
||||
|
||||
|
||||
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
|
||||
|
||||
/**
|
||||
* @brief Produces system objects.
|
||||
@ -26,7 +30,7 @@
|
||||
*
|
||||
* @ingroup init
|
||||
*/
|
||||
void Factory::produce(void) {
|
||||
void Factory::produceFrameworkObjects(void* args) {
|
||||
setStaticFrameworkObjectIds();
|
||||
new EventManager(objects::EVENT_MANAGER);
|
||||
new HealthTable(objects::HEALTH_TABLE);
|
||||
@ -55,7 +59,6 @@ void Factory::produce(void) {
|
||||
};
|
||||
new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Factory::setStaticFrameworkObjectIds() {
|
||||
@ -77,5 +80,4 @@ void Factory::setStaticFrameworkObjectIds() {
|
||||
TmPacketBase::timeStamperId = objects::NO_OBJECT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
24
tests/src/fsfw_tests/unit/CatchFactory.h
Normal file
24
tests/src/fsfw_tests/unit/CatchFactory.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef FSFW_CATCHFACTORY_H_
|
||||
#define FSFW_CATCHFACTORY_H_
|
||||
|
||||
#include "TestConfig.h"
|
||||
#include "fsfw/objectmanager/SystemObjectIF.h"
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
|
||||
// TODO: It is possible to solve this more cleanly using a special class which
|
||||
// is allowed to set the object IDs and has virtual functions.
|
||||
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
|
||||
|
||||
namespace Factory {
|
||||
/**
|
||||
* @brief Creates all SystemObject elements which are persistent
|
||||
* during execution.
|
||||
*/
|
||||
void produceFrameworkObjects(void* args);
|
||||
void setStaticFrameworkObjectIds();
|
||||
|
||||
}
|
||||
|
||||
#endif /* FSFW_ADD_DEFAULT_FSFW_FACTORY == 1 */
|
||||
|
||||
#endif /* FSFW_CATCHFACTORY_H_ */
|
@ -6,7 +6,7 @@
|
||||
* from the eclipse market place to get colored characters.
|
||||
*/
|
||||
|
||||
#include <TestsConfig.h>
|
||||
#include "CatchRunner.h"
|
||||
|
||||
#define CATCH_CONFIG_COLOUR_WINDOWS
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
extern int customSetup();
|
||||
|
||||
int main( int argc, char* argv[] ) {
|
||||
int fsfwtest::customMain(int argc, char* argv[]) {
|
||||
customSetup();
|
||||
|
||||
// Catch internal function call
|
14
tests/src/fsfw_tests/unit/CatchRunner.h
Normal file
14
tests/src/fsfw_tests/unit/CatchRunner.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_
|
||||
#define FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_
|
||||
|
||||
namespace fsfwtest {
|
||||
|
||||
/**
|
||||
* Can be called by upper level main() if default Catch2 main is overriden
|
||||
* @return
|
||||
*/
|
||||
int customMain(int argc, char* argv[]);
|
||||
|
||||
}
|
||||
|
||||
#endif /* FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_ */
|
@ -5,10 +5,9 @@
|
||||
#include <gcov.h>
|
||||
#endif
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/objectmanager/ObjectManagerIF.h>
|
||||
#include <fsfw/storagemanager/StorageManagerIF.h>
|
||||
#include <fsfw/serviceinterface/ServiceInterfaceStream.h>
|
||||
#include "fsfw/objectmanager/ObjectManager.h"
|
||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
|
||||
/* Global instantiations normally done in main.cpp */
|
||||
@ -24,13 +23,11 @@ ServiceInterfaceStream warning("WARNING");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Global object manager */
|
||||
ObjectManagerIF *objectManager;
|
||||
|
||||
int customSetup() {
|
||||
// global setup
|
||||
objectManager = new ObjectManager(Factory::produce);
|
||||
objectManager -> initialize();
|
||||
ObjectManager* objMan = ObjectManager::instance();
|
||||
objMan->setObjectFactoryFunction(Factory::produceFrameworkObjects, nullptr);
|
||||
objMan->initialize();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,13 +1,10 @@
|
||||
#include "TestActionHelper.h"
|
||||
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include "fsfw_tests/unit/mocks/MessageQueueMockBase.h"
|
||||
|
||||
#include <fsfw/action/ActionHelper.h>
|
||||
#include <fsfw/ipc/CommandMessage.h>
|
||||
#include <fsfw/tests/unit/mocks/MessageQueueMockBase.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
||||
|
@ -1,12 +1,11 @@
|
||||
#ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_
|
||||
#define UNITTEST_HOSTED_TESTACTIONHELPER_H_
|
||||
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
#include <fsfw/action/HasActionsIF.h>
|
||||
#include <fsfw/ipc/MessageQueueIF.h>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
class ActionHelperOwnerMockBase: public HasActionsIF {
|
||||
public:
|
||||
bool getCommandQueueCalled = false;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
#include <fsfw/container/SimpleRingBuffer.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/ArrayList.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
/**
|
||||
* @brief Array List test
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/DynamicFIFO.h>
|
||||
#include <fsfw/container/FIFO.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
TEST_CASE( "Dynamic Fifo Tests", "[TestDynamicFifo]") {
|
||||
INFO("Dynamic Fifo Tests");
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/DynamicFIFO.h>
|
||||
#include <fsfw/container/FIFO.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
TEST_CASE( "Static Fifo Tests", "[TestFifo]") {
|
||||
INFO("Fifo Tests");
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/FixedArrayList.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
|
||||
TEST_CASE( "FixedArrayList Tests", "[TestFixedArrayList]") {
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/FixedMap.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
template class FixedMap<unsigned int, unsigned short>;
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/FixedOrderedMultimap.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
TEST_CASE( "FixedOrderedMultimap Tests", "[TestFixedOrderedMultimap]") {
|
||||
INFO("FixedOrderedMultimap Tests");
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/container/PlacementFactory.h>
|
||||
#include <fsfw/storagemanager/LocalPool.h>
|
||||
#include <fsfw/returnvalues/HasReturnvaluesIF.h>
|
||||
#include <fsfw/container/ArrayList.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
TEST_CASE( "PlacementFactory Tests", "[TestPlacementFactory]") {
|
||||
INFO("PlacementFactory Tests");
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
||||
@ -10,7 +8,8 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/globalfunctions/bitutility.h>
|
||||
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
|
||||
TEST_CASE("DataSetTest" , "[DataSetTest]") {
|
||||
LocalPoolOwnerBase* poolOwner = ObjectManager::instance()->
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
@ -10,7 +8,10 @@
|
||||
#include <fsfw/housekeeping/HousekeepingSnapshot.h>
|
||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||
#include <fsfw/timemanager/CCSDSTime.h>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
#include "../mocks/MessageQueueMockBase.h"
|
||||
|
||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
||||
#include <fsfw/datapoollocal/LocalDataSet.h>
|
||||
@ -10,7 +11,6 @@
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
|
||||
#include <fsfw/tests/unit/mocks/MessageQueueMockBase.h>
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
namespace lpool {
|
||||
|
@ -1,10 +1,10 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
|
||||
LocalPoolOwnerBase* poolOwner = ObjectManager::instance()->
|
||||
|
@ -1,9 +1,10 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/datapoollocal/HasLocalDataPoolIF.h>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
|
||||
TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") {
|
||||
LocalPoolOwnerBase* poolOwner = ObjectManager::instance()->
|
||||
|
@ -1,9 +1,12 @@
|
||||
#ifndef FSFW_UNITTEST_TESTS_MOCKS_MESSAGEQUEUEMOCKBASE_H_
|
||||
#define FSFW_UNITTEST_TESTS_MOCKS_MESSAGEQUEUEMOCKBASE_H_
|
||||
|
||||
#include <fsfw/ipc/MessageQueueIF.h>
|
||||
#include <fsfw/ipc/MessageQueueMessage.h>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include "fsfw/ipc/CommandMessage.h"
|
||||
#include "fsfw/ipc/MessageQueueIF.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <queue>
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/ipc/MessageQueueIF.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/serialize/SerialBufferAdapter.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
#include "TestSerialLinkedPacket.h"
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/globalfunctions/arrayprinter.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
#include <fsfw/serialize/SerializeAdapter.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/catch_approx.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <array>
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/storagemanager/LocalPool.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
#include <fsfw/storagemanager/LocalPool.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <unittest/core/CatchDefinitions.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
@ -32,7 +32,7 @@ if(NOT FSFW_OSAL)
|
||||
set(FSFW_OSAL host CACHE STRING "OS for the FSFW.")
|
||||
endif()
|
||||
|
||||
option(CUSTOM_UNITTEST_RUNNER
|
||||
option(FSFW_CUSTOM_UNITTEST_RUNNER
|
||||
"Specify whether custom main or Catch2 main is used" TRUE
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Set names and variables
|
||||
set(TARGET_NAME ${CMAKE_PROJECT_NAME})
|
||||
if(CUSTOM_UNITTEST_RUNNER)
|
||||
if(FSFW_CUSTOM_UNITTEST_RUNNER)
|
||||
set(CATCH2_TARGET Catch2)
|
||||
else()
|
||||
set(CATCH2_TARGET Catch2WithMain)
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||
#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_
|
||||
|
||||
#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include "objects/systemObjectList.h"
|
||||
|
@ -1 +0,0 @@
|
||||
add_subdirectory(core)
|
@ -1,13 +0,0 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
CatchDefinitions.cpp
|
||||
CatchFactory.cpp
|
||||
CatchRunner.cpp
|
||||
CatchSetup.cpp
|
||||
printChar.cpp
|
||||
)
|
||||
|
||||
if(CUSTOM_UNITTEST_RUNNER)
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
CatchRunner.cpp
|
||||
)
|
||||
endif()
|
@ -1,16 +0,0 @@
|
||||
#ifndef FSFW_CATCHFACTORY_H_
|
||||
#define FSFW_CATCHFACTORY_H_
|
||||
|
||||
#include <fsfw/objectmanager/SystemObjectIF.h>
|
||||
|
||||
namespace Factory {
|
||||
/**
|
||||
* @brief Creates all SystemObject elements which are persistent
|
||||
* during execution.
|
||||
*/
|
||||
void produce(void* args);
|
||||
void setStaticFrameworkObjectIds();
|
||||
|
||||
}
|
||||
|
||||
#endif /* FSFW_CATCHFACTORY_H_ */
|
@ -1,3 +0,0 @@
|
||||
CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp)
|
||||
|
||||
INCLUDES += $(CURRENTPATH)
|
Loading…
Reference in New Issue
Block a user