From df97c582d7ab9bbb6734a82f5ca123405866c4e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 23 Mar 2022 16:48:17 +0100 Subject: [PATCH 01/74] possibly important fix for ring buffer write --- src/fsfw/container/SimpleRingBuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index bcf3cf20..0c95fe40 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -48,6 +48,9 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { + if(amount > maxSize()) { + return HasReturnvaluesIF::RETURN_FAILED; + } if (availableWriteSpace() >= amount or overwriteOld) { size_t amountTillWrap = writeTillWrap(); if (amountTillWrap >= amount) { From a891769a02949d82a144bc5ea8f0e6522b0ce14e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 24 Mar 2022 11:32:27 +0100 Subject: [PATCH 02/74] ring buffer cfg error warning --- src/fsfw/container/SimpleRingBuffer.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index 0c95fe40..7e9aac1a 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -1,4 +1,7 @@ #include "fsfw/container/SimpleRingBuffer.h" +#include "fsfw/FSFW.h" + +#include "fsfw/serviceinterface.h" #include @@ -48,7 +51,14 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { - if(amount > maxSize()) { + if(amount > getMaxSize()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl; +#else + sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); +#endif +#endif return HasReturnvaluesIF::RETURN_FAILED; } if (availableWriteSpace() >= amount or overwriteOld) { From 8a44c498c5b24aba0da99557c616808f58d1e6a2 Mon Sep 17 00:00:00 2001 From: Cleanroom Laptop L590 Date: Thu, 24 Mar 2022 16:50:59 +0100 Subject: [PATCH 03/74] add two additional tests for ring buffer --- tests/src/fsfw_tests/unit/container/RingBufferTest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp index a83fa2ac..30ffd598 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp @@ -31,6 +31,8 @@ TEST_CASE("Ring Buffer Test", "[RingBufferTest]") { for (uint8_t i = 0; i < 9; i++) { CHECK(readBuffer[i] == i); } + REQUIRE(ringBuffer.writeData(testData, 1024) == retval::CATCH_FAILED); + REQUIRE(ringBuffer.writeData(nullptr, 5) == retval::CATCH_FAILED); } SECTION("Get Free Element Test") { From 879223f38fef0c6cd3705bb10efa674c701bb792 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 24 Mar 2022 20:57:42 +0100 Subject: [PATCH 04/74] added nullptr check --- src/fsfw/container/SimpleRingBuffer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index 7e9aac1a..437e72ea 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -51,6 +51,9 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { + if(data == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } if(amount > getMaxSize()) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 From 23f8e5cb410c193231b7ee96b00c4732817d5296 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 24 Mar 2022 21:01:21 +0100 Subject: [PATCH 05/74] some more tests fail --- tests/src/fsfw_tests/unit/container/RingBufferTest.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp index 30ffd598..b365bed0 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp @@ -236,9 +236,8 @@ TEST_CASE("Ring Buffer Test3", "[RingBufferTest3]") { SECTION("Overflow") { REQUIRE(ringBuffer.availableWriteSpace() == 9); - // Writing more than the buffer is large, technically thats allowed - // But it is senseless and has undesired impact on read call - REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_OK); + // Writing more than the buffer is large. Will be rejected + REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED); REQUIRE(ringBuffer.getAvailableReadData() == 3); ringBuffer.clear(); uint8_t *ptr = nullptr; From ad57e6713e2460a997b8cc1a111da9902f10d9d6 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Fri, 25 Mar 2022 15:20:06 +0100 Subject: [PATCH 06/74] Fixed Unittests --- .../fsfw_tests/unit/container/RingBufferTest.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp index b365bed0..f9e25451 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp @@ -146,12 +146,13 @@ TEST_CASE("Ring Buffer Test2", "[RingBufferTest2]") { SECTION("Overflow") { REQUIRE(ringBuffer.availableWriteSpace() == 9); - // Writing more than the buffer is large, technically thats allowed - // But it is senseless and has undesired impact on read call - REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_OK); - REQUIRE(ringBuffer.getAvailableReadData() == 3); + // We don't allow writing of Data that is larger than the ring buffer in total + REQUIRE(ringBuffer.getMaxSize() == 9); + REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED); + REQUIRE(ringBuffer.getAvailableReadData() == 0); ringBuffer.clear(); uint8_t *ptr = nullptr; + // With excess Bytes 13 Bytes can be written to this Buffer REQUIRE(ringBuffer.getFreeElement(&ptr, 13) == retval::CATCH_OK); REQUIRE(ptr != nullptr); memcpy(ptr, testData, 13); @@ -236,10 +237,13 @@ TEST_CASE("Ring Buffer Test3", "[RingBufferTest3]") { SECTION("Overflow") { REQUIRE(ringBuffer.availableWriteSpace() == 9); - // Writing more than the buffer is large. Will be rejected + // Writing more than the buffer is large. + // This write will be rejected and is seen as a configuration mistake REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED); - REQUIRE(ringBuffer.getAvailableReadData() == 3); + REQUIRE(ringBuffer.getAvailableReadData() == 0); ringBuffer.clear(); + // Using FreeElement allows the usage of excessBytes but + // should be used with caution uint8_t *ptr = nullptr; REQUIRE(ringBuffer.getFreeElement(&ptr, 13) == retval::CATCH_OK); REQUIRE(ptr != nullptr); From 70f575396db7beb9bb236e7b5ef007c9347c5bd7 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Fri, 25 Mar 2022 15:27:22 +0100 Subject: [PATCH 07/74] Added changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7d3b90b..a8e13578 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572 - HAL Devicehandlers: Periodic printout is run-time configurable now - `oneShotAction` flag in the `TestTask` class is not static anymore +- `SimpleRingBuffer::writeData` now checks if the amount is larger than the total size of the + Buffer and rejects such writeData calls with `HasReturnvaluesIF::RETURN_FAILED` + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/586 ## Removed From b7a316008a1642188a0e3e8e6b1789ae490d19e1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 28 Mar 2022 15:07:46 +0200 Subject: [PATCH 08/74] increase allowed read bytes --- tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp index 3ad26876..20677298 100644 --- a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp +++ b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp @@ -82,7 +82,7 @@ TEST_CASE("Command Executor", "[cmd-exec]") { readBytes = 0; sizesFifo.retrieve(&readBytes); // That's about the size of the reply - bool beTrue = (readBytes > 200) and (readBytes < 300); + bool beTrue = (readBytes > 200) and (readBytes < 400); REQUIRE(beTrue); uint8_t largerReadBuffer[1024] = {}; outputBuffer.readData(largerReadBuffer, readBytes); From adfefdd93f4ecadae162f2f56ce65df731cb5e94 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Apr 2022 14:19:01 +0200 Subject: [PATCH 09/74] printout tweak --- src/fsfw/osal/linux/MessageQueue.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fsfw/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp index f876ec6e..3a9b7e1e 100644 --- a/src/fsfw/osal/linux/MessageQueue.cpp +++ b/src/fsfw/osal/linux/MessageQueue.cpp @@ -334,10 +334,9 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag */ #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg - << " is too small for requested size " << messageDepth << std::endl; + << " is too small for requested message depth " << messageDepth << std::endl; sif::error << "This error can be fixed by setting the maximum " - "allowed message size higher!" - << std::endl; + "allowed message depth higher" << std::endl; #else sif::printError( "MessageQueue::MessageQueue: Default MQ size %d is too small for" From 951c077abce4e88d4c2bf48502de341d751148e1 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 26 Apr 2022 10:03:04 +0200 Subject: [PATCH 10/74] option to use Countdown object to time out replies --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 85 ++++++++++++++----- src/fsfw/devicehandlers/DeviceHandlerBase.h | 27 +++++- 2 files changed, 89 insertions(+), 23 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 0e2802ac..fb9a597c 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -233,17 +233,28 @@ ReturnValue_t DeviceHandlerBase::initialize() { } void DeviceHandlerBase::decrementDeviceReplyMap() { + bool timedOut = false; for (std::pair& replyPair : deviceReplyMap) { - if (replyPair.second.delayCycles != 0) { + if (replyPair.second.countdown != nullptr && replyPair.second.active) { + if (replyPair.second.countdown->hasTimedOut()) { + timedOut = true; + } + } + if (replyPair.second.delayCycles != 0 && replyPair.second.countdown == nullptr) { replyPair.second.delayCycles--; if (replyPair.second.delayCycles == 0) { if (replyPair.second.periodic) { replyPair.second.delayCycles = replyPair.second.maxDelayCycles; } - replyToReply(replyPair.first, replyPair.second, TIMEOUT); - missedReply(replyPair.first); + timedOut = true; } } + if (timedOut) { + replyToReply(replyPair.first, replyPair.second, TIMEOUT); + missedReply(replyPair.first); + timedOut = false; + replyPair.second.active = false; + } } } @@ -359,7 +370,6 @@ void DeviceHandlerBase::doStateMachine() { setMode(MODE_OFF); break; } - if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) { triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0); setMode(MODE_ERROR_ON); @@ -408,20 +418,22 @@ ReturnValue_t DeviceHandlerBase::isModeCombinationValid(Mode_t mode, Submode_t s ReturnValue_t DeviceHandlerBase::insertInCommandAndReplyMap( DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, LocalPoolDataSetBase* replyDataSet, - size_t replyLen, bool periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId) { + size_t replyLen, bool periodic, bool hasDifferentReplyId, DeviceCommandId_t replyId, + Countdown* countdown) { // No need to check, as we may try to insert multiple times. insertInCommandMap(deviceCommand, hasDifferentReplyId, replyId); if (hasDifferentReplyId) { - return insertInReplyMap(replyId, maxDelayCycles, replyDataSet, replyLen, periodic); + return insertInReplyMap(replyId, maxDelayCycles, replyDataSet, replyLen, periodic, countdown); } else { - return insertInReplyMap(deviceCommand, maxDelayCycles, replyDataSet, replyLen, periodic); + return insertInReplyMap(deviceCommand, maxDelayCycles, replyDataSet, replyLen, periodic, + countdown); } } ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId, uint16_t maxDelayCycles, LocalPoolDataSetBase* dataSet, size_t replyLen, - bool periodic) { + bool periodic, Countdown* countdown) { DeviceReplyInfo info; info.maxDelayCycles = maxDelayCycles; info.periodic = periodic; @@ -429,6 +441,10 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId, info.replyLen = replyLen; info.dataSet = dataSet; info.command = deviceCommandMap.end(); + info.countdown = countdown; + if (info.periodic) { + info.active = true; + } auto resultPair = deviceReplyMap.emplace(replyId, info); if (resultPair.second) { return RETURN_OK; @@ -458,16 +474,16 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId) { DeviceCommandId_t replyId = NO_COMMAND_ID; DeviceCommandMap::iterator command = cookieInfo.pendingCommand; if (command->second.useAlternativeReplyId) { - replyId = command->second.alternativeReplyId; - } - else { - replyId = commandId; + replyId = command->second.alternativeReplyId; + } else { + replyId = commandId; } DeviceReplyIter iter = deviceReplyMap.find(replyId); if (iter != deviceReplyMap.end()) { - if (iter->second.delayCycles != 0) { - return iter->second.replyLen; - } + if ((iter->second.delayCycles != 0 && iter->second.countdown == nullptr) || + (iter->second.active && iter->second.countdown != nullptr)) { + return iter->second.replyLen; + } } return 0; } @@ -809,17 +825,18 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId DeviceReplyInfo* info = &(iter->second); - if (info->delayCycles != 0) { + if ((info->delayCycles != 0 && info->countdown == nullptr) || + (info->active && info->countdown != nullptr)) { result = interpretDeviceReply(foundId, receivedData); if (result == IGNORE_REPLY_DATA) { return; } - if (info->periodic) { - info->delayCycles = info->maxDelayCycles; - } else { - info->delayCycles = 0; + if (info->active && info->countdown != nullptr) { + disableTimeoutControlledReply(info); + } else if (info->delayCycles != 0) { + disableDelayCyclesControlledReply(info); } if (result != RETURN_OK) { @@ -838,6 +855,24 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId } } +void DeviceHandlerBase::disableTimeoutControlledReply(DeviceReplyInfo* info) { + if (info->periodic) { + info->countdown->resetTimer(); + } else { + info->active = false; + info->countdown->timeOut(); + } +} + +void DeviceHandlerBase::disableDelayCyclesControlledReply(DeviceReplyInfo* info) { + if (info->periodic) { + info->delayCycles = info->maxDelayCycles; + } else { + info->delayCycles = 0; + info->active = false; + } +} + ReturnValue_t DeviceHandlerBase::getStorageData(store_address_t storageAddress, uint8_t** data, size_t* len) { size_t lenTmp; @@ -963,6 +998,10 @@ ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(DeviceCommandMap::iterato info->delayCycles = info->maxDelayCycles; info->command = command; command->second.expectedReplies = expectedReplies; + if (info->countdown != nullptr) { + info->countdown->resetTimer(); + } + info->active = true; return RETURN_OK; } else { return NO_REPLY_EXPECTED; @@ -1197,7 +1236,8 @@ void DeviceHandlerBase::setParentQueue(MessageQueueId_t parentQueueId) { bool DeviceHandlerBase::isAwaitingReply() { std::map::iterator iter; for (iter = deviceReplyMap.begin(); iter != deviceReplyMap.end(); ++iter) { - if (iter->second.delayCycles != 0) { + if ((iter->second.delayCycles != 0 && iter->second.countdown == nullptr) || + (iter->second.active && iter->second.countdown != nullptr)) { return true; } } @@ -1353,6 +1393,9 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand) if (iter == deviceReplyMap.end()) { return 0; } + else if (iter->second.countdown != nullptr) { + return 0; + } return iter->second.delayCycles; } diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 5e974831..4a9a8aa2 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -448,6 +448,9 @@ class DeviceHandlerBase : public DeviceHandlerIF, * by the device repeatedly without request) or not. Default is aperiodic (0). * Please note that periodic replies are disabled by default. You can enable them with * #updatePeriodicReply + * @param countdown Instead of using maxDelayCycles to timeout a device reply it is also possible + * to provide a pointer to a Countdown object which will signal the timeout + * when expired * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ @@ -455,7 +458,8 @@ class DeviceHandlerBase : public DeviceHandlerIF, LocalPoolDataSetBase *replyDataSet = nullptr, size_t replyLen = 0, bool periodic = false, bool hasDifferentReplyId = false, - DeviceCommandId_t replyId = 0); + DeviceCommandId_t replyId = 0, + Countdown *countdown = nullptr); /** * @brief This is a helper method to insert replies in the reply map. * @param deviceCommand Identifier of the reply to add. @@ -465,12 +469,15 @@ class DeviceHandlerBase : public DeviceHandlerIF, * by the device repeatedly without request) or not. Default is aperiodic (0). * Please note that periodic replies are disabled by default. You can enable them with * #updatePeriodicReply + * @param countdown Instead of using maxDelayCycles to timeout a device reply it is also possible + * to provide a pointer to a Countdown object which will signal the timeout + * when expired * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, LocalPoolDataSetBase *dataSet = nullptr, size_t replyLen = 0, - bool periodic = false); + bool periodic = false, Countdown *countdown = nullptr); /** * @brief A simple command to add a command to the commandList. @@ -783,6 +790,11 @@ class DeviceHandlerBase : public DeviceHandlerIF, LocalPoolDataSetBase *dataSet = nullptr; //! The command that expects this reply. DeviceCommandMap::iterator command; + //! Instead of using delayCycles to specify the maximum time to wait for the device reply, it + //! is also possible specify a countdown + Countdown* countdown = nullptr; + //! will be set to true when reply is enabled + bool active = false; }; using DeviceReplyMap = std::map; @@ -1243,6 +1255,17 @@ class DeviceHandlerBase : public DeviceHandlerIF, */ void doGetRead(void); + /** + * @brief Handles disabling of replies which use a timeout to detect missed replies. + */ + void disableTimeoutControlledReply(DeviceReplyInfo* info); + + /** + * @brief Handles disabling of replies which use a number of maximum delay cycles to detect + * missed replies. + */ + void disableDelayCyclesControlledReply(DeviceReplyInfo* info); + /** * Retrive data from the #IPCStore. * From 0aee86442eafa6d8827435e2c2e22074ba733e34 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 26 Apr 2022 11:48:18 +0200 Subject: [PATCH 11/74] typo in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99c842af..5112230a 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,7 @@ You can also use `-DFSFW_OSAL=linux` on Linux systems. Coverage data in HTML format can be generated using the `CodeCoverage` [CMake module](https://github.com/bilke/cmake-modules/tree/master). -To build the unittests, run them and then generare the coverage data in this format, +To build the unittests, run them and then generate the coverage data in this format, the following command can be used inside the build directory after the build system was set up ```sh From 1611a4e1f0c013d9fa632edc858a14cb7509c32f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 16 May 2022 11:10:35 +0200 Subject: [PATCH 12/74] device handler unittest wip --- scripts/helper.py | 27 +++++-- .../unit/devicehandler/ComIFMock.cpp | 24 +++++++ .../fsfw_tests/unit/devicehandler/ComIFMock.h | 27 +++++++ .../unit/devicehandler/CookieIFMock.cpp | 7 ++ .../unit/devicehandler/CookieIFMock.h | 12 ++++ .../devicehandler/DeviceHandlerCommander.cpp | 70 +++++++++++++++++++ .../devicehandler/DeviceHandlerCommander.h | 49 +++++++++++++ .../unit/devicehandler/DeviceHandlerMock.cpp | 70 +++++++++++++++++++ .../unit/devicehandler/DeviceHandlerMock.h | 36 ++++++++++ .../devicehandler/TestDeviceHandlerBase.cpp | 36 ++++++++++ .../devicehandler/TestDeviceHandlerBase.h | 49 +++++++++++++ .../unit/testcfg/objects/systemObjectList.h | 61 ++++++++-------- 12 files changed, 435 insertions(+), 33 deletions(-) create mode 100644 tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h create mode 100644 tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h create mode 100644 tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h diff --git a/scripts/helper.py b/scripts/helper.py index 4dff908d..56cf352b 100755 --- a/scripts/helper.py +++ b/scripts/helper.py @@ -48,6 +48,20 @@ def main(): action="store_true", help="Run valgrind on generated test binary", ) + parser.add_argument( + "-g", + "--generators", + default = "Ninja", + action="store", + help="CMake generators", + ) + parser.add_argument( + "-w", + "--windows", + default=False, + action="store_true", + help="Run on windows", + ) args = parser.parse_args() if args.all: @@ -115,14 +129,14 @@ def handle_tests_type(args, build_dir_list: list): if args.create: if os.path.exists(UNITTEST_FOLDER_NAME): shutil.rmtree(UNITTEST_FOLDER_NAME) - create_tests_build_cfg() + create_tests_build_cfg(args) build_directory = UNITTEST_FOLDER_NAME elif len(build_dir_list) == 0: print( "No valid CMake tests build directory found. " "Trying to set up test build system" ) - create_tests_build_cfg() + create_tests_build_cfg(args) build_directory = UNITTEST_FOLDER_NAME elif len(build_dir_list) == 1: build_directory = build_dir_list[0] @@ -147,10 +161,15 @@ def handle_tests_type(args, build_dir_list: list): os.chdir("..") -def create_tests_build_cfg(): +def create_tests_build_cfg(args): os.mkdir(UNITTEST_FOLDER_NAME) os.chdir(UNITTEST_FOLDER_NAME) - cmd_runner("cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..") + if args.windows: + cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON \ + -DGCOVR_PATH="py -m gcovr" ..' + else: + cmake_cmd = 'cmake -G "' + args.generators + '" -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' + cmd_runner(cmake_cmd) os.chdir("..") diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp new file mode 100644 index 00000000..6bcf5e20 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp @@ -0,0 +1,24 @@ +#include "ComIFMock.h" + +ComIFMock::ComIFMock(obejct_id_t 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) { + rememberSentByte = *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) { + *size = sizeof(rememberSentByte); + *buffer = &rememberSentByte; + return RETURN_OK; +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h new file mode 100644 index 00000000..fde6be45 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h @@ -0,0 +1,27 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ + +#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: + ComIFMock(obejct_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; + + private: + uint8_t rememberSentByte = 0; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp new file mode 100644 index 00000000..f73c1731 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp @@ -0,0 +1,7 @@ +#include "CookieIFMock.h" + +CookieIFMock::CookieIFMock() { +} + +CookieIFMock::~CookieIFMock() { +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h new file mode 100644 index 00000000..ad40f55f --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h @@ -0,0 +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: + CookieIFMock(); + virtual ~CookieIFMock(); +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp new file mode 100644 index 00000000..4da5f36c --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp @@ -0,0 +1,70 @@ +#include "DeviceHandlerCommander.h" + +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(); +} + +ReturnValue_t DeviceHandlerCommander::initialize() { + ReturnValue_t result = commandActionHelper.initialize(); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result = actionHelper.initialize(commandQueue); + 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)) { + if (result != HasReturnvaluesIF::RETURN_OK) { + continue; + } + 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/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h new file mode 100644 index 00000000..587932e0 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h @@ -0,0 +1,49 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ + +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/action/CommandActionHelper.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.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: + + 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/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp new file mode 100644 index 00000000..ccdabc40 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -0,0 +1,70 @@ +#include "DeviceHandlerMock.h" + +DeviceHandlerMock::DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication) + : DeviceHandlerBase(objetcId, deviceCommunication, nullptr) {} + +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 PERIODIC_REPLY_TEST_COMMAND: { + commandBuffer[0] = periodicReplyTestData; + rawPacket = commandBuffer; + rawPacketLen = sizeof(periodicReplyTestData); + } + default: + WARN("DeviceHandlerMock::buildCommandFromCommand: Invalid device command"); + } + return RETURN_OK; +} + +ReturnValue_t DeviceHandlerMock::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + switch(*start) { + case periodicReplyTestData: { + return RETURN_OK; + break; + } + default: + break; + } + return RETURN_FAILED; +} + +ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + switch(id){ + case PERIODIC_REPLY_TEST_COMMAND: + break; + default: + break; + } +} + +void DeviceHandlerMock::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(PERIODIC_REPLY_TEST_COMMAND, 2, nullptr, 0, true, false, 0, + periodicReplyCountdown); +} + +uint32_t DeviceHandlerMock::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { + return 500; +} + diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h new file mode 100644 index 00000000..3e358d65 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -0,0 +1,36 @@ +#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 PERIODIC_REPLY_TEST_COMMAND = 1; + + DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication); + virtual ~DeviceHandlerMock(); + +protected: + void doStartUp() override; + void doStartShutdown() 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: + + uint8_t periodicReplyTestData = 1; + + Countdown periodicReplyCountdown = Countdown(10); + + uint8_t commandBuffer[1]; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp new file mode 100644 index 00000000..b3291782 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -0,0 +1,36 @@ +#include "TestDeviceHandlerBase.h" + +#include +#include "ComIFMock.h" + +#include "fsfw_tests/unit/devicehandler/DeviceHandlerMock.h" +#include "fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h" +#include "fsfw_tests/unit/devicehandler/CookieIFMock.h" +#include "fsfw_tests/unit/testcfg/objects/systemObjectList.h" + +TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { + + SECTION("Periodic reply with countdown based timeout success") { + CookieIFMock cookieIFMock; + ComIFperiodicMock comIFperiodic(objects::COM_IF_MOCK); + DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, + &cookieIFMock); + ReturnValue_t result = deviceHandlerMock.initialize(); + REQUIRE(result == RETURN_OK); + DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER); + result = deviceHandlerCommander.initialize(); + REQUIRE(result == RETURN_OK); + result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, + DeviceHandlerMock::PERIODIC_REPLY_TEST_COMMAND); + 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); + result = deviceHandlerCommander.getReplyReturnCode(); + REQUIRE(result == RETURN_OK); + } +// SECTION("Periodic reply with countdown based timeout failed") { +// +// } +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h new file mode 100644 index 00000000..ed35c34a --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h @@ -0,0 +1,49 @@ +#ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_ +#define UNITTEST_HOSTED_TESTACTIONHELPER_H_ + +#include +#include + +#include + +#include "fsfw_tests/unit/CatchDefinitions.h" + +class ActionHelperOwnerMockBase : public HasActionsIF { + public: + bool getCommandQueueCalled = false; + bool executeActionCalled = false; + static const size_t MAX_SIZE = 3; + uint8_t buffer[MAX_SIZE] = {0, 0, 0}; + size_t size = 0; + + MessageQueueId_t getCommandQueue() const override { return tconst::testQueueId; } + + ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size) override { + executeActionCalled = true; + if (size > MAX_SIZE) { + return 0xAFFE; + } + this->size = size; + memcpy(buffer, data, size); + return HasReturnvaluesIF::RETURN_OK; + } + + void clearBuffer() { + this->size = 0; + for (size_t i = 0; i < MAX_SIZE; i++) { + buffer[i] = 0; + } + } + + void getBuffer(const uint8_t** ptr, size_t* size) { + if (size != nullptr) { + *size = this->size; + } + if (ptr != nullptr) { + *ptr = buffer; + } + } +}; + +#endif /* UNITTEST_TESTFW_NEWTESTS_TESTACTIONHELPER_H_ */ diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h index 3eba1484..29450309 100644 --- a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h +++ b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h @@ -1,29 +1,32 @@ -#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 - -}; -} - -#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, + + DEVICE_HANDLER_MOCK = 27, + COM_IF_MOCK = 28, + DEVICE_HANDLER_COMMANDER = 29, +}; +} + +#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ From bf673c56c69b16a8aeae12b30de1dd90c5588dfc Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 5 Jun 2022 12:52:55 +0200 Subject: [PATCH 13/74] unit test for dhb --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 8 ++- src/fsfw/events/EventManager.cpp | 5 ++ src/fsfw/events/EventManager.h | 2 + src/fsfw/events/EventManagerIF.h | 2 + src/fsfw/fdir/FailureIsolationBase.cpp | 12 +++- src/fsfw/fdir/FaultCounter.cpp | 8 +-- src/fsfw/fdir/FaultCounter.h | 14 +++- src/fsfw/health/HealthHelper.cpp | 4 +- src/fsfw/health/HealthTable.cpp | 9 +++ src/fsfw/health/HealthTable.h | 1 + src/fsfw/health/HealthTableIF.h | 2 + tests/src/fsfw_tests/unit/CMakeLists.txt | 1 + tests/src/fsfw_tests/unit/CatchFactory.cpp | 2 +- .../unit/devicehandler/ComIFMock.cpp | 31 ++++++-- .../fsfw_tests/unit/devicehandler/ComIFMock.h | 15 +++- .../unit/devicehandler/CookieIFMock.h | 2 +- .../devicehandler/DeviceHandlerCommander.cpp | 9 +-- .../devicehandler/DeviceHandlerCommander.h | 2 + .../unit/devicehandler/DeviceHandlerMock.cpp | 71 +++++++++++++------ .../unit/devicehandler/DeviceHandlerMock.h | 48 ++++++++----- .../devicehandler/TestDeviceHandlerBase.cpp | 65 +++++++++++------ .../devicehandler/TestDeviceHandlerBase.h | 49 ------------- 22 files changed, 224 insertions(+), 138 deletions(-) delete mode 100644 tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index fb9a597c..a874824d 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -65,7 +65,9 @@ void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId } DeviceHandlerBase::~DeviceHandlerBase() { - delete comCookie; + if (comCookie != nullptr) { + delete comCookie; + } if (defaultFDIRUsed) { delete fdirInstance; } @@ -253,7 +255,9 @@ void DeviceHandlerBase::decrementDeviceReplyMap() { replyToReply(replyPair.first, replyPair.second, TIMEOUT); missedReply(replyPair.first); timedOut = false; - replyPair.second.active = false; + if (not replyPair.second.periodic) { + replyPair.second.active = false; + } } } } diff --git a/src/fsfw/events/EventManager.cpp b/src/fsfw/events/EventManager.cpp index aaa7d6c5..47270d2a 100644 --- a/src/fsfw/events/EventManager.cpp +++ b/src/fsfw/events/EventManager.cpp @@ -88,6 +88,11 @@ ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener, Eve return result; } +ReturnValue_t EventManager::unsubscribeFromAllEvents(MessageQueueId_t listener, + object_id_t object) { + return unsubscribeFromEventRange(listener, 0, 0, true, object); +} + ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom, EventId_t idTo, bool idInverted, object_id_t reporterFrom, diff --git a/src/fsfw/events/EventManager.h b/src/fsfw/events/EventManager.h index f2d642ff..77d657e8 100644 --- a/src/fsfw/events/EventManager.h +++ b/src/fsfw/events/EventManager.h @@ -37,6 +37,8 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, object_id_t reporterTo = 0, bool reporterInverted = false); + ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, + object_id_t object); ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, object_id_t reporterTo = 0, diff --git a/src/fsfw/events/EventManagerIF.h b/src/fsfw/events/EventManagerIF.h index 98051ba0..893f86f1 100644 --- a/src/fsfw/events/EventManagerIF.h +++ b/src/fsfw/events/EventManagerIF.h @@ -20,6 +20,8 @@ class EventManagerIF { bool forwardAllButSelected = false) = 0; virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) = 0; virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) = 0; + virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, + object_id_t object) = 0; virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, diff --git a/src/fsfw/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp index fedef869..da17d783 100644 --- a/src/fsfw/fdir/FailureIsolationBase.cpp +++ b/src/fsfw/fdir/FailureIsolationBase.cpp @@ -14,7 +14,17 @@ FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent } FailureIsolationBase::~FailureIsolationBase() { - QueueFactory::instance()->deleteMessageQueue(eventQueue); + EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); + if (manager == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not" + " been initialized!" + << std::endl; +#endif + return; + } + manager->unsubscribeFromAllEvents(eventQueue->getId(), ownerId); + QueueFactory::instance()->deleteMessageQueue(eventQueue); } ReturnValue_t FailureIsolationBase::initialize() { diff --git a/src/fsfw/fdir/FaultCounter.cpp b/src/fsfw/fdir/FaultCounter.cpp index e87cf613..4515e5b1 100644 --- a/src/fsfw/fdir/FaultCounter.cpp +++ b/src/fsfw/fdir/FaultCounter.cpp @@ -60,14 +60,14 @@ ReturnValue_t FaultCounter::getParameter(uint8_t domainId, uint8_t uniqueId, return INVALID_DOMAIN_ID; } - switch (uniqueId) { - case 0: + switch (static_cast(uniqueId)) { + case ParameterIds::FAILURE_THRESHOLD: parameterWrapper->set(failureThreshold); break; - case 1: + case ParameterIds::FAULT_COUNT: parameterWrapper->set(faultCount); break; - case 2: + case ParameterIds::TIMEOUT: parameterWrapper->set(timer.timeout); break; default: diff --git a/src/fsfw/fdir/FaultCounter.h b/src/fsfw/fdir/FaultCounter.h index 3b59885c..c5630da9 100644 --- a/src/fsfw/fdir/FaultCounter.h +++ b/src/fsfw/fdir/FaultCounter.h @@ -6,6 +6,13 @@ class FaultCounter : public HasParametersIF { public: + + enum class ParameterIds { + FAILURE_THRESHOLD, + FAULT_COUNT, + TIMEOUT + }; + FaultCounter(); FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs, uint8_t setParameterDomain = 0); @@ -23,9 +30,10 @@ class FaultCounter : public HasParametersIF { void setFailureThreshold(uint32_t failureThreshold); void setFaultDecrementTimeMs(uint32_t timeMs); - virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, - ParameterWrapper *parameterWrapper, - const ParameterWrapper *newValues, uint16_t startAtIndex); + virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper *parameterWrapper, + const ParameterWrapper *newValues = nullptr, uint16_t startAtIndex = + 0); void setParameterDomain(uint8_t domain); diff --git a/src/fsfw/health/HealthHelper.cpp b/src/fsfw/health/HealthHelper.cpp index 4bef128c..b9884115 100644 --- a/src/fsfw/health/HealthHelper.cpp +++ b/src/fsfw/health/HealthHelper.cpp @@ -5,7 +5,9 @@ HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) : objectId(objectId), owner(owner) {} -HealthHelper::~HealthHelper() {} +HealthHelper::~HealthHelper() { + healthTable->removeObject(objectId); +} ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) { switch (message->getCommand()) { diff --git a/src/fsfw/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp index ab4881f4..ee8fcd94 100644 --- a/src/fsfw/health/HealthTable.cpp +++ b/src/fsfw/health/HealthTable.cpp @@ -27,6 +27,15 @@ ReturnValue_t HealthTable::registerObject(object_id_t object, return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t HealthTable::removeObject(object_id_t object) { + mapIterator = healthMap.find(object); + if (mapIterator == healthMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + healthMap.erase(mapIterator); + return HasReturnvaluesIF::RETURN_OK; +} + void HealthTable::setHealth(object_id_t object, HasHealthIF::HealthState newState) { MutexGuard(mutex, timeoutType, mutexTimeoutMs); HealthMap::iterator iter = healthMap.find(object); diff --git a/src/fsfw/health/HealthTable.h b/src/fsfw/health/HealthTable.h index 4718abc3..60e00f92 100644 --- a/src/fsfw/health/HealthTable.h +++ b/src/fsfw/health/HealthTable.h @@ -17,6 +17,7 @@ class HealthTable : public HealthTableIF, public SystemObject { /** HealthTableIF overrides */ virtual ReturnValue_t registerObject( object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) override; + ReturnValue_t removeObject(object_id_t object) override; virtual size_t getPrintSize() override; virtual void printAll(uint8_t* pointer, size_t maxSize) override; diff --git a/src/fsfw/health/HealthTableIF.h b/src/fsfw/health/HealthTableIF.h index 50266ac2..aab3f0eb 100644 --- a/src/fsfw/health/HealthTableIF.h +++ b/src/fsfw/health/HealthTableIF.h @@ -14,6 +14,8 @@ class HealthTableIF : public ManagesHealthIF { virtual ReturnValue_t registerObject( object_id_t object, HasHealthIF::HealthState initilialState = HasHealthIF::HEALTHY) = 0; + virtual ReturnValue_t removeObject(object_id_t objectId) = 0; + virtual size_t getPrintSize() = 0; virtual void printAll(uint8_t *pointer, size_t maxSize) = 0; diff --git a/tests/src/fsfw_tests/unit/CMakeLists.txt b/tests/src/fsfw_tests/unit/CMakeLists.txt index a8d31d88..eb57202a 100644 --- a/tests/src/fsfw_tests/unit/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/CMakeLists.txt @@ -23,3 +23,4 @@ add_subdirectory(tmtcpacket) add_subdirectory(cfdp) add_subdirectory(hal) add_subdirectory(internalerror) +add_subdirectory(devicehandler) diff --git a/tests/src/fsfw_tests/unit/CatchFactory.cpp b/tests/src/fsfw_tests/unit/CatchFactory.cpp index 01018dfa..860a9bed 100644 --- a/tests/src/fsfw_tests/unit/CatchFactory.cpp +++ b/tests/src/fsfw_tests/unit/CatchFactory.cpp @@ -65,7 +65,7 @@ void Factory::setStaticFrameworkObjectIds() { VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; - DeviceHandlerBase::rawDataReceiverId = objects::PUS_SERVICE_2_DEVICE_ACCESS; + DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; LocalDataPoolManager::defaultHkDestination = objects::HK_RECEIVER_MOCK; diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp index 6bcf5e20..4dd64c1a 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp @@ -1,13 +1,14 @@ #include "ComIFMock.h" +#include "DeviceHandlerMock.h" -ComIFMock::ComIFMock(obejct_id_t objectId) {} +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) { - rememberSentByte = *sendData; + data = *sendData; return RETURN_OK; } @@ -18,7 +19,29 @@ ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestL } ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { - *size = sizeof(rememberSentByte); - *buffer = &rememberSentByte; + 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/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h index fde6be45..7de4937f 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h @@ -2,14 +2,17 @@ #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. + * like incomplete or wrong replies and can be used to test the DeviceHandlerBase. */ class ComIFMock : public DeviceCommunicationIF, public SystemObject { public: - ComIFMock(obejct_id_t objectId); + 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; @@ -19,9 +22,15 @@ class ComIFMock : public DeviceCommunicationIF, public SystemObject { 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: - uint8_t rememberSentByte = 0; + 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.h b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h index ad40f55f..5c868932 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h @@ -3,7 +3,7 @@ #include "fsfw/devicehandlers/CookieIF.h" -class CookieIFMock { +class CookieIFMock : public CookieIF { public: CookieIFMock(); virtual ~CookieIFMock(); diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp index 4da5f36c..b3889b2c 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp @@ -1,4 +1,5 @@ #include "DeviceHandlerCommander.h" +#include DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId) : SystemObject(objectId), commandActionHelper(this) { @@ -11,6 +12,7 @@ DeviceHandlerCommander::~DeviceHandlerCommander() {} ReturnValue_t DeviceHandlerCommander::performOperation(uint8_t operationCode) { readCommandQueue(); + return RETURN_OK; } ReturnValue_t DeviceHandlerCommander::initialize() { @@ -18,10 +20,6 @@ ReturnValue_t DeviceHandlerCommander::initialize() { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - result = actionHelper.initialize(commandQueue); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } return HasReturnvaluesIF::RETURN_OK; } @@ -49,9 +47,6 @@ void DeviceHandlerCommander::readCommandQueue() { ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; for (result = commandQueue->receiveMessage(&message); result == HasReturnvaluesIF::RETURN_OK; result = commandQueue->receiveMessage(&message)) { - if (result != HasReturnvaluesIF::RETURN_OK) { - continue; - } result = commandActionHelper.handleReply(&message); if (result == HasReturnvaluesIF::RETURN_OK) { continue; diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h index 587932e0..77168043 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h @@ -37,6 +37,8 @@ class DeviceHandlerCommander : public ExecutableObjectIF, private: + static const uint32_t QUEUE_SIZE = 20; + MessageQueueIF* commandQueue = nullptr; CommandActionHelper commandActionHelper; diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index ccdabc40..ca1dff2f 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -1,18 +1,18 @@ #include "DeviceHandlerMock.h" -DeviceHandlerMock::DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication) - : DeviceHandlerBase(objetcId, deviceCommunication, nullptr) {} +#include -DeviceHandlerMock::~DeviceHandlerMock() { +DeviceHandlerMock::DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, + CookieIF *comCookie, FailureIsolationBase *fdirInstance) + : DeviceHandlerBase(objectId, deviceCommunication, comCookie, fdirInstance) { + mode = MODE_ON; } -void DeviceHandlerMock::doStartup() { - setMode(_MODE_TO_ON); -} +DeviceHandlerMock::~DeviceHandlerMock() {} -void DeviceHandlerMock::doShutdown() { - setMode(_MODE_POWER_DOWN); -} +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; @@ -25,22 +25,32 @@ ReturnValue_t DeviceHandlerMock::buildTransitionDeviceCommand(DeviceCommandId_t ReturnValue_t DeviceHandlerMock::buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen) { - switch(deviceCommand) { - case PERIODIC_REPLY_TEST_COMMAND: { - commandBuffer[0] = periodicReplyTestData; + switch (deviceCommand) { + case SIMPLE_COMMAND: { + commandBuffer[0] = SIMPLE_COMMAND_DATA; rawPacket = commandBuffer; - rawPacketLen = sizeof(periodicReplyTestData); + 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 periodicReplyTestData: { +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; } @@ -51,20 +61,35 @@ ReturnValue_t DeviceHandlerMock::scanForReply(const uint8_t *start, size_t len, } ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { - switch(id){ - case PERIODIC_REPLY_TEST_COMMAND: + switch (id) { + case SIMPLE_COMMAND: + case PERIODIC_REPLY: { + periodicReplyReceived = true; break; + } default: break; } + return RETURN_OK; } void DeviceHandlerMock::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(PERIODIC_REPLY_TEST_COMMAND, 2, nullptr, 0, true, false, 0, - periodicReplyCountdown); + 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; +uint32_t DeviceHandlerMock::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } + +void DeviceHandlerMock::changePeriodicReplyCountdown(uint32_t timeout) { + periodicReplyCountdown.setTimeout(0); } +void DeviceHandlerMock::resetPeriodicReplyState() { + periodicReplyReceived = false; +} + +bool DeviceHandlerMock::getPeriodicReplyReceived() { + return periodicReplyReceived; +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index 3e358d65..ac79d926 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -3,34 +3,44 @@ #include -class DeviceHandlerMock : public DeviceHandlerBase { - public: +class DeviceHandlerMock: public DeviceHandlerBase { +public: - static const DeviceCommandId_t PERIODIC_REPLY_TEST_COMMAND = 1; + static const DeviceCommandId_t SIMPLE_COMMAND = 1; + static const DeviceCommandId_t PERIODIC_REPLY = 2; - DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication); - virtual ~DeviceHandlerMock(); + 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 resetPeriodicReplyState(); + bool getPeriodicReplyReceived(); protected: - void doStartUp() override; - void doStartShutdown() 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; + 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: - uint8_t periodicReplyTestData = 1; + Countdown simpleCommandReplyTimeout = Countdown(50); + Countdown periodicReplyCountdown = Countdown(10); - Countdown periodicReplyCountdown = Countdown(10); + uint8_t commandBuffer[1]; - 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/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index b3291782..1271eb49 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -1,36 +1,61 @@ -#include "TestDeviceHandlerBase.h" - #include -#include "ComIFMock.h" -#include "fsfw_tests/unit/devicehandler/DeviceHandlerMock.h" -#include "fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h" +#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]") { - SECTION("Periodic reply with countdown based timeout success") { - CookieIFMock cookieIFMock; - ComIFperiodicMock comIFperiodic(objects::COM_IF_MOCK); - DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, - &cookieIFMock); - ReturnValue_t result = deviceHandlerMock.initialize(); - REQUIRE(result == RETURN_OK); - DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER); - result = deviceHandlerCommander.initialize(); - REQUIRE(result == RETURN_OK); + // 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") { + comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL); result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, - DeviceHandlerMock::PERIODIC_REPLY_TEST_COMMAND); + 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(); - REQUIRE(result == RETURN_OK); + REQUIRE(result == HasReturnvaluesIF::RETURN_OK); + } + + SECTION("Periodic reply") { + comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL); + 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.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); } -// SECTION("Periodic reply with countdown based timeout failed") { -// -// } } diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h deleted file mode 100644 index ed35c34a..00000000 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_ -#define UNITTEST_HOSTED_TESTACTIONHELPER_H_ - -#include -#include - -#include - -#include "fsfw_tests/unit/CatchDefinitions.h" - -class ActionHelperOwnerMockBase : public HasActionsIF { - public: - bool getCommandQueueCalled = false; - bool executeActionCalled = false; - static const size_t MAX_SIZE = 3; - uint8_t buffer[MAX_SIZE] = {0, 0, 0}; - size_t size = 0; - - MessageQueueId_t getCommandQueue() const override { return tconst::testQueueId; } - - ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, - const uint8_t* data, size_t size) override { - executeActionCalled = true; - if (size > MAX_SIZE) { - return 0xAFFE; - } - this->size = size; - memcpy(buffer, data, size); - return HasReturnvaluesIF::RETURN_OK; - } - - void clearBuffer() { - this->size = 0; - for (size_t i = 0; i < MAX_SIZE; i++) { - buffer[i] = 0; - } - } - - void getBuffer(const uint8_t** ptr, size_t* size) { - if (size != nullptr) { - *size = this->size; - } - if (ptr != nullptr) { - *ptr = buffer; - } - } -}; - -#endif /* UNITTEST_TESTFW_NEWTESTS_TESTACTIONHELPER_H_ */ From 2fa4fd61d0ee5fb626e9fb9d70a98a08109d2438 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 5 Jun 2022 12:54:13 +0200 Subject: [PATCH 14/74] device fdir mock --- .../unit/devicehandler/CMakeLists.txt | 8 ++++++++ .../unit/devicehandler/DeviceFdirMock.cpp | 18 ++++++++++++++++++ .../unit/devicehandler/DeviceFdirMock.h | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h diff --git a/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt b/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt new file mode 100644 index 00000000..7ad5d316 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${FSFW_TEST_TGT} PRIVATE + CookieIFMock.cpp + ComIFMock.cpp + DeviceHandlerCommander.cpp + DeviceHandlerMock.cpp + DeviceFdirMock.cpp + TestDeviceHandlerBase.cpp +) diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp new file mode 100644 index 00000000..dfef7cd3 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp @@ -0,0 +1,18 @@ +#include "DeviceFdirMock.h" + +#include + +DeviceFdirMock::DeviceFdirMock(object_id_t owner, object_id_t parent) + : DeviceHandlerFailureIsolation(owner, parent) {} + +DeviceFdirMock::~DeviceFdirMock() {} + +uint32_t DeviceFdirMock::getMissedReplyCount() { + ParameterWrapper parameterWrapper; + this->getParameter(MISSED_REPLY_DOMAIN_ID, + static_cast(FaultCounter::ParameterIds::FAULT_COUNT), + ¶meterWrapper, nullptr, 0); + uint32_t missedReplyCount = 0; + parameterWrapper.getElement(&missedReplyCount); + return missedReplyCount; +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h new file mode 100644 index 00000000..b314fc98 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h @@ -0,0 +1,18 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ + +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" + +class DeviceFdirMock : public DeviceHandlerFailureIsolation { + public: + DeviceFdirMock(object_id_t owner, object_id_t parent); + virtual ~DeviceFdirMock(); + + uint32_t getMissedReplyCount(); + + private: + static const uint8_t STRANGE_REPLY_DOMAIN_ID = 0xF0; + static const uint8_t MISSED_REPLY_DOMAIN_ID = 0xF1; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ */ From 4fba2704aa0d834cf96d2db05eee92ca960fdb9f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 10:53:08 +0200 Subject: [PATCH 15/74] unit test for detection of missed reply when commanded externally --- .../fsfw_tests/unit/devicehandler/ComIFMock.h | 3 ++- .../unit/devicehandler/DeviceHandlerMock.cpp | 6 ++++- .../unit/devicehandler/DeviceHandlerMock.h | 1 + .../devicehandler/TestDeviceHandlerBase.cpp | 25 +++++++++++++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h index 7de4937f..1463deb6 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h @@ -6,7 +6,8 @@ /** * @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. + * like incomplete or wrong replies and can be used to test the + * DeviceHandlerBase. */ class ComIFMock : public DeviceCommunicationIF, public SystemObject { public: diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index ca1dff2f..88f712db 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -83,7 +83,11 @@ void DeviceHandlerMock::fillCommandAndReplyMap() { uint32_t DeviceHandlerMock::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { return 500; } void DeviceHandlerMock::changePeriodicReplyCountdown(uint32_t timeout) { - periodicReplyCountdown.setTimeout(0); + periodicReplyCountdown.setTimeout(timeout); +} + +void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) { + simpleCommandReplyTimeout.setTimeout(timeout); } void DeviceHandlerMock::resetPeriodicReplyState() { diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index ac79d926..4ff0d77d 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -16,6 +16,7 @@ public: CookieIF *comCookie, FailureIsolationBase* fdirInstance); virtual ~DeviceHandlerMock(); void changePeriodicReplyCountdown(uint32_t timeout); + void changeSimpleCommandReplyCountdown(uint32_t timeout); void resetPeriodicReplyState(); bool getPeriodicReplyReceived(); diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 1271eb49..283a8799 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -21,7 +21,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { result = deviceHandlerCommander.initialize(); REQUIRE(result == HasReturnvaluesIF::RETURN_OK); - SECTION("Commanding") { + SECTION("Commanding nominal") { comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL); result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, DeviceHandlerMock::SIMPLE_COMMAND); @@ -36,7 +36,28 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { REQUIRE(result == HasReturnvaluesIF::RETURN_OK); } - SECTION("Periodic reply") { + 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.performOperation(DeviceHandlerIF::PERFORM_OPERATION); deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); From ae2f7219fd9d0f78fb9cb6846cedbbd159db142f Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 11:55:42 +0200 Subject: [PATCH 16/74] run auto-formatter --- README.md | 5 +- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 7 +- src/fsfw/devicehandlers/DeviceHandlerBase.h | 6 +- src/fsfw/events/EventManager.h | 3 +- src/fsfw/events/EventManagerIF.h | 3 +- src/fsfw/fdir/FailureIsolationBase.cpp | 14 ++-- src/fsfw/fdir/FaultCounter.h | 15 ++--- src/fsfw/health/HealthHelper.cpp | 4 +- src/fsfw/health/HealthTable.cpp | 8 +-- .../unit/devicehandler/ComIFMock.cpp | 47 +++++++------ .../unit/devicehandler/CookieIFMock.cpp | 6 +- .../devicehandler/DeviceHandlerCommander.cpp | 5 +- .../devicehandler/DeviceHandlerCommander.h | 7 +- .../unit/devicehandler/DeviceHandlerMock.cpp | 30 ++++----- .../unit/devicehandler/DeviceHandlerMock.h | 63 +++++++++-------- .../devicehandler/TestDeviceHandlerBase.cpp | 67 +++++++++---------- .../unit/testcfg/objects/systemObjectList.h | 2 +- 17 files changed, 136 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index 5112230a..673b66c6 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,10 @@ and open the documentation conveniently. Try `helper.py -h for more information. The formatting is done by the `clang-format` tool. The configuration is contained within the `.clang-format` file in the repository root. As long as `clang-format` is installed, you -can run the `apply-clang-format.sh` helper script to format all source files consistently. +can run the `auto-format.sh` helper script to format all source files consistently. Furthermore cmake-format is required to format CMake files which can be installed with: +````sh +sudo pip install cmakelang +```` ## Index diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index a874824d..5eb45685 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -66,7 +66,7 @@ void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId DeviceHandlerBase::~DeviceHandlerBase() { if (comCookie != nullptr) { - delete comCookie; + delete comCookie; } if (defaultFDIRUsed) { delete fdirInstance; @@ -256,7 +256,7 @@ void DeviceHandlerBase::decrementDeviceReplyMap() { missedReply(replyPair.first); timedOut = false; if (not replyPair.second.periodic) { - replyPair.second.active = false; + replyPair.second.active = false; } } } @@ -1396,8 +1396,7 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand) DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand); if (iter == deviceReplyMap.end()) { return 0; - } - else if (iter->second.countdown != nullptr) { + } else if (iter->second.countdown != nullptr) { return 0; } return iter->second.delayCycles; diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 1e1803e8..1945ac65 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -792,7 +792,7 @@ class DeviceHandlerBase : public DeviceHandlerIF, DeviceCommandMap::iterator command; //! Instead of using delayCycles to specify the maximum time to wait for the device reply, it //! is also possible specify a countdown - Countdown* countdown = nullptr; + Countdown *countdown = nullptr; //! will be set to true when reply is enabled bool active = false; }; @@ -1259,13 +1259,13 @@ class DeviceHandlerBase : public DeviceHandlerIF, /** * @brief Handles disabling of replies which use a timeout to detect missed replies. */ - void disableTimeoutControlledReply(DeviceReplyInfo* info); + void disableTimeoutControlledReply(DeviceReplyInfo *info); /** * @brief Handles disabling of replies which use a number of maximum delay cycles to detect * missed replies. */ - void disableDelayCyclesControlledReply(DeviceReplyInfo* info); + void disableDelayCyclesControlledReply(DeviceReplyInfo *info); /** * Retrive data from the #IPCStore. diff --git a/src/fsfw/events/EventManager.h b/src/fsfw/events/EventManager.h index 77d657e8..70245f5d 100644 --- a/src/fsfw/events/EventManager.h +++ b/src/fsfw/events/EventManager.h @@ -37,8 +37,7 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, object_id_t reporterTo = 0, bool reporterInverted = false); - ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, - object_id_t object); + ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object); ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, object_id_t reporterTo = 0, diff --git a/src/fsfw/events/EventManagerIF.h b/src/fsfw/events/EventManagerIF.h index 893f86f1..adb61f2b 100644 --- a/src/fsfw/events/EventManagerIF.h +++ b/src/fsfw/events/EventManagerIF.h @@ -20,8 +20,7 @@ class EventManagerIF { bool forwardAllButSelected = false) = 0; virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) = 0; virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) = 0; - virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, - object_id_t object) = 0; + virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object) = 0; virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0, EventId_t idTo = 0, bool idInverted = false, object_id_t reporterFrom = 0, diff --git a/src/fsfw/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp index da17d783..3e6d5dcf 100644 --- a/src/fsfw/fdir/FailureIsolationBase.cpp +++ b/src/fsfw/fdir/FailureIsolationBase.cpp @@ -15,16 +15,16 @@ FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent FailureIsolationBase::~FailureIsolationBase() { EventManagerIF* manager = ObjectManager::instance()->get(objects::EVENT_MANAGER); - if (manager == nullptr) { + if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not" - " been initialized!" - << std::endl; + sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not" + " been initialized!" + << std::endl; #endif - return; - } + return; + } manager->unsubscribeFromAllEvents(eventQueue->getId(), ownerId); - QueueFactory::instance()->deleteMessageQueue(eventQueue); + QueueFactory::instance()->deleteMessageQueue(eventQueue); } ReturnValue_t FailureIsolationBase::initialize() { diff --git a/src/fsfw/fdir/FaultCounter.h b/src/fsfw/fdir/FaultCounter.h index c5630da9..cca780d6 100644 --- a/src/fsfw/fdir/FaultCounter.h +++ b/src/fsfw/fdir/FaultCounter.h @@ -6,12 +6,7 @@ class FaultCounter : public HasParametersIF { public: - - enum class ParameterIds { - FAILURE_THRESHOLD, - FAULT_COUNT, - TIMEOUT - }; + enum class ParameterIds { FAILURE_THRESHOLD, FAULT_COUNT, TIMEOUT }; FaultCounter(); FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs, @@ -30,10 +25,10 @@ class FaultCounter : public HasParametersIF { void setFailureThreshold(uint32_t failureThreshold); void setFaultDecrementTimeMs(uint32_t timeMs); - virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, - ParameterWrapper *parameterWrapper, - const ParameterWrapper *newValues = nullptr, uint16_t startAtIndex = - 0); + virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper *parameterWrapper, + const ParameterWrapper *newValues = nullptr, + uint16_t startAtIndex = 0); void setParameterDomain(uint8_t domain); diff --git a/src/fsfw/health/HealthHelper.cpp b/src/fsfw/health/HealthHelper.cpp index b9884115..0f51ddeb 100644 --- a/src/fsfw/health/HealthHelper.cpp +++ b/src/fsfw/health/HealthHelper.cpp @@ -5,9 +5,7 @@ HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) : objectId(objectId), owner(owner) {} -HealthHelper::~HealthHelper() { - healthTable->removeObject(objectId); -} +HealthHelper::~HealthHelper() { healthTable->removeObject(objectId); } ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) { switch (message->getCommand()) { diff --git a/src/fsfw/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp index ee8fcd94..f4bda1c3 100644 --- a/src/fsfw/health/HealthTable.cpp +++ b/src/fsfw/health/HealthTable.cpp @@ -28,10 +28,10 @@ ReturnValue_t HealthTable::registerObject(object_id_t object, } ReturnValue_t HealthTable::removeObject(object_id_t object) { - mapIterator = healthMap.find(object); - if (mapIterator == healthMap.end()) { - return HasReturnvaluesIF::RETURN_FAILED; - } + mapIterator = healthMap.find(object); + if (mapIterator == healthMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } healthMap.erase(mapIterator); return HasReturnvaluesIF::RETURN_OK; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp index 4dd64c1a..4d985f94 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp @@ -1,7 +1,8 @@ #include "ComIFMock.h" + #include "DeviceHandlerMock.h" -ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId){} +ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {} ComIFMock::~ComIFMock() {} @@ -19,29 +20,27 @@ ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestL } 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; - } + 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_; -} +void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp index f73c1731..e9b03a6c 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp @@ -1,7 +1,5 @@ #include "CookieIFMock.h" -CookieIFMock::CookieIFMock() { -} +CookieIFMock::CookieIFMock() {} -CookieIFMock::~CookieIFMock() { -} +CookieIFMock::~CookieIFMock() {} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp index b3889b2c..4540a388 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp @@ -1,4 +1,5 @@ #include "DeviceHandlerCommander.h" + #include DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId) @@ -60,6 +61,4 @@ ReturnValue_t DeviceHandlerCommander::sendCommand(object_id_t target, ActionId_t ReturnValue_t DeviceHandlerCommander::getReplyReturnCode() { return lastReplyReturnCode; } -void DeviceHandlerCommander::resetReplyReturnCode() { - lastReplyReturnCode = RETURN_FAILED; -} +void DeviceHandlerCommander::resetReplyReturnCode() { lastReplyReturnCode = RETURN_FAILED; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h index 77168043..82183baf 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h @@ -1,16 +1,16 @@ #ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ #define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_ -#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/action/CommandActionHelper.h" #include "fsfw/action/CommandsActionsIF.h" -#include "fsfw/tasks/ExecutableObjectIF.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 HasReturnvaluesIF { public: DeviceHandlerCommander(object_id_t objectId); virtual ~DeviceHandlerCommander(); @@ -36,7 +36,6 @@ class DeviceHandlerCommander : public ExecutableObjectIF, void resetReplyReturnCode(); private: - static const uint32_t QUEUE_SIZE = 20; MessageQueueIF* commandQueue = nullptr; diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index 88f712db..7350d579 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -42,13 +42,13 @@ ReturnValue_t DeviceHandlerMock::buildCommandFromCommand(DeviceCommandId_t devic 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: { + 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; @@ -64,7 +64,7 @@ ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, cons switch (id) { case SIMPLE_COMMAND: case PERIODIC_REPLY: { - periodicReplyReceived = true; + periodicReplyReceived = true; break; } default: @@ -74,9 +74,9 @@ ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, cons } void DeviceHandlerMock::fillCommandAndReplyMap() { - insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0, - &simpleCommandReplyTimeout); - insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0, + insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0, + &simpleCommandReplyTimeout); + insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0, &periodicReplyCountdown); } @@ -90,10 +90,6 @@ void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) { simpleCommandReplyTimeout.setTimeout(timeout); } -void DeviceHandlerMock::resetPeriodicReplyState() { - periodicReplyReceived = false; -} +void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = false; } -bool DeviceHandlerMock::getPeriodicReplyReceived() { - return periodicReplyReceived; -} +bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; } diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index 4ff0d77d..95d0fdbb 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -3,45 +3,42 @@ #include -class DeviceHandlerMock: public DeviceHandlerBase { -public: +class DeviceHandlerMock : public DeviceHandlerBase { + public: + static const DeviceCommandId_t SIMPLE_COMMAND = 1; + static const DeviceCommandId_t PERIODIC_REPLY = 2; - 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; - 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(); - 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(); + 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; -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(50); + Countdown periodicReplyCountdown = Countdown(10); -private: + uint8_t commandBuffer[1]; - Countdown simpleCommandReplyTimeout = Countdown(50); - Countdown periodicReplyCountdown = Countdown(10); - - uint8_t commandBuffer[1]; - - bool periodicReplyReceived = false; + bool periodicReplyReceived = false; }; #endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ */ diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 283a8799..9a20f1a8 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -8,21 +8,20 @@ #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); + // 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); + comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL); result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK, DeviceHandlerMock::SIMPLE_COMMAND); REQUIRE(result == HasReturnvaluesIF::RETURN_OK); @@ -37,28 +36,28 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { } 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); - } + 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); + comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL); deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE); deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE); @@ -68,7 +67,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { } SECTION("Missed periodic reply") { - comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); + comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY); // Set the timeout to 0 to immediately timeout the reply deviceHandlerMock.changePeriodicReplyCountdown(0); deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION); diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h index 6f40da3c..17b980e9 100644 --- a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h +++ b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h @@ -31,4 +31,4 @@ enum sourceObjects : uint32_t { }; } -#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ +#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */ From 103661faccd8cd505b2ca179dc1999b05ec2a933 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 12:26:00 +0200 Subject: [PATCH 17/74] deugging --- .../devicehandler/TestDeviceHandlerBase.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 9a20f1a8..5ced746b 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -35,26 +35,26 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { 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("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); From ade36e65c6a1026ad9b2dff838622fc439856a57 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 12:30:27 +0200 Subject: [PATCH 18/74] missed reply check in simple command nominal test case --- .../devicehandler/TestDeviceHandlerBase.cpp | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 5ced746b..dd9e9ca5 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -32,29 +32,31 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { 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("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); From 21eb386f3cae3b0e05a7731382069a3a8d2663fd Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 6 Jun 2022 12:34:57 +0200 Subject: [PATCH 19/74] changed reply timeouts --- tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index 95d0fdbb..1ab1d90b 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -33,8 +33,8 @@ class DeviceHandlerMock : public DeviceHandlerBase { uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override; private: - Countdown simpleCommandReplyTimeout = Countdown(50); - Countdown periodicReplyCountdown = Countdown(10); + Countdown simpleCommandReplyTimeout = Countdown(1000); + Countdown periodicReplyCountdown = Countdown(1000); uint8_t commandBuffer[1]; From 2d2f65bf89d02f8605e3471063bfd4ab5e53c39d Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 23 Jun 2022 11:54:51 +0200 Subject: [PATCH 20/74] moved activation of periodic replies to updatePeriodicReply --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 7 ++++--- .../unit/devicehandler/DeviceHandlerMock.cpp | 8 ++++++++ .../unit/devicehandler/DeviceHandlerMock.h | 2 ++ .../unit/devicehandler/TestDeviceHandlerBase.cpp | 12 ++++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 5eb45685..f3cfcee4 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -446,9 +446,6 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId, info.dataSet = dataSet; info.command = deviceCommandMap.end(); info.countdown = countdown; - if (info.periodic) { - info.active = true; - } auto resultPair = deviceReplyMap.emplace(replyId, info); if (resultPair.second) { return RETURN_OK; @@ -522,8 +519,10 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI } if (enable) { info->delayCycles = info->maxDelayCycles; + info->active = true; } else { info->delayCycles = 0; + info->active = false; } } return HasReturnvaluesIF::RETURN_OK; @@ -999,6 +998,8 @@ ReturnValue_t DeviceHandlerBase::enableReplyInReplyMap(DeviceCommandMap::iterato } if (iter != deviceReplyMap.end()) { DeviceReplyInfo* info = &(iter->second); + // If a countdown has been set, the delay cycles will be ignored and the reply times out + // as soon as the countdown has expired info->delayCycles = info->maxDelayCycles; info->command = command; command->second.expectedReplies = expectedReplies; diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index 7350d579..a17da98b 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -93,3 +93,11 @@ void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t 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/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index 1ab1d90b..f5fcb4aa 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h @@ -18,6 +18,8 @@ class DeviceHandlerMock : public DeviceHandlerBase { 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; diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index dd9e9ca5..99d3816f 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -60,6 +60,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { 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); @@ -72,6 +73,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { 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); @@ -79,5 +81,15 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { 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); } } From df97bbc6913a7501f80fab893586e7564abb3678 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 23 Jun 2022 11:56:46 +0200 Subject: [PATCH 21/74] run auto-formatter --- src/fsfw/datapoollocal/LocalDataPoolManager.cpp | 3 ++- src/fsfw/osal/linux/FixedTimeslotTask.cpp | 2 +- .../unit/devicehandler/DeviceHandlerMock.cpp | 4 ++-- .../unit/devicehandler/TestDeviceHandlerBase.cpp | 16 ++++++++-------- .../fsfw_tests/unit/hal/testCommandExecutor.cpp | 2 +- .../unit/storagemanager/TestNewAccessor.cpp | 10 +++++----- .../fsfw_tests/unit/storagemanager/TestPool.cpp | 2 +- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp index 215d1753..9b7f800f 100644 --- a/src/fsfw/datapoollocal/LocalDataPoolManager.cpp +++ b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp @@ -696,7 +696,8 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) { if (result != HasReturnvaluesIF::RETURN_OK) { /* Configuration error */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." << std::endl; + sif::warning << "LocalDataPoolManager::performPeriodicHkOperation: HK generation failed." + << std::endl; #else sif::printWarning("LocalDataPoolManager::performPeriodicHkOperation: HK generation failed.\n"); #endif diff --git a/src/fsfw/osal/linux/FixedTimeslotTask.cpp b/src/fsfw/osal/linux/FixedTimeslotTask.cpp index 775acea8..156413ea 100644 --- a/src/fsfw/osal/linux/FixedTimeslotTask.cpp +++ b/src/fsfw/osal/linux/FixedTimeslotTask.cpp @@ -54,7 +54,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) { // If the deadline was missed, the deadlineMissedFunc is called. if (!PosixThread::delayUntil(&lastWakeTime, interval)) { // No time left on timer -> we missed the deadline - if(dlmFunc != nullptr){ + if (dlmFunc != nullptr) { dlmFunc(); } } diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index a17da98b..1e05f8f3 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp @@ -95,9 +95,9 @@ void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = fals bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; } ReturnValue_t DeviceHandlerMock::enablePeriodicReply(DeviceCommandId_t replyId) { - return updatePeriodicReply(true, replyId); + return updatePeriodicReply(true, replyId); } ReturnValue_t DeviceHandlerMock::disablePeriodicReply(DeviceCommandId_t replyId) { - return updatePeriodicReply(false, replyId); + return updatePeriodicReply(false, replyId); } diff --git a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 99d3816f..873329c3 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp @@ -33,7 +33,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { deviceHandlerCommander.performOperation(); result = deviceHandlerCommander.getReplyReturnCode(); uint32_t missedReplies = deviceFdirMock.getMissedReplyCount(); - REQUIRE(missedReplies == 0); + REQUIRE(missedReplies == 0); REQUIRE(result == HasReturnvaluesIF::RETURN_OK); } @@ -84,12 +84,12 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { // 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); + 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/hal/testCommandExecutor.cpp b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp index 09d31280..d34f67aa 100644 --- a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp +++ b/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp @@ -4,12 +4,12 @@ #include #include -#include "tests/TestsConfig.h" #include "fsfw/container/DynamicFIFO.h" #include "fsfw/container/SimpleRingBuffer.h" #include "fsfw/platform.h" #include "fsfw/serviceinterface.h" #include "fsfw_hal/linux/CommandExecutor.h" +#include "tests/TestsConfig.h" #ifdef PLATFORM_UNIX diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp index 9631de38..7b90c86e 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp @@ -157,7 +157,7 @@ TEST_CASE("New Accessor", "[NewAccessor]") { } } - SECTION("Operators"){ + SECTION("Operators") { result = SimplePool.addData(&testStoreId, testDataArray.data(), size); REQUIRE(result == retval::CATCH_OK); { @@ -173,13 +173,13 @@ TEST_CASE("New Accessor", "[NewAccessor]") { REQUIRE(result == HasReturnvaluesIF::RETURN_OK); CHECK(accessor2.getId() == testStoreId); CHECK(accessor2.size() == 10); - + std::array newData; // Expect data to be invalid so this must return RETURN_FAILED - result = accessor.getDataCopy(newData.data(),newData.size()); + result = accessor.getDataCopy(newData.data(), newData.size()); REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); - // Expect data to be too small - result = accessor2.getDataCopy(data.data(),data.size()); + // Expect data to be too small + result = accessor2.getDataCopy(data.data(), data.size()); REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); } } diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp index ce1f8518..51130047 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp @@ -1,9 +1,9 @@ #include #include +#include #include #include -#include #include "fsfw_tests/unit/CatchDefinitions.h" From 7de56f189b51830c799b5d92ef87bb1c74aff281 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 10:13:48 +0200 Subject: [PATCH 22/74] install etl library in ci/cd --- automation/Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/automation/Dockerfile b/automation/Dockerfile index 0eb98fbb..2ed2a7d9 100644 --- a/automation/Dockerfile +++ b/automation/Dockerfile @@ -12,3 +12,9 @@ RUN git clone https://github.com/catchorg/Catch2.git && \ git checkout v3.0.0-preview5 && \ cmake -Bbuild -H. -DBUILD_TESTING=OFF && \ cmake --build build/ --target install + +RUN git clone https://github.com/ETLCPP/etl.git && \ + cd etl && \ + git checkout 20.28.0 && \ + cmake -B build . && \ + cmake --install build/ From 5cccd5caba2f1cae3510c350bc9edf8cc021d019 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 10:21:47 +0200 Subject: [PATCH 23/74] bump used container --- automation/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 798b6b1a..7101958e 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { BUILDDIR = 'build-tests' } agent { - docker { image 'fsfw-ci:d2'} + docker { image 'fsfw-ci:d3'} } stages { stage('Clean') { From 5a9db72814c7f085f91e40cec76e0831e1cd3e84 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 10:27:14 +0200 Subject: [PATCH 24/74] test public linkage --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8163f3e..e9e3e471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,7 @@ endif() set(FSFW_SOURCES_DIR "${CMAKE_SOURCE_DIR}/src/fsfw") set(FSFW_ETL_LIB_NAME etl) +set(FSFW_ETL_LINK_TARGET etl::etl) set(FSFW_ETL_LIB_MAJOR_VERSION 20 CACHE STRING "ETL library major version requirement") @@ -447,8 +448,8 @@ target_include_directories( target_compile_options(${LIB_FSFW_NAME} PRIVATE ${FSFW_WARNING_FLAGS} ${COMPILER_FLAGS}) -target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ETL_LINK_TARGET} - ${FSFW_ADDITIONAL_LINK_LIBS}) +target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS}) +target_link_libraries(${LIB_FSFW_NAME} PUBLIC ${FSFW_ETL_LINK_TARGET}) string( CONCAT From fef6ddceff2185cea943e874d11a15e2dfaab6a3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 11:16:13 +0200 Subject: [PATCH 25/74] delete run configs --- .run/fsfw-tests_coverage.run.xml | 7 ------- .run/fsfw.run.xml | 7 ------- 2 files changed, 14 deletions(-) delete mode 100644 .run/fsfw-tests_coverage.run.xml delete mode 100644 .run/fsfw.run.xml diff --git a/.run/fsfw-tests_coverage.run.xml b/.run/fsfw-tests_coverage.run.xml deleted file mode 100644 index 49d9b135..00000000 --- a/.run/fsfw-tests_coverage.run.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.run/fsfw.run.xml b/.run/fsfw.run.xml deleted file mode 100644 index 72f74939..00000000 --- a/.run/fsfw.run.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file From 3bef73708f9bbee845fe439775af9f56e580658d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 11:44:26 +0200 Subject: [PATCH 26/74] clang-tidy changes for actions module --- src/fsfw/action/ActionHelper.cpp | 4 ++-- src/fsfw/action/ActionHelper.h | 4 ++-- src/fsfw/action/ActionMessage.cpp | 9 ++++----- src/fsfw/action/CommandActionHelper.cpp | 21 +++++++++------------ src/fsfw/action/CommandActionHelper.h | 4 ++-- src/fsfw/action/CommandsActionsIF.h | 6 +++--- src/fsfw/action/HasActionsIF.h | 8 ++++---- src/fsfw/action/SimpleActionHelper.cpp | 4 ++-- src/fsfw/action/SimpleActionHelper.h | 8 ++++---- 9 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/fsfw/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp index d41c78b4..bee68b40 100644 --- a/src/fsfw/action/ActionHelper.cpp +++ b/src/fsfw/action/ActionHelper.cpp @@ -6,7 +6,7 @@ ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : owner(setOwner), queueToUse(useThisQueue) {} -ActionHelper::~ActionHelper() {} +ActionHelper::~ActionHelper() = default; ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) { if (command->getCommand() == ActionMessage::EXECUTE_ACTION) { @@ -59,7 +59,7 @@ void ActionHelper::setQueueToUse(MessageQueueIF* queue) { queueToUse = queue; } void ActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, store_address_t dataAddress) { - const uint8_t* dataPtr = NULL; + const uint8_t* dataPtr = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h index d86e87d2..a9910b05 100644 --- a/src/fsfw/action/ActionHelper.h +++ b/src/fsfw/action/ActionHelper.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_ACTIONHELPER_H_ #define FSFW_ACTION_ACTIONHELPER_H_ -#include "../ipc/MessageQueueIF.h" -#include "../serialize/SerializeIF.h" #include "ActionMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/serialize/SerializeIF.h" /** * @brief Action Helper is a helper class which handles action messages * diff --git a/src/fsfw/action/ActionMessage.cpp b/src/fsfw/action/ActionMessage.cpp index 40a516b1..7fc68558 100644 --- a/src/fsfw/action/ActionMessage.cpp +++ b/src/fsfw/action/ActionMessage.cpp @@ -2,9 +2,9 @@ #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/storagemanager/StorageManagerIF.h" -ActionMessage::ActionMessage() {} +ActionMessage::ActionMessage() = default; -ActionMessage::~ActionMessage() {} +ActionMessage::~ActionMessage() = default; void ActionMessage::setCommand(CommandMessage* message, ActionId_t fid, store_address_t parameters) { @@ -64,9 +64,8 @@ void ActionMessage::clear(CommandMessage* message) { switch (message->getCommand()) { case EXECUTE_ACTION: case DATA_REPLY: { - StorageManagerIF* ipcStore = - ObjectManager::instance()->get(objects::IPC_STORE); - if (ipcStore != NULL) { + auto* ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if (ipcStore != nullptr) { ipcStore->deleteData(getStoreId(message)); } break; diff --git a/src/fsfw/action/CommandActionHelper.cpp b/src/fsfw/action/CommandActionHelper.cpp index 19d8e9b8..a06bc44c 100644 --- a/src/fsfw/action/CommandActionHelper.cpp +++ b/src/fsfw/action/CommandActionHelper.cpp @@ -2,14 +2,14 @@ #include "fsfw/objectmanager/ObjectManager.h" CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) - : owner(setOwner), queueToUse(NULL), ipcStore(NULL), commandCount(0), lastTarget(0) {} + : owner(setOwner), queueToUse(nullptr), ipcStore(nullptr), commandCount(0), lastTarget(0) {} -CommandActionHelper::~CommandActionHelper() {} +CommandActionHelper::~CommandActionHelper() = default; ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF *data) { - HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); - if (receiver == NULL) { + auto *receiver = ObjectManager::instance()->get(commandTo); + if (receiver == nullptr) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } store_address_t storeId; @@ -29,11 +29,8 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t *data, uint32_t size) { - // if (commandCount != 0) { - // return CommandsFunctionsIF::ALREADY_COMMANDING; - // } - HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); - if (receiver == NULL) { + auto *receiver = ObjectManager::instance()->get(commandTo); + if (receiver == nullptr) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } store_address_t storeId; @@ -59,12 +56,12 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, ActionI ReturnValue_t CommandActionHelper::initialize() { ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); - if (ipcStore == NULL) { + if (ipcStore == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } queueToUse = owner->getCommandQueuePtr(); - if (queueToUse == NULL) { + if (queueToUse == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; @@ -104,7 +101,7 @@ ReturnValue_t CommandActionHelper::handleReply(CommandMessage *reply) { uint8_t CommandActionHelper::getCommandCount() const { return commandCount; } void CommandActionHelper::extractDataForOwner(ActionId_t actionId, store_address_t storeId) { - const uint8_t *data = NULL; + const uint8_t *data = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(storeId, &data, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h index dd8ad7f1..a6ec0ca7 100644 --- a/src/fsfw/action/CommandActionHelper.h +++ b/src/fsfw/action/CommandActionHelper.h @@ -14,14 +14,14 @@ class CommandActionHelper { friend class CommandsActionsIF; public: - CommandActionHelper(CommandsActionsIF* owner); + explicit CommandActionHelper(CommandsActionsIF* owner); virtual ~CommandActionHelper(); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, const uint8_t* data, uint32_t size); ReturnValue_t commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF* data); ReturnValue_t initialize(); ReturnValue_t handleReply(CommandMessage* reply); - uint8_t getCommandCount() const; + [[nodiscard]] uint8_t getCommandCount() const; private: CommandsActionsIF* owner; diff --git a/src/fsfw/action/CommandsActionsIF.h b/src/fsfw/action/CommandsActionsIF.h index 5870a9f2..94d9a7c4 100644 --- a/src/fsfw/action/CommandsActionsIF.h +++ b/src/fsfw/action/CommandsActionsIF.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_COMMANDSACTIONSIF_H_ #define FSFW_ACTION_COMMANDSACTIONSIF_H_ -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" #include "CommandActionHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * Interface to separate commanding actions of other objects. @@ -21,7 +21,7 @@ class CommandsActionsIF { static const uint8_t INTERFACE_ID = CLASS_ID::COMMANDS_ACTIONS_IF; static const ReturnValue_t OBJECT_HAS_NO_FUNCTIONS = MAKE_RETURN_CODE(1); static const ReturnValue_t ALREADY_COMMANDING = MAKE_RETURN_CODE(2); - virtual ~CommandsActionsIF() {} + virtual ~CommandsActionsIF() = default; virtual MessageQueueIF* getCommandQueuePtr() = 0; protected: diff --git a/src/fsfw/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h index acc502d7..89e58add 100644 --- a/src/fsfw/action/HasActionsIF.h +++ b/src/fsfw/action/HasActionsIF.h @@ -1,11 +1,11 @@ #ifndef FSFW_ACTION_HASACTIONSIF_H_ #define FSFW_ACTION_HASACTIONSIF_H_ -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" #include "ActionHelper.h" #include "ActionMessage.h" #include "SimpleActionHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * @brief @@ -40,12 +40,12 @@ class HasActionsIF { static const ReturnValue_t INVALID_PARAMETERS = MAKE_RETURN_CODE(2); static const ReturnValue_t EXECUTION_FINISHED = MAKE_RETURN_CODE(3); static const ReturnValue_t INVALID_ACTION_ID = MAKE_RETURN_CODE(4); - virtual ~HasActionsIF() {} + virtual ~HasActionsIF() = default; /** * Function to get the MessageQueueId_t of the implementing object * @return MessageQueueId_t of the object */ - virtual MessageQueueId_t getCommandQueue() const = 0; + [[nodiscard]] virtual MessageQueueId_t getCommandQueue() const = 0; /** * Execute or initialize the execution of a certain function. * The ActionHelpers will execute this function and behave differently diff --git a/src/fsfw/action/SimpleActionHelper.cpp b/src/fsfw/action/SimpleActionHelper.cpp index 894f0df6..fc7e064e 100644 --- a/src/fsfw/action/SimpleActionHelper.cpp +++ b/src/fsfw/action/SimpleActionHelper.cpp @@ -3,7 +3,7 @@ SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : ActionHelper(setOwner, useThisQueue), isExecuting(false) {} -SimpleActionHelper::~SimpleActionHelper() {} +SimpleActionHelper::~SimpleActionHelper() = default; void SimpleActionHelper::step(ReturnValue_t result) { // STEP_OFFESET is subtracted to compensate for adding offset in base @@ -38,7 +38,7 @@ void SimpleActionHelper::prepareExecution(MessageQueueId_t commandedBy, ActionId ActionMessage::setStepReply(&reply, actionId, 0, HasActionsIF::IS_BUSY); queueToUse->sendMessage(commandedBy, &reply); } - const uint8_t* dataPtr = NULL; + const uint8_t* dataPtr = nullptr; size_t size = 0; ReturnValue_t result = ipcStore->getData(dataAddress, &dataPtr, &size); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/src/fsfw/action/SimpleActionHelper.h b/src/fsfw/action/SimpleActionHelper.h index 5cb85fbd..973c7cf2 100644 --- a/src/fsfw/action/SimpleActionHelper.h +++ b/src/fsfw/action/SimpleActionHelper.h @@ -11,15 +11,15 @@ class SimpleActionHelper : public ActionHelper { public: SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue); - virtual ~SimpleActionHelper(); + ~SimpleActionHelper() override; void step(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); void finish(ReturnValue_t result = HasReturnvaluesIF::RETURN_OK); ReturnValue_t reportData(SerializeIF* data); protected: void prepareExecution(MessageQueueId_t commandedBy, ActionId_t actionId, - store_address_t dataAddress); - virtual void resetHelper(); + store_address_t dataAddress) override; + void resetHelper() override; private: bool isExecuting; @@ -28,4 +28,4 @@ class SimpleActionHelper : public ActionHelper { uint8_t stepCount = 0; }; -#endif /* SIMPLEACTIONHELPER_H_ */ +#endif /* FSFW_ACTION_SIMPLEACTIONHELPER_H_ */ From 14bac9a4187aeeebc40c9c87b7f4a67440052e54 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Jul 2022 11:48:36 +0200 Subject: [PATCH 27/74] clang-tidy changes for controller module --- src/fsfw/controller/ControllerBase.cpp | 20 +++++------ src/fsfw/controller/ControllerBase.h | 28 +++++++-------- .../controller/ExtendedControllerBase.cpp | 4 +-- src/fsfw/controller/ExtendedControllerBase.h | 34 +++++++++---------- 4 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/fsfw/controller/ControllerBase.cpp b/src/fsfw/controller/ControllerBase.cpp index 953dacb4..7a8b6bc4 100644 --- a/src/fsfw/controller/ControllerBase.cpp +++ b/src/fsfw/controller/ControllerBase.cpp @@ -26,7 +26,7 @@ ReturnValue_t ControllerBase::initialize() { MessageQueueId_t parentQueue = 0; if (parentId != objects::NO_OBJECT) { - SubsystemBase* parent = ObjectManager::instance()->get(parentId); + auto* parent = ObjectManager::instance()->get(parentId); if (parent == nullptr) { return RETURN_FAILED; } @@ -52,7 +52,7 @@ MessageQueueId_t ControllerBase::getCommandQueue() const { return commandQueue-> void ControllerBase::handleQueue() { CommandMessage command; - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; result = commandQueue->receiveMessage(&command)) { result = modeHelper.handleModeCommand(&command); @@ -73,20 +73,20 @@ void ControllerBase::handleQueue() { } } -void ControllerBase::startTransition(Mode_t mode, Submode_t submode) { +void ControllerBase::startTransition(Mode_t mode_, Submode_t submode_) { changeHK(this->mode, this->submode, false); triggerEvent(CHANGING_MODE, mode, submode); - this->mode = mode; - this->submode = submode; + mode = mode_; + submode = submode_; modeHelper.modeChanged(mode, submode); modeChanged(mode, submode); announceMode(false); changeHK(this->mode, this->submode, true); } -void ControllerBase::getMode(Mode_t* mode, Submode_t* submode) { - *mode = this->mode; - *submode = this->submode; +void ControllerBase::getMode(Mode_t* mode_, Submode_t* submode_) { + *mode_ = this->mode; + *submode_ = this->submode; } void ControllerBase::setToExternalControl() { healthHelper.setHealth(EXTERNAL_CONTROL); } @@ -99,7 +99,7 @@ ReturnValue_t ControllerBase::performOperation(uint8_t opCode) { return RETURN_OK; } -void ControllerBase::modeChanged(Mode_t mode, Submode_t submode) { return; } +void ControllerBase::modeChanged(Mode_t mode_, Submode_t submode_) {} ReturnValue_t ControllerBase::setHealth(HealthState health) { switch (health) { @@ -115,6 +115,6 @@ ReturnValue_t ControllerBase::setHealth(HealthState health) { HasHealthIF::HealthState ControllerBase::getHealth() { return healthHelper.getHealth(); } void ControllerBase::setTaskIF(PeriodicTaskIF* task_) { executingTask = task_; } -void ControllerBase::changeHK(Mode_t mode, Submode_t submode, bool enable) {} +void ControllerBase::changeHK(Mode_t mode_, Submode_t submode_, bool enable) {} ReturnValue_t ControllerBase::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/controller/ControllerBase.h b/src/fsfw/controller/ControllerBase.h index 227b859b..550659b8 100644 --- a/src/fsfw/controller/ControllerBase.h +++ b/src/fsfw/controller/ControllerBase.h @@ -24,21 +24,21 @@ class ControllerBase : public HasModesIF, static const Mode_t MODE_NORMAL = 2; ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth = 3); - virtual ~ControllerBase(); + ~ControllerBase() override; /** SystemObject override */ - virtual ReturnValue_t initialize() override; + ReturnValue_t initialize() override; - virtual MessageQueueId_t getCommandQueue() const override; + [[nodiscard]] MessageQueueId_t getCommandQueue() const override; /** HasHealthIF overrides */ - virtual ReturnValue_t setHealth(HealthState health) override; - virtual HasHealthIF::HealthState getHealth() override; + ReturnValue_t setHealth(HealthState health) override; + HasHealthIF::HealthState getHealth() override; /** ExecutableObjectIF overrides */ - virtual ReturnValue_t performOperation(uint8_t opCode) override; - virtual void setTaskIF(PeriodicTaskIF *task) override; - virtual ReturnValue_t initializeAfterTaskCreation() override; + ReturnValue_t performOperation(uint8_t opCode) override; + void setTaskIF(PeriodicTaskIF *task) override; + ReturnValue_t initializeAfterTaskCreation() override; protected: /** @@ -54,8 +54,8 @@ class ControllerBase : public HasModesIF, */ virtual void performControlOperation() = 0; - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t *msToReachTheMode) override = 0; + ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t *msToReachTheMode) override = 0; const object_id_t parentId; @@ -80,10 +80,10 @@ class ControllerBase : public HasModesIF, /** Mode helpers */ virtual void modeChanged(Mode_t mode, Submode_t submode); - virtual void startTransition(Mode_t mode, Submode_t submode) override; - virtual void getMode(Mode_t *mode, Submode_t *submode) override; - virtual void setToExternalControl() override; - virtual void announceMode(bool recursive); + void startTransition(Mode_t mode, Submode_t submode) override; + void getMode(Mode_t *mode, Submode_t *submode) override; + void setToExternalControl() override; + void announceMode(bool recursive) override; /** HK helpers */ virtual void changeHK(Mode_t mode, Submode_t submode, bool enable); }; diff --git a/src/fsfw/controller/ExtendedControllerBase.cpp b/src/fsfw/controller/ExtendedControllerBase.cpp index 0dfd9dc7..64b39a31 100644 --- a/src/fsfw/controller/ExtendedControllerBase.cpp +++ b/src/fsfw/controller/ExtendedControllerBase.cpp @@ -6,7 +6,7 @@ ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t poolManager(this, commandQueue), actionHelper(this, commandQueue) {} -ExtendedControllerBase::~ExtendedControllerBase() {} +ExtendedControllerBase::~ExtendedControllerBase() = default; ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, @@ -31,7 +31,7 @@ ReturnValue_t ExtendedControllerBase::handleCommandMessage(CommandMessage *messa void ExtendedControllerBase::handleQueue() { CommandMessage command; - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result; for (result = commandQueue->receiveMessage(&command); result == RETURN_OK; result = commandQueue->receiveMessage(&command)) { result = actionHelper.handleActionMessage(&command); diff --git a/src/fsfw/controller/ExtendedControllerBase.h b/src/fsfw/controller/ExtendedControllerBase.h index 0c64f5b9..b5583a88 100644 --- a/src/fsfw/controller/ExtendedControllerBase.h +++ b/src/fsfw/controller/ExtendedControllerBase.h @@ -18,16 +18,16 @@ class ExtendedControllerBase : public ControllerBase, public HasLocalDataPoolIF { public: ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 3); - virtual ~ExtendedControllerBase(); + ~ExtendedControllerBase() override; /* SystemObjectIF overrides */ - virtual ReturnValue_t initialize() override; + ReturnValue_t initialize() override; - virtual MessageQueueId_t getCommandQueue() const override; + [[nodiscard]] MessageQueueId_t getCommandQueue() const override; /* ExecutableObjectIF overrides */ - virtual ReturnValue_t performOperation(uint8_t opCode) override; - virtual ReturnValue_t initializeAfterTaskCreation() override; + ReturnValue_t performOperation(uint8_t opCode) override; + ReturnValue_t initializeAfterTaskCreation() override; protected: LocalDataPoolManager poolManager; @@ -39,32 +39,32 @@ class ExtendedControllerBase : public ControllerBase, * @param message * @return */ - virtual ReturnValue_t handleCommandMessage(CommandMessage* message) = 0; + ReturnValue_t handleCommandMessage(CommandMessage* message) override = 0; /** * Periodic helper from ControllerBase, implemented by child class. */ - virtual void performControlOperation() = 0; + void performControlOperation() override = 0; /* Handle the four messages mentioned above */ void handleQueue() override; /* HasActionsIF overrides */ - virtual ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, - const uint8_t* data, size_t size) override; + ReturnValue_t executeAction(ActionId_t actionId, MessageQueueId_t commandedBy, + const uint8_t* data, size_t size) override; /* HasLocalDatapoolIF overrides */ - virtual LocalDataPoolManager* getHkManagerHandle() override; - virtual object_id_t getObjectId() const override; - virtual uint32_t getPeriodicOperationFrequency() const override; + LocalDataPoolManager* getHkManagerHandle() override; + [[nodiscard]] object_id_t getObjectId() const override; + [[nodiscard]] uint32_t getPeriodicOperationFrequency() const override; - virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, - LocalDataPoolManager& poolManager) override = 0; - virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; + ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override = 0; + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; // Mode abstract functions - virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, - uint32_t* msToReachTheMode) override = 0; + ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t* msToReachTheMode) override = 0; }; #endif /* FSFW_CONTROLLER_EXTENDEDCONTROLLERBASE_H_ */ From 0519083894aae3bf39524033d542593df21874b8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 17:48:06 +0200 Subject: [PATCH 28/74] remove duplicate entries --- CHANGELOG.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba6d754..e4e15eaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,12 +19,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Bump C++ required version to C++17. Every project which uses the FSFW and every modern compiler supports it PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/622 -- HAL Linux SPI: Set the Clock Default State when setting new SPI speed - and mode - PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/573 -- GPIO HAL: `Direction`, `GpioOperation` and `Levels` are enum classes now, which prevents - name clashes with Windows defines. - PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572 - New CMake option `FSFW_HAL_LINUX_ADD_LIBGPIOD` to specifically exclude `gpiod` code. PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/572 - HAL Devicehandlers: Periodic printout is run-time configurable now From 32fea9838ed2052195b12493e974663de97f6861 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 17:56:44 +0200 Subject: [PATCH 29/74] add new pool entry constructor - This constructor allows to simply specify the length. This is also the new default constructor for scalar values which are initially invalid --- src/fsfw/datapool/PoolEntry.cpp | 24 +++++++++++++----------- src/fsfw/datapool/PoolEntry.h | 7 +++++-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/fsfw/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp index fd110e6c..9138a705 100644 --- a/src/fsfw/datapool/PoolEntry.cpp +++ b/src/fsfw/datapool/PoolEntry.cpp @@ -7,24 +7,26 @@ #include "fsfw/serviceinterface/ServiceInterface.h" template -PoolEntry::PoolEntry(std::initializer_list initValue, bool setValid) - : length(static_cast(initValue.size())), valid(setValid) { - this->address = new T[this->length]; - if (initValue.size() == 0) { - std::memset(this->address, 0, this->getByteSize()); - } else { - std::copy(initValue.begin(), initValue.end(), this->address); +PoolEntry::PoolEntry(uint8_t len, bool setValid) : length(len), valid(setValid) { + this->address = new T[this->length](); + std::memset(this->address, 0, this->getByteSize()); +} + +template +PoolEntry::PoolEntry(std::initializer_list initValues, bool setValid) + : length(static_cast(initValues.size())), valid(setValid) { + this->address = new T[this->length](); + if (initValues.size() > 0) { + std::copy(initValues.begin(), initValues.end(), this->address); } } template -PoolEntry::PoolEntry(T* initValue, uint8_t setLength, bool setValid) +PoolEntry::PoolEntry(const T* initValue, uint8_t setLength, bool setValid) : length(setLength), valid(setValid) { - this->address = new T[this->length]; + this->address = new T[this->length](); if (initValue != nullptr) { std::memcpy(this->address, initValue, this->getByteSize()); - } else { - std::memset(this->address, 0, this->getByteSize()); } } diff --git a/src/fsfw/datapool/PoolEntry.h b/src/fsfw/datapool/PoolEntry.h index d3d80f09..4010f78d 100644 --- a/src/fsfw/datapool/PoolEntry.h +++ b/src/fsfw/datapool/PoolEntry.h @@ -33,6 +33,9 @@ class PoolEntry : public PoolEntryIF { "instead! The ECSS standard defines a boolean as a one bit " "field. Therefore it is preferred to store a boolean as an " "uint8_t"); + + PoolEntry(uint8_t len = 1, bool setValid = false); + /** * @brief In the classe's constructor, space is allocated on the heap and * potential initialization values are copied to that space. @@ -49,7 +52,7 @@ class PoolEntry : public PoolEntryIF { * @param setValid * Sets the initialization flag. It is invalid by default. */ - PoolEntry(std::initializer_list initValue = {0}, bool setValid = false); + PoolEntry(std::initializer_list initValue, bool setValid = false); /** * @brief In the classe's constructor, space is allocated on the heap and @@ -62,7 +65,7 @@ class PoolEntry : public PoolEntryIF { * @param setValid * Sets the initialization flag. It is invalid by default. */ - PoolEntry(T* initValue, uint8_t setLength = 1, bool setValid = false); + PoolEntry(const T* initValue, uint8_t setLength = 1, bool setValid = false); //! Explicitely deleted copy ctor, copying is not allowed. PoolEntry(const PoolEntry&) = delete; From 0e4964030656253d06cc799f6f0ccbdd4ea517c6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 8 Jul 2022 17:59:43 +0200 Subject: [PATCH 30/74] update CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ba6d754..02970e84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,8 @@ https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/593 ## Additions +- New constructor for PoolEntry which allows to simply specify the length of the pool entry. + This is also the new default constructor for scalar value with 0 as an initial value - Added options for CI/CD builds: `FSFW_CICD_BUILD`. This allows the source code to know whether it is running in CI/CD PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/623 From adbf375f38c30dc24af246b3638bbb3bcb5dda64 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 13 Jul 2022 21:58:07 +0200 Subject: [PATCH 31/74] some small fixes to dhb countdown addition --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index f3cfcee4..a6f9b35d 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -239,25 +239,20 @@ void DeviceHandlerBase::decrementDeviceReplyMap() { for (std::pair& replyPair : deviceReplyMap) { if (replyPair.second.countdown != nullptr && replyPair.second.active) { if (replyPair.second.countdown->hasTimedOut()) { + disableTimeoutControlledReply(&replyPair.second); timedOut = true; } } if (replyPair.second.delayCycles != 0 && replyPair.second.countdown == nullptr) { replyPair.second.delayCycles--; if (replyPair.second.delayCycles == 0) { - if (replyPair.second.periodic) { - replyPair.second.delayCycles = replyPair.second.maxDelayCycles; - } + disableDelayCyclesControlledReply(&replyPair.second); timedOut = true; } } if (timedOut) { replyToReply(replyPair.first, replyPair.second, TIMEOUT); missedReply(replyPair.first); - timedOut = false; - if (not replyPair.second.periodic) { - replyPair.second.active = false; - } } } } @@ -518,11 +513,19 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI return COMMAND_NOT_SUPPORTED; } if (enable) { - info->delayCycles = info->maxDelayCycles; info->active = true; + if (info->countdown != nullptr) { + info->delayCycles = info->maxDelayCycles; + } else { + info->countdown->resetTimer(); + } } else { - info->delayCycles = 0; info->active = false; + if (info->countdown != nullptr) { + info->delayCycles = 0; + } else { + info->countdown->timeOut(); + } } } return HasReturnvaluesIF::RETURN_OK; @@ -1398,7 +1401,12 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand) if (iter == deviceReplyMap.end()) { return 0; } else if (iter->second.countdown != nullptr) { - return 0; + // fake a useful return value for legacy code + if (iter->second.active) { + return 1; + } else { + return 0; + } } return iter->second.delayCycles; } From 4d34f93cfc32400c09cf5c8d7653e2ac85538d14 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 14 Jul 2022 08:58:23 +0200 Subject: [PATCH 32/74] missing reset of timedOut value in loop of decrementDeviceReplyMap --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index a6f9b35d..ca7701d0 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -253,6 +253,7 @@ void DeviceHandlerBase::decrementDeviceReplyMap() { if (timedOut) { replyToReply(replyPair.first, replyPair.second, TIMEOUT); missedReply(replyPair.first); + timedOut = false; } } } From ecac08814e8dbcf4d47ac0bea111502bcb528dfa Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Thu, 14 Jul 2022 09:15:13 +0200 Subject: [PATCH 33/74] better naming for functions which reset states of replies --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 12 ++++++------ src/fsfw/devicehandlers/DeviceHandlerBase.h | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index ca7701d0..cf457a03 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -239,14 +239,14 @@ void DeviceHandlerBase::decrementDeviceReplyMap() { for (std::pair& replyPair : deviceReplyMap) { if (replyPair.second.countdown != nullptr && replyPair.second.active) { if (replyPair.second.countdown->hasTimedOut()) { - disableTimeoutControlledReply(&replyPair.second); + resetTimeoutControlledReply(&replyPair.second); timedOut = true; } } if (replyPair.second.delayCycles != 0 && replyPair.second.countdown == nullptr) { replyPair.second.delayCycles--; if (replyPair.second.delayCycles == 0) { - disableDelayCyclesControlledReply(&replyPair.second); + resetDelayCyclesControlledReply(&replyPair.second); timedOut = true; } } @@ -841,9 +841,9 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId } if (info->active && info->countdown != nullptr) { - disableTimeoutControlledReply(info); + resetTimeoutControlledReply(info); } else if (info->delayCycles != 0) { - disableDelayCyclesControlledReply(info); + resetDelayCyclesControlledReply(info); } if (result != RETURN_OK) { @@ -862,7 +862,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, DeviceCommandId } } -void DeviceHandlerBase::disableTimeoutControlledReply(DeviceReplyInfo* info) { +void DeviceHandlerBase::resetTimeoutControlledReply(DeviceReplyInfo* info) { if (info->periodic) { info->countdown->resetTimer(); } else { @@ -871,7 +871,7 @@ void DeviceHandlerBase::disableTimeoutControlledReply(DeviceReplyInfo* info) { } } -void DeviceHandlerBase::disableDelayCyclesControlledReply(DeviceReplyInfo* info) { +void DeviceHandlerBase::resetDelayCyclesControlledReply(DeviceReplyInfo* info) { if (info->periodic) { info->delayCycles = info->maxDelayCycles; } else { diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 1945ac65..e29e6596 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -1257,15 +1257,15 @@ class DeviceHandlerBase : public DeviceHandlerIF, void doGetRead(void); /** - * @brief Handles disabling of replies which use a timeout to detect missed replies. + * @brief Resets replies which use a timeout to detect missed replies. */ - void disableTimeoutControlledReply(DeviceReplyInfo *info); + void resetTimeoutControlledReply(DeviceReplyInfo *info); /** - * @brief Handles disabling of replies which use a number of maximum delay cycles to detect + * @brief Resets replies which use a number of maximum delay cycles to detect * missed replies. */ - void disableDelayCyclesControlledReply(DeviceReplyInfo *info); + void resetDelayCyclesControlledReply(DeviceReplyInfo *info); /** * Retrive data from the #IPCStore. From 6f7be281ef90d0a25b6a6aa5659452cea5ae193d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 08:59:40 +0200 Subject: [PATCH 34/74] move HAL and tests folder --- hal/CMakeLists.txt | 48 ---- hal/src/CMakeLists.txt | 9 - src/CMakeLists.txt | 2 + {hal/src => src}/fsfw_hal/CMakeLists.txt | 0 .../fsfw_hal/common/CMakeLists.txt | 0 .../fsfw_hal/common/gpio/CMakeLists.txt | 0 .../fsfw_hal/common/gpio/GpioCookie.cpp | 0 .../fsfw_hal/common/gpio/GpioCookie.h | 0 .../src => src}/fsfw_hal/common/gpio/GpioIF.h | 0 .../fsfw_hal/common/gpio/gpioDefinitions.h | 0 .../fsfw_hal/common/spi/spiCommon.h | 0 .../fsfw_hal/devicehandlers/CMakeLists.txt | 0 .../devicehandlers/GyroL3GD20Handler.cpp | 0 .../devicehandlers/GyroL3GD20Handler.h | 0 .../devicehandlers/MgmLIS3MDLHandler.cpp | 0 .../devicehandlers/MgmLIS3MDLHandler.h | 0 .../devicehandlers/MgmRM3100Handler.cpp | 0 .../devicehandlers/MgmRM3100Handler.h | 0 .../devicedefinitions/GyroL3GD20Definitions.h | 0 .../devicedefinitions/MgmLIS3HandlerDefs.h | 0 .../devicedefinitions/MgmRM3100HandlerDefs.h | 0 {hal/src => src}/fsfw_hal/host/CMakeLists.txt | 0 .../src => src}/fsfw_hal/linux/CMakeLists.txt | 0 .../fsfw_hal/linux/CommandExecutor.cpp | 0 .../fsfw_hal/linux/CommandExecutor.h | 0 .../fsfw_hal/linux/UnixFileGuard.cpp | 0 .../fsfw_hal/linux/UnixFileGuard.h | 0 .../fsfw_hal/linux/gpio/CMakeLists.txt | 0 .../fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp | 0 .../fsfw_hal/linux/gpio/LinuxLibgpioIF.h | 0 .../fsfw_hal/linux/i2c/CMakeLists.txt | 0 .../fsfw_hal/linux/i2c/I2cComIF.cpp | 0 .../src => src}/fsfw_hal/linux/i2c/I2cComIF.h | 0 .../fsfw_hal/linux/i2c/I2cCookie.cpp | 0 .../fsfw_hal/linux/i2c/I2cCookie.h | 0 .../fsfw_hal/linux/rpi/CMakeLists.txt | 0 .../fsfw_hal/linux/rpi/GpioRPi.cpp | 0 {hal/src => src}/fsfw_hal/linux/rpi/GpioRPi.h | 0 .../fsfw_hal/linux/spi/CMakeLists.txt | 0 .../fsfw_hal/linux/spi/SpiComIF.cpp | 0 .../src => src}/fsfw_hal/linux/spi/SpiComIF.h | 0 .../fsfw_hal/linux/spi/SpiCookie.cpp | 0 .../fsfw_hal/linux/spi/SpiCookie.h | 0 .../fsfw_hal/linux/spi/spiDefinitions.h | 0 .../fsfw_hal/linux/uart/CMakeLists.txt | 0 .../fsfw_hal/linux/uart/UartComIF.cpp | 0 .../fsfw_hal/linux/uart/UartComIF.h | 0 .../fsfw_hal/linux/uart/UartCookie.cpp | 0 .../fsfw_hal/linux/uart/UartCookie.h | 0 .../fsfw_hal/linux/uio/CMakeLists.txt | 0 .../fsfw_hal/linux/uio/UioMapper.cpp | 0 .../fsfw_hal/linux/uio/UioMapper.h | 0 {hal/src => src}/fsfw_hal/linux/utility.cpp | 0 {hal/src => src}/fsfw_hal/linux/utility.h | 0 .../fsfw_hal/stm32h7/CMakeLists.txt | 0 .../fsfw_hal/stm32h7/definitions.h | 0 .../stm32h7/devicetest/CMakeLists.txt | 0 .../stm32h7/devicetest/GyroL3GD20H.cpp | 0 .../fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h | 0 {hal/src => src}/fsfw_hal/stm32h7/dma.cpp | 0 {hal/src => src}/fsfw_hal/stm32h7/dma.h | 0 .../fsfw_hal/stm32h7/gpio/CMakeLists.txt | 0 .../fsfw_hal/stm32h7/gpio/gpio.cpp | 0 {hal/src => src}/fsfw_hal/stm32h7/gpio/gpio.h | 0 .../fsfw_hal/stm32h7/i2c/CMakeLists.txt | 0 .../src => src}/fsfw_hal/stm32h7/interrupts.h | 0 .../fsfw_hal/stm32h7/spi/CMakeLists.txt | 0 .../fsfw_hal/stm32h7/spi/SpiComIF.cpp | 0 .../fsfw_hal/stm32h7/spi/SpiComIF.h | 0 .../fsfw_hal/stm32h7/spi/SpiCookie.cpp | 0 .../fsfw_hal/stm32h7/spi/SpiCookie.h | 0 .../fsfw_hal/stm32h7/spi/mspInit.cpp | 0 .../fsfw_hal/stm32h7/spi/mspInit.h | 0 .../fsfw_hal/stm32h7/spi/spiCore.cpp | 0 .../fsfw_hal/stm32h7/spi/spiCore.h | 0 .../fsfw_hal/stm32h7/spi/spiDefinitions.cpp | 0 .../fsfw_hal/stm32h7/spi/spiDefinitions.h | 0 .../fsfw_hal/stm32h7/spi/spiInterrupts.cpp | 0 .../fsfw_hal/stm32h7/spi/spiInterrupts.h | 0 .../fsfw_hal/stm32h7/spi/stm32h743zi.cpp | 0 .../fsfw_hal/stm32h7/spi/stm32h743zi.h | 0 .../fsfw_hal/stm32h7/uart/CMakeLists.txt | 0 {tests/src => src}/fsfw_tests/CMakeLists.txt | 0 .../fsfw_tests/integration/CMakeLists.txt | 0 .../integration/assemblies/CMakeLists.txt | 0 .../integration/assemblies/TestAssembly.cpp | 0 .../integration/assemblies/TestAssembly.h | 0 .../integration/controller/CMakeLists.txt | 0 .../integration/controller/TestController.cpp | 0 .../integration/controller/TestController.h | 0 .../ctrldefinitions/testCtrlDefinitions.h | 0 .../integration/devices/CMakeLists.txt | 0 .../integration/devices/TestCookie.cpp | 0 .../integration/devices/TestCookie.h | 0 .../integration/devices/TestDeviceHandler.cpp | 0 .../integration/devices/TestDeviceHandler.h | 0 .../integration/devices/TestEchoComIF.cpp | 0 .../integration/devices/TestEchoComIF.h | 0 .../devicedefinitions/testDeviceDefinitions.h | 0 .../integration/task/CMakeLists.txt | 0 .../fsfw_tests/integration/task/TestTask.cpp | 0 .../fsfw_tests/integration/task/TestTask.h | 0 .../fsfw_tests/internal/CMakeLists.txt | 0 .../internal/InternalUnitTester.cpp | 0 .../fsfw_tests/internal/InternalUnitTester.h | 0 .../fsfw_tests/internal/UnittDefinitions.cpp | 0 .../fsfw_tests/internal/UnittDefinitions.h | 0 .../internal/globalfunctions/CMakeLists.txt | 0 .../globalfunctions/TestArrayPrinter.cpp | 0 .../globalfunctions/TestArrayPrinter.h | 0 .../fsfw_tests/internal/osal/CMakeLists.txt | 0 .../fsfw_tests/internal/osal/testMq.cpp | 0 .../fsfw_tests/internal/osal/testMq.h | 0 .../fsfw_tests/internal/osal/testMutex.cpp | 0 .../fsfw_tests/internal/osal/testMutex.h | 0 .../internal/osal/testSemaphore.cpp | 0 .../fsfw_tests/internal/osal/testSemaphore.h | 0 .../internal/serialize/CMakeLists.txt | 0 .../serialize/IntTestSerialization.cpp | 0 .../internal/serialize/IntTestSerialization.h | 0 .../fsfw_tests/unit/CMakeLists.txt | 0 .../fsfw_tests/unit/CatchDefinitions.cpp | 0 .../fsfw_tests/unit/CatchDefinitions.h | 0 .../fsfw_tests/unit/CatchFactory.cpp | 0 .../fsfw_tests/unit/CatchFactory.h | 0 .../fsfw_tests/unit/CatchRunner.cpp | 0 .../src => src}/fsfw_tests/unit/CatchRunner.h | 0 .../fsfw_tests/unit/CatchSetup.cpp | 0 .../fsfw_tests/unit/action/CMakeLists.txt | 0 .../unit/action/TestActionHelper.cpp | 0 .../fsfw_tests/unit/action/TestActionHelper.h | 0 .../fsfw_tests/unit/cfdp/CMakeLists.txt | 0 .../fsfw_tests/unit/cfdp/testAckPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testCfdp.cpp | 0 .../fsfw_tests/unit/cfdp/testEofPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testFileData.cpp | 0 .../fsfw_tests/unit/cfdp/testFinishedPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp | 0 .../fsfw_tests/unit/cfdp/testMetadataPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testNakPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testPromptPdu.cpp | 0 .../fsfw_tests/unit/cfdp/testTlvsLvs.cpp | 0 .../fsfw_tests/unit/container/CMakeLists.txt | 0 .../unit/container/RingBufferTest.cpp | 0 .../unit/container/TestArrayList.cpp | 0 .../unit/container/TestDynamicFifo.cpp | 0 .../fsfw_tests/unit/container/TestFifo.cpp | 0 .../unit/container/TestFixedArrayList.cpp | 0 .../unit/container/TestFixedMap.cpp | 0 .../container/TestFixedOrderedMultimap.cpp | 0 .../unit/container/TestPlacementFactory.cpp | 0 .../unit/datapoollocal/CMakeLists.txt | 0 .../unit/datapoollocal/DataSetTest.cpp | 0 .../datapoollocal/LocalPoolManagerTest.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.h | 0 .../datapoollocal/LocalPoolVariableTest.cpp | 0 .../datapoollocal/LocalPoolVectorTest.cpp | 0 .../unit/devicehandler/CMakeLists.txt | 0 .../unit/devicehandler/ComIFMock.cpp | 92 ++++---- .../fsfw_tests/unit/devicehandler/ComIFMock.h | 74 +++---- .../unit/devicehandler/CookieIFMock.cpp | 10 +- .../unit/devicehandler/CookieIFMock.h | 24 +- .../unit/devicehandler/DeviceFdirMock.cpp | 0 .../unit/devicehandler/DeviceFdirMock.h | 0 .../devicehandler/DeviceHandlerCommander.cpp | 128 +++++------ .../devicehandler/DeviceHandlerCommander.h | 100 ++++----- .../unit/devicehandler/DeviceHandlerMock.cpp | 206 +++++++++--------- .../unit/devicehandler/DeviceHandlerMock.h | 92 ++++---- .../devicehandler/TestDeviceHandlerBase.cpp | 190 ++++++++-------- .../unit/globalfunctions/CMakeLists.txt | 0 .../unit/globalfunctions/testBitutil.cpp | 0 .../unit/globalfunctions/testCRC.cpp | 0 .../unit/globalfunctions/testDleEncoder.cpp | 0 .../unit/globalfunctions/testOpDivider.cpp | 0 .../globalfunctions/testTimevalOperations.cpp | 0 .../fsfw_tests/unit/hal/CMakeLists.txt | 0 .../unit/hal/testCommandExecutor.cpp | 0 .../unit/internalerror/CMakeLists.txt | 0 .../TestInternalErrorReporter.cpp | 0 .../fsfw_tests/unit/mocks/CMakeLists.txt | 0 .../fsfw_tests/unit/mocks/HkReceiverMock.h | 0 .../unit/mocks/MessageQueueMockBase.h | 0 .../unit/mocks/PeriodicTaskIFMock.h | 0 .../unit/mocks/PowerSwitcherMock.cpp | 0 .../fsfw_tests/unit/mocks/PowerSwitcherMock.h | 0 .../fsfw_tests/unit/osal/CMakeLists.txt | 0 .../fsfw_tests/unit/osal/TestClock.cpp | 0 .../fsfw_tests/unit/osal/TestMessageQueue.cpp | 0 .../fsfw_tests/unit/osal/TestSemaphore.cpp | 0 .../fsfw_tests/unit/power/CMakeLists.txt | 0 .../unit/power/testPowerSwitcher.cpp | 0 .../src => src}/fsfw_tests/unit/printChar.cpp | 0 .../src => src}/fsfw_tests/unit/printChar.h | 0 .../fsfw_tests/unit/serialize/CMakeLists.txt | 0 .../serialize/TestSerialBufferAdapter.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.h | 0 .../unit/serialize/TestSerialization.cpp | 0 .../unit/storagemanager/CMakeLists.txt | 0 .../unit/storagemanager/TestNewAccessor.cpp | 0 .../unit/storagemanager/TestPool.cpp | 0 .../fsfw_tests/unit/testcfg/CMakeLists.txt | 0 .../fsfw_tests/unit/testcfg/FSFWConfig.h.in | 0 .../fsfw_tests/unit/testcfg/OBSWConfig.h.in | 0 .../fsfw_tests/unit/testcfg/TestsConfig.h.in | 0 .../unit/testcfg/devices/logicalAddresses.cpp | 0 .../unit/testcfg/devices/logicalAddresses.h | 0 .../testcfg/devices/powerSwitcherList.cpp | 0 .../unit/testcfg/devices/powerSwitcherList.h | 0 .../unit/testcfg/events/subsystemIdRanges.h | 0 .../unit/testcfg/ipc/MissionMessageTypes.cpp | 0 .../unit/testcfg/ipc/MissionMessageTypes.h | 0 .../unit/testcfg/objects/systemObjectList.h | 68 +++--- .../PollingSequenceFactory.cpp | 0 .../pollingsequence/PollingSequenceFactory.h | 0 .../unit/testcfg/returnvalues/classIds.h | 0 .../fsfw_tests/unit/testcfg/tmtc/apid.h | 0 .../fsfw_tests/unit/testcfg/tmtc/pusIds.h | 0 .../unit/testtemplate/TestTemplate.cpp | 0 .../unit/timemanager/CMakeLists.txt | 0 .../unit/timemanager/TestCCSDSTime.cpp | 0 .../unit/timemanager/TestCountdown.cpp | 0 .../fsfw_tests/unit/tmtcpacket/CMakeLists.txt | 0 .../fsfw_tests/unit/tmtcpacket/PusTmTest.cpp | 0 .../fsfw_tests/unit/tmtcpacket/testCcsds.cpp | 0 .../src => src}/fsfw_tests/unit/version.cpp | 0 tests/CMakeLists.txt | 1 - tests/src/CMakeLists.txt | 9 - 229 files changed, 494 insertions(+), 559 deletions(-) delete mode 100644 hal/CMakeLists.txt delete mode 100644 hal/src/CMakeLists.txt rename {hal/src => src}/fsfw_hal/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/common/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/common/gpio/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/common/gpio/GpioCookie.cpp (100%) rename {hal/src => src}/fsfw_hal/common/gpio/GpioCookie.h (100%) rename {hal/src => src}/fsfw_hal/common/gpio/GpioIF.h (100%) rename {hal/src => src}/fsfw_hal/common/gpio/gpioDefinitions.h (100%) rename {hal/src => src}/fsfw_hal/common/spi/spiCommon.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/GyroL3GD20Handler.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/MgmRM3100Handler.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h (100%) rename {hal/src => src}/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h (100%) rename {hal/src => src}/fsfw_hal/host/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/CommandExecutor.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/CommandExecutor.h (100%) rename {hal/src => src}/fsfw_hal/linux/UnixFileGuard.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/UnixFileGuard.h (100%) rename {hal/src => src}/fsfw_hal/linux/gpio/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/gpio/LinuxLibgpioIF.h (100%) rename {hal/src => src}/fsfw_hal/linux/i2c/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/i2c/I2cComIF.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/i2c/I2cComIF.h (100%) rename {hal/src => src}/fsfw_hal/linux/i2c/I2cCookie.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/i2c/I2cCookie.h (100%) rename {hal/src => src}/fsfw_hal/linux/rpi/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/rpi/GpioRPi.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/rpi/GpioRPi.h (100%) rename {hal/src => src}/fsfw_hal/linux/spi/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/spi/SpiComIF.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/spi/SpiComIF.h (100%) rename {hal/src => src}/fsfw_hal/linux/spi/SpiCookie.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/spi/SpiCookie.h (100%) rename {hal/src => src}/fsfw_hal/linux/spi/spiDefinitions.h (100%) rename {hal/src => src}/fsfw_hal/linux/uart/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/uart/UartComIF.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/uart/UartComIF.h (100%) rename {hal/src => src}/fsfw_hal/linux/uart/UartCookie.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/uart/UartCookie.h (100%) rename {hal/src => src}/fsfw_hal/linux/uio/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/linux/uio/UioMapper.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/uio/UioMapper.h (100%) rename {hal/src => src}/fsfw_hal/linux/utility.cpp (100%) rename {hal/src => src}/fsfw_hal/linux/utility.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/stm32h7/definitions.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/devicetest/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/dma.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/dma.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/gpio/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/stm32h7/gpio/gpio.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/gpio/gpio.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/i2c/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/stm32h7/interrupts.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/CMakeLists.txt (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/SpiComIF.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/SpiComIF.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/SpiCookie.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/SpiCookie.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/mspInit.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/mspInit.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiCore.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiCore.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiDefinitions.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiDefinitions.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiInterrupts.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/spiInterrupts.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/stm32h743zi.cpp (100%) rename {hal/src => src}/fsfw_hal/stm32h7/spi/stm32h743zi.h (100%) rename {hal/src => src}/fsfw_hal/stm32h7/uart/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/assemblies/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/assemblies/TestAssembly.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/assemblies/TestAssembly.h (100%) rename {tests/src => src}/fsfw_tests/integration/controller/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/controller/TestController.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/controller/TestController.h (100%) rename {tests/src => src}/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h (100%) rename {tests/src => src}/fsfw_tests/integration/devices/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestCookie.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestCookie.h (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestDeviceHandler.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestDeviceHandler.h (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestEchoComIF.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/devices/TestEchoComIF.h (100%) rename {tests/src => src}/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h (100%) rename {tests/src => src}/fsfw_tests/integration/task/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/integration/task/TestTask.cpp (100%) rename {tests/src => src}/fsfw_tests/integration/task/TestTask.h (100%) rename {tests/src => src}/fsfw_tests/internal/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/internal/InternalUnitTester.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/InternalUnitTester.h (100%) rename {tests/src => src}/fsfw_tests/internal/UnittDefinitions.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/UnittDefinitions.h (100%) rename {tests/src => src}/fsfw_tests/internal/globalfunctions/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h (100%) rename {tests/src => src}/fsfw_tests/internal/osal/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testMq.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testMq.h (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testMutex.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testMutex.h (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testSemaphore.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/osal/testSemaphore.h (100%) rename {tests/src => src}/fsfw_tests/internal/serialize/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/internal/serialize/IntTestSerialization.cpp (100%) rename {tests/src => src}/fsfw_tests/internal/serialize/IntTestSerialization.h (100%) rename {tests/src => src}/fsfw_tests/unit/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/CatchDefinitions.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/CatchDefinitions.h (100%) rename {tests/src => src}/fsfw_tests/unit/CatchFactory.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/CatchFactory.h (100%) rename {tests/src => src}/fsfw_tests/unit/CatchRunner.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/CatchRunner.h (100%) rename {tests/src => src}/fsfw_tests/unit/CatchSetup.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/action/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/action/TestActionHelper.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/action/TestActionHelper.h (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testAckPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testCfdp.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testEofPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testFileData.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testFinishedPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testMetadataPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testNakPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testPromptPdu.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/cfdp/testTlvsLvs.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/container/RingBufferTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestArrayList.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestDynamicFifo.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestFifo.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestFixedArrayList.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestFixedMap.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/container/TestPlacementFactory.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/DataSetTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/ComIFMock.cpp (96%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/ComIFMock.h (97%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/CookieIFMock.cpp (94%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/CookieIFMock.h (96%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceFdirMock.h (100%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp (97%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h (97%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp (96%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h (97%) rename {tests/src => src}/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp (98%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/testBitutil.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/testCRC.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/testOpDivider.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/hal/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/hal/testCommandExecutor.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/internalerror/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/HkReceiverMock.h (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/MessageQueueMockBase.h (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/mocks/PowerSwitcherMock.h (100%) rename {tests/src => src}/fsfw_tests/unit/osal/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/osal/TestClock.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/osal/TestMessageQueue.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/osal/TestSemaphore.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/power/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/power/testPowerSwitcher.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/printChar.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/printChar.h (100%) rename {tests/src => src}/fsfw_tests/unit/serialize/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h (100%) rename {tests/src => src}/fsfw_tests/unit/serialize/TestSerialization.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/storagemanager/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/storagemanager/TestPool.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/FSFWConfig.h.in (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/OBSWConfig.h.in (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/TestsConfig.h.in (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/devices/logicalAddresses.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/objects/systemObjectList.h (95%) rename {tests/src => src}/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/returnvalues/classIds.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/tmtc/apid.h (100%) rename {tests/src => src}/fsfw_tests/unit/testcfg/tmtc/pusIds.h (100%) rename {tests/src => src}/fsfw_tests/unit/testtemplate/TestTemplate.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/timemanager/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/timemanager/TestCountdown.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/tmtcpacket/CMakeLists.txt (100%) rename {tests/src => src}/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/tmtcpacket/testCcsds.cpp (100%) rename {tests/src => src}/fsfw_tests/unit/version.cpp (100%) delete mode 100644 tests/CMakeLists.txt delete mode 100644 tests/src/CMakeLists.txt 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/src/CMakeLists.txt b/src/CMakeLists.txt index 34f21c2f..6d7f83b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,3 +4,5 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(fsfw) +add_subdirectory(fsfw_hal) +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 100% rename from tests/src/fsfw_tests/CMakeLists.txt rename to src/fsfw_tests/CMakeLists.txt 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/src/fsfw_tests/unit/CMakeLists.txt b/src/fsfw_tests/unit/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/CMakeLists.txt rename to src/fsfw_tests/unit/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/CatchDefinitions.cpp b/src/fsfw_tests/unit/CatchDefinitions.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchDefinitions.cpp rename to src/fsfw_tests/unit/CatchDefinitions.cpp diff --git a/tests/src/fsfw_tests/unit/CatchDefinitions.h b/src/fsfw_tests/unit/CatchDefinitions.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchDefinitions.h rename to src/fsfw_tests/unit/CatchDefinitions.h diff --git a/tests/src/fsfw_tests/unit/CatchFactory.cpp b/src/fsfw_tests/unit/CatchFactory.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchFactory.cpp rename to src/fsfw_tests/unit/CatchFactory.cpp diff --git a/tests/src/fsfw_tests/unit/CatchFactory.h b/src/fsfw_tests/unit/CatchFactory.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchFactory.h rename to src/fsfw_tests/unit/CatchFactory.h diff --git a/tests/src/fsfw_tests/unit/CatchRunner.cpp b/src/fsfw_tests/unit/CatchRunner.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchRunner.cpp rename to src/fsfw_tests/unit/CatchRunner.cpp diff --git a/tests/src/fsfw_tests/unit/CatchRunner.h b/src/fsfw_tests/unit/CatchRunner.h similarity index 100% rename from tests/src/fsfw_tests/unit/CatchRunner.h rename to src/fsfw_tests/unit/CatchRunner.h diff --git a/tests/src/fsfw_tests/unit/CatchSetup.cpp b/src/fsfw_tests/unit/CatchSetup.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/CatchSetup.cpp rename to src/fsfw_tests/unit/CatchSetup.cpp diff --git a/tests/src/fsfw_tests/unit/action/CMakeLists.txt b/src/fsfw_tests/unit/action/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/action/CMakeLists.txt rename to src/fsfw_tests/unit/action/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp b/src/fsfw_tests/unit/action/TestActionHelper.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/action/TestActionHelper.cpp rename to src/fsfw_tests/unit/action/TestActionHelper.cpp diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.h b/src/fsfw_tests/unit/action/TestActionHelper.h similarity index 100% rename from tests/src/fsfw_tests/unit/action/TestActionHelper.h rename to src/fsfw_tests/unit/action/TestActionHelper.h diff --git a/tests/src/fsfw_tests/unit/cfdp/CMakeLists.txt b/src/fsfw_tests/unit/cfdp/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/CMakeLists.txt rename to src/fsfw_tests/unit/cfdp/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/cfdp/testAckPdu.cpp b/src/fsfw_tests/unit/cfdp/testAckPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testAckPdu.cpp rename to src/fsfw_tests/unit/cfdp/testAckPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testCfdp.cpp b/src/fsfw_tests/unit/cfdp/testCfdp.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testCfdp.cpp rename to src/fsfw_tests/unit/cfdp/testCfdp.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testEofPdu.cpp b/src/fsfw_tests/unit/cfdp/testEofPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testEofPdu.cpp rename to src/fsfw_tests/unit/cfdp/testEofPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testFileData.cpp b/src/fsfw_tests/unit/cfdp/testFileData.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testFileData.cpp rename to src/fsfw_tests/unit/cfdp/testFileData.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp b/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp rename to src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp b/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp rename to src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp b/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp rename to src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testNakPdu.cpp b/src/fsfw_tests/unit/cfdp/testNakPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testNakPdu.cpp rename to src/fsfw_tests/unit/cfdp/testNakPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp b/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp rename to src/fsfw_tests/unit/cfdp/testPromptPdu.cpp diff --git a/tests/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp b/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp rename to src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp diff --git a/tests/src/fsfw_tests/unit/container/CMakeLists.txt b/src/fsfw_tests/unit/container/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/container/CMakeLists.txt rename to src/fsfw_tests/unit/container/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/src/fsfw_tests/unit/container/RingBufferTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/RingBufferTest.cpp rename to src/fsfw_tests/unit/container/RingBufferTest.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestArrayList.cpp b/src/fsfw_tests/unit/container/TestArrayList.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestArrayList.cpp rename to src/fsfw_tests/unit/container/TestArrayList.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp b/src/fsfw_tests/unit/container/TestDynamicFifo.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp rename to src/fsfw_tests/unit/container/TestDynamicFifo.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestFifo.cpp b/src/fsfw_tests/unit/container/TestFifo.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestFifo.cpp rename to src/fsfw_tests/unit/container/TestFifo.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp b/src/fsfw_tests/unit/container/TestFixedArrayList.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp rename to src/fsfw_tests/unit/container/TestFixedArrayList.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp b/src/fsfw_tests/unit/container/TestFixedMap.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestFixedMap.cpp rename to src/fsfw_tests/unit/container/TestFixedMap.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp b/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp rename to src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp diff --git a/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp b/src/fsfw_tests/unit/container/TestPlacementFactory.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp rename to src/fsfw_tests/unit/container/TestPlacementFactory.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt b/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt rename to src/fsfw_tests/unit/datapoollocal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp rename to src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp rename to src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp b/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp rename to src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h b/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h rename to src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp rename to src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp rename to src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp diff --git a/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt b/src/fsfw_tests/unit/devicehandler/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt rename to src/fsfw_tests/unit/devicehandler/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp rename to src/fsfw_tests/unit/devicehandler/ComIFMock.cpp index 4d985f94..650b74bd 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/ComIFMock.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h rename to src/fsfw_tests/unit/devicehandler/ComIFMock.h index 1463deb6..d16cc0a6 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/ComIFMock.h +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp similarity index 94% rename from tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp rename to src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp index e9b03a6c..1ae2eb6e 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/CookieIFMock.h similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h rename to src/fsfw_tests/unit/devicehandler/CookieIFMock.h index 5c868932..1243b0a7 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/CookieIFMock.h +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp rename to src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h b/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h rename to src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp rename to src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp index 4540a388..d38166ad 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h rename to src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h index 82183baf..435d0017 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp similarity index 96% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp rename to src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp index 1e05f8f3..ea30ff6a 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h similarity index 97% rename from tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h rename to src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h index f5fcb4aa..ef1649c3 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp similarity index 98% rename from tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp rename to src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp index 873329c3..e82a39b7 100644 --- a/tests/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp +++ b/src/fsfw_tests/unit/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 "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); + } +} diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt rename to src/fsfw_tests/unit/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp b/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp rename to src/fsfw_tests/unit/globalfunctions/testBitutil.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp b/src/fsfw_tests/unit/globalfunctions/testCRC.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testCRC.cpp rename to src/fsfw_tests/unit/globalfunctions/testCRC.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp rename to src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp b/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp rename to src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp b/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp rename to src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp diff --git a/tests/src/fsfw_tests/unit/hal/CMakeLists.txt b/src/fsfw_tests/unit/hal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/hal/CMakeLists.txt rename to src/fsfw_tests/unit/hal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp b/src/fsfw_tests/unit/hal/testCommandExecutor.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/hal/testCommandExecutor.cpp rename to src/fsfw_tests/unit/hal/testCommandExecutor.cpp diff --git a/tests/src/fsfw_tests/unit/internalerror/CMakeLists.txt b/src/fsfw_tests/unit/internalerror/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/internalerror/CMakeLists.txt rename to src/fsfw_tests/unit/internalerror/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp b/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp rename to src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp diff --git a/tests/src/fsfw_tests/unit/mocks/CMakeLists.txt b/src/fsfw_tests/unit/mocks/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/CMakeLists.txt rename to src/fsfw_tests/unit/mocks/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h b/src/fsfw_tests/unit/mocks/HkReceiverMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h rename to src/fsfw_tests/unit/mocks/HkReceiverMock.h diff --git a/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h b/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h rename to src/fsfw_tests/unit/mocks/MessageQueueMockBase.h diff --git a/tests/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h b/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h rename to src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h diff --git a/tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp b/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp rename to src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp diff --git a/tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h b/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h similarity index 100% rename from tests/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h rename to src/fsfw_tests/unit/mocks/PowerSwitcherMock.h diff --git a/tests/src/fsfw_tests/unit/osal/CMakeLists.txt b/src/fsfw_tests/unit/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/osal/CMakeLists.txt rename to src/fsfw_tests/unit/osal/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/osal/TestClock.cpp b/src/fsfw_tests/unit/osal/TestClock.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/osal/TestClock.cpp rename to src/fsfw_tests/unit/osal/TestClock.cpp diff --git a/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp b/src/fsfw_tests/unit/osal/TestMessageQueue.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp rename to src/fsfw_tests/unit/osal/TestMessageQueue.cpp diff --git a/tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp b/src/fsfw_tests/unit/osal/TestSemaphore.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp rename to src/fsfw_tests/unit/osal/TestSemaphore.cpp diff --git a/tests/src/fsfw_tests/unit/power/CMakeLists.txt b/src/fsfw_tests/unit/power/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/power/CMakeLists.txt rename to src/fsfw_tests/unit/power/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/power/testPowerSwitcher.cpp b/src/fsfw_tests/unit/power/testPowerSwitcher.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/power/testPowerSwitcher.cpp rename to src/fsfw_tests/unit/power/testPowerSwitcher.cpp diff --git a/tests/src/fsfw_tests/unit/printChar.cpp b/src/fsfw_tests/unit/printChar.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/printChar.cpp rename to src/fsfw_tests/unit/printChar.cpp diff --git a/tests/src/fsfw_tests/unit/printChar.h b/src/fsfw_tests/unit/printChar.h similarity index 100% rename from tests/src/fsfw_tests/unit/printChar.h rename to src/fsfw_tests/unit/printChar.h diff --git a/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt b/src/fsfw_tests/unit/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/CMakeLists.txt rename to src/fsfw_tests/unit/serialize/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp b/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp rename to src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp b/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp rename to src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h b/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h rename to src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp b/src/fsfw_tests/unit/serialize/TestSerialization.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp rename to src/fsfw_tests/unit/serialize/TestSerialization.cpp diff --git a/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt b/src/fsfw_tests/unit/storagemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt rename to src/fsfw_tests/unit/storagemanager/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp rename to src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/src/fsfw_tests/unit/storagemanager/TestPool.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp rename to src/fsfw_tests/unit/storagemanager/TestPool.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/src/fsfw_tests/unit/testcfg/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt rename to src/fsfw_tests/unit/testcfg/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in rename to src/fsfw_tests/unit/testcfg/FSFWConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in b/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in rename to src/fsfw_tests/unit/testcfg/OBSWConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in b/src/fsfw_tests/unit/testcfg/TestsConfig.h.in similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in rename to src/fsfw_tests/unit/testcfg/TestsConfig.h.in diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp b/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp rename to src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h b/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h rename to src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp b/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp rename to src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h b/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h rename to src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h diff --git a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h b/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h rename to src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h diff --git a/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp b/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp rename to src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h b/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h rename to src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h similarity index 95% rename from tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h rename to src/fsfw_tests/unit/testcfg/objects/systemObjectList.h index 17b980e9..7d12e5c6 100644 --- a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h +++ b/src/fsfw_tests/unit/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/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h b/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h rename to src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h b/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h rename to src/fsfw_tests/unit/testcfg/returnvalues/classIds.h diff --git a/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h b/src/fsfw_tests/unit/testcfg/tmtc/apid.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h rename to src/fsfw_tests/unit/testcfg/tmtc/apid.h diff --git a/tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h b/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h similarity index 100% rename from tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h rename to src/fsfw_tests/unit/testcfg/tmtc/pusIds.h diff --git a/tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp b/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp rename to src/fsfw_tests/unit/testtemplate/TestTemplate.cpp diff --git a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/src/fsfw_tests/unit/timemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt rename to src/fsfw_tests/unit/timemanager/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp b/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp rename to src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp b/src/fsfw_tests/unit/timemanager/TestCountdown.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp rename to src/fsfw_tests/unit/timemanager/TestCountdown.cpp diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt b/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt rename to src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp b/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp rename to src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp b/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp rename to src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp diff --git a/tests/src/fsfw_tests/unit/version.cpp b/src/fsfw_tests/unit/version.cpp similarity index 100% rename from tests/src/fsfw_tests/unit/version.cpp rename to src/fsfw_tests/unit/version.cpp 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) From 3b23fb77b48b70f310894936afac3ac3fd3c8194 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 09:01:45 +0200 Subject: [PATCH 35/74] add obsolete add_subdirectory calls --- CMakeLists.txt | 4 ---- src/CMakeLists.txt | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9e3e471..dcfa89ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,10 +282,6 @@ message( ) add_subdirectory(src) -add_subdirectory(tests) -if(FSFW_ADD_HAL) - add_subdirectory(hal) -endif() add_subdirectory(contrib) if(FSFW_BUILD_DOCS) add_subdirectory(docs) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6d7f83b3..57b24bd5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -4,5 +4,8 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) add_subdirectory(fsfw) -add_subdirectory(fsfw_hal) +if(FSFW_ADD_HAL) + add_subdirectory(fsfw_hal) +endif() + add_subdirectory(fsfw_tests) From 846567037418eda973848791a19225d71a77abd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 11:42:51 +0200 Subject: [PATCH 36/74] separate unittest folder --- {src/fsfw_tests/unit => unittests}/CMakeLists.txt | 2 +- {src/fsfw_tests/unit => unittests}/CatchDefinitions.cpp | 0 {src/fsfw_tests/unit => unittests}/CatchDefinitions.h | 0 {src/fsfw_tests/unit => unittests}/CatchFactory.cpp | 0 {src/fsfw_tests/unit => unittests}/CatchFactory.h | 0 {src/fsfw_tests/unit => unittests}/CatchRunner.cpp | 0 {src/fsfw_tests/unit => unittests}/CatchRunner.h | 0 {src/fsfw_tests/unit => unittests}/CatchSetup.cpp | 0 {src/fsfw_tests/unit => unittests}/action/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/action/TestActionHelper.cpp | 0 {src/fsfw_tests/unit => unittests}/action/TestActionHelper.h | 0 {src/fsfw_tests/unit => unittests}/cfdp/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/cfdp/testAckPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testCfdp.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testEofPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testFileData.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testFinishedPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testKeepAlivePdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testMetadataPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testNakPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testPromptPdu.cpp | 0 {src/fsfw_tests/unit => unittests}/cfdp/testTlvsLvs.cpp | 0 {src/fsfw_tests/unit => unittests}/container/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/container/RingBufferTest.cpp | 0 {src/fsfw_tests/unit => unittests}/container/TestArrayList.cpp | 0 .../fsfw_tests/unit => unittests}/container/TestDynamicFifo.cpp | 0 {src/fsfw_tests/unit => unittests}/container/TestFifo.cpp | 0 .../unit => unittests}/container/TestFixedArrayList.cpp | 0 {src/fsfw_tests/unit => unittests}/container/TestFixedMap.cpp | 0 .../unit => unittests}/container/TestFixedOrderedMultimap.cpp | 0 .../unit => unittests}/container/TestPlacementFactory.cpp | 0 {src/fsfw_tests/unit => unittests}/datapoollocal/CMakeLists.txt | 0 .../fsfw_tests/unit => unittests}/datapoollocal/DataSetTest.cpp | 0 .../unit => unittests}/datapoollocal/LocalPoolManagerTest.cpp | 0 .../unit => unittests}/datapoollocal/LocalPoolOwnerBase.cpp | 0 .../unit => unittests}/datapoollocal/LocalPoolOwnerBase.h | 0 .../unit => unittests}/datapoollocal/LocalPoolVariableTest.cpp | 0 .../unit => unittests}/datapoollocal/LocalPoolVectorTest.cpp | 0 {src/fsfw_tests/unit => unittests}/devicehandler/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/devicehandler/ComIFMock.cpp | 0 {src/fsfw_tests/unit => unittests}/devicehandler/ComIFMock.h | 0 .../unit => unittests}/devicehandler/CookieIFMock.cpp | 0 {src/fsfw_tests/unit => unittests}/devicehandler/CookieIFMock.h | 0 .../unit => unittests}/devicehandler/DeviceFdirMock.cpp | 0 .../unit => unittests}/devicehandler/DeviceFdirMock.h | 0 .../unit => unittests}/devicehandler/DeviceHandlerCommander.cpp | 0 .../unit => unittests}/devicehandler/DeviceHandlerCommander.h | 0 .../unit => unittests}/devicehandler/DeviceHandlerMock.cpp | 0 .../unit => unittests}/devicehandler/DeviceHandlerMock.h | 0 .../unit => unittests}/devicehandler/TestDeviceHandlerBase.cpp | 0 .../unit => unittests}/globalfunctions/CMakeLists.txt | 0 .../unit => unittests}/globalfunctions/testBitutil.cpp | 0 {src/fsfw_tests/unit => unittests}/globalfunctions/testCRC.cpp | 0 .../unit => unittests}/globalfunctions/testDleEncoder.cpp | 0 .../unit => unittests}/globalfunctions/testOpDivider.cpp | 0 .../globalfunctions/testTimevalOperations.cpp | 0 {src/fsfw_tests/unit => unittests}/hal/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/hal/testCommandExecutor.cpp | 0 {src/fsfw_tests/unit => unittests}/internalerror/CMakeLists.txt | 0 .../internalerror/TestInternalErrorReporter.cpp | 0 {src/fsfw_tests/unit => unittests}/mocks/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/mocks/HkReceiverMock.h | 0 {src/fsfw_tests/unit => unittests}/mocks/MessageQueueMockBase.h | 0 {src/fsfw_tests/unit => unittests}/mocks/PeriodicTaskIFMock.h | 0 {src/fsfw_tests/unit => unittests}/mocks/PowerSwitcherMock.cpp | 0 {src/fsfw_tests/unit => unittests}/mocks/PowerSwitcherMock.h | 0 {src/fsfw_tests/unit => unittests}/osal/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/osal/TestClock.cpp | 0 {src/fsfw_tests/unit => unittests}/osal/TestMessageQueue.cpp | 0 {src/fsfw_tests/unit => unittests}/osal/TestSemaphore.cpp | 0 {src/fsfw_tests/unit => unittests}/power/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/power/testPowerSwitcher.cpp | 0 {src/fsfw_tests/unit => unittests}/printChar.cpp | 0 {src/fsfw_tests/unit => unittests}/printChar.h | 0 {src/fsfw_tests/unit => unittests}/serialize/CMakeLists.txt | 0 .../unit => unittests}/serialize/TestSerialBufferAdapter.cpp | 0 .../unit => unittests}/serialize/TestSerialLinkedPacket.cpp | 0 .../unit => unittests}/serialize/TestSerialLinkedPacket.h | 0 .../unit => unittests}/serialize/TestSerialization.cpp | 0 .../fsfw_tests/unit => unittests}/storagemanager/CMakeLists.txt | 0 .../unit => unittests}/storagemanager/TestNewAccessor.cpp | 0 {src/fsfw_tests/unit => unittests}/storagemanager/TestPool.cpp | 0 src/fsfw_tests/unit/version.cpp => unittests/testVersion.cpp | 0 {src/fsfw_tests/unit => unittests}/testcfg/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/testcfg/FSFWConfig.h.in | 0 {src/fsfw_tests/unit => unittests}/testcfg/OBSWConfig.h.in | 0 {src/fsfw_tests/unit => unittests}/testcfg/TestsConfig.h.in | 0 .../unit => unittests}/testcfg/devices/logicalAddresses.cpp | 0 .../unit => unittests}/testcfg/devices/logicalAddresses.h | 0 .../unit => unittests}/testcfg/devices/powerSwitcherList.cpp | 0 .../unit => unittests}/testcfg/devices/powerSwitcherList.h | 0 .../unit => unittests}/testcfg/events/subsystemIdRanges.h | 0 .../unit => unittests}/testcfg/ipc/MissionMessageTypes.cpp | 0 .../unit => unittests}/testcfg/ipc/MissionMessageTypes.h | 0 .../unit => unittests}/testcfg/objects/systemObjectList.h | 0 .../testcfg/pollingsequence/PollingSequenceFactory.cpp | 0 .../testcfg/pollingsequence/PollingSequenceFactory.h | 0 .../unit => unittests}/testcfg/returnvalues/classIds.h | 0 {src/fsfw_tests/unit => unittests}/testcfg/tmtc/apid.h | 0 {src/fsfw_tests/unit => unittests}/testcfg/tmtc/pusIds.h | 0 .../fsfw_tests/unit => unittests}/testtemplate/TestTemplate.cpp | 0 {src/fsfw_tests/unit => unittests}/timemanager/CMakeLists.txt | 0 .../fsfw_tests/unit => unittests}/timemanager/TestCCSDSTime.cpp | 0 .../fsfw_tests/unit => unittests}/timemanager/TestCountdown.cpp | 0 {src/fsfw_tests/unit => unittests}/tmtcpacket/CMakeLists.txt | 0 {src/fsfw_tests/unit => unittests}/tmtcpacket/PusTmTest.cpp | 0 {src/fsfw_tests/unit => unittests}/tmtcpacket/testCcsds.cpp | 0 107 files changed, 1 insertion(+), 1 deletion(-) rename {src/fsfw_tests/unit => unittests}/CMakeLists.txt (96%) rename {src/fsfw_tests/unit => unittests}/CatchDefinitions.cpp (100%) rename {src/fsfw_tests/unit => unittests}/CatchDefinitions.h (100%) rename {src/fsfw_tests/unit => unittests}/CatchFactory.cpp (100%) rename {src/fsfw_tests/unit => unittests}/CatchFactory.h (100%) rename {src/fsfw_tests/unit => unittests}/CatchRunner.cpp (100%) rename {src/fsfw_tests/unit => unittests}/CatchRunner.h (100%) rename {src/fsfw_tests/unit => unittests}/CatchSetup.cpp (100%) rename {src/fsfw_tests/unit => unittests}/action/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/action/TestActionHelper.cpp (100%) rename {src/fsfw_tests/unit => unittests}/action/TestActionHelper.h (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testAckPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testCfdp.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testEofPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testFileData.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testFinishedPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testKeepAlivePdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testMetadataPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testNakPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testPromptPdu.cpp (100%) rename {src/fsfw_tests/unit => unittests}/cfdp/testTlvsLvs.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/container/RingBufferTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestArrayList.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestDynamicFifo.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestFifo.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestFixedArrayList.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestFixedMap.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestFixedOrderedMultimap.cpp (100%) rename {src/fsfw_tests/unit => unittests}/container/TestPlacementFactory.cpp (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/DataSetTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/LocalPoolManagerTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/LocalPoolOwnerBase.h (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/LocalPoolVariableTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/datapoollocal/LocalPoolVectorTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/ComIFMock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/ComIFMock.h (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/CookieIFMock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/CookieIFMock.h (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceFdirMock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceFdirMock.h (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceHandlerCommander.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceHandlerCommander.h (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceHandlerMock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/DeviceHandlerMock.h (100%) rename {src/fsfw_tests/unit => unittests}/devicehandler/TestDeviceHandlerBase.cpp (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/testBitutil.cpp (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/testCRC.cpp (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/testDleEncoder.cpp (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/testOpDivider.cpp (100%) rename {src/fsfw_tests/unit => unittests}/globalfunctions/testTimevalOperations.cpp (100%) rename {src/fsfw_tests/unit => unittests}/hal/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/hal/testCommandExecutor.cpp (100%) rename {src/fsfw_tests/unit => unittests}/internalerror/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/internalerror/TestInternalErrorReporter.cpp (100%) rename {src/fsfw_tests/unit => unittests}/mocks/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/mocks/HkReceiverMock.h (100%) rename {src/fsfw_tests/unit => unittests}/mocks/MessageQueueMockBase.h (100%) rename {src/fsfw_tests/unit => unittests}/mocks/PeriodicTaskIFMock.h (100%) rename {src/fsfw_tests/unit => unittests}/mocks/PowerSwitcherMock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/mocks/PowerSwitcherMock.h (100%) rename {src/fsfw_tests/unit => unittests}/osal/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/osal/TestClock.cpp (100%) rename {src/fsfw_tests/unit => unittests}/osal/TestMessageQueue.cpp (100%) rename {src/fsfw_tests/unit => unittests}/osal/TestSemaphore.cpp (100%) rename {src/fsfw_tests/unit => unittests}/power/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/power/testPowerSwitcher.cpp (100%) rename {src/fsfw_tests/unit => unittests}/printChar.cpp (100%) rename {src/fsfw_tests/unit => unittests}/printChar.h (100%) rename {src/fsfw_tests/unit => unittests}/serialize/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/serialize/TestSerialBufferAdapter.cpp (100%) rename {src/fsfw_tests/unit => unittests}/serialize/TestSerialLinkedPacket.cpp (100%) rename {src/fsfw_tests/unit => unittests}/serialize/TestSerialLinkedPacket.h (100%) rename {src/fsfw_tests/unit => unittests}/serialize/TestSerialization.cpp (100%) rename {src/fsfw_tests/unit => unittests}/storagemanager/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/storagemanager/TestNewAccessor.cpp (100%) rename {src/fsfw_tests/unit => unittests}/storagemanager/TestPool.cpp (100%) rename src/fsfw_tests/unit/version.cpp => unittests/testVersion.cpp (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/FSFWConfig.h.in (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/OBSWConfig.h.in (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/TestsConfig.h.in (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/devices/logicalAddresses.cpp (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/devices/logicalAddresses.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/devices/powerSwitcherList.cpp (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/devices/powerSwitcherList.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/events/subsystemIdRanges.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/ipc/MissionMessageTypes.cpp (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/ipc/MissionMessageTypes.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/objects/systemObjectList.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/pollingsequence/PollingSequenceFactory.cpp (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/pollingsequence/PollingSequenceFactory.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/returnvalues/classIds.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/tmtc/apid.h (100%) rename {src/fsfw_tests/unit => unittests}/testcfg/tmtc/pusIds.h (100%) rename {src/fsfw_tests/unit => unittests}/testtemplate/TestTemplate.cpp (100%) rename {src/fsfw_tests/unit => unittests}/timemanager/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/timemanager/TestCCSDSTime.cpp (100%) rename {src/fsfw_tests/unit => unittests}/timemanager/TestCountdown.cpp (100%) rename {src/fsfw_tests/unit => unittests}/tmtcpacket/CMakeLists.txt (100%) rename {src/fsfw_tests/unit => unittests}/tmtcpacket/PusTmTest.cpp (100%) rename {src/fsfw_tests/unit => unittests}/tmtcpacket/testCcsds.cpp (100%) diff --git a/src/fsfw_tests/unit/CMakeLists.txt b/unittests/CMakeLists.txt similarity index 96% rename from src/fsfw_tests/unit/CMakeLists.txt rename to unittests/CMakeLists.txt index f54e1fc9..49b1840f 100644 --- a/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 diff --git a/src/fsfw_tests/unit/CatchDefinitions.cpp b/unittests/CatchDefinitions.cpp similarity index 100% rename from src/fsfw_tests/unit/CatchDefinitions.cpp rename to unittests/CatchDefinitions.cpp diff --git a/src/fsfw_tests/unit/CatchDefinitions.h b/unittests/CatchDefinitions.h similarity index 100% rename from src/fsfw_tests/unit/CatchDefinitions.h rename to unittests/CatchDefinitions.h diff --git a/src/fsfw_tests/unit/CatchFactory.cpp b/unittests/CatchFactory.cpp similarity index 100% rename from src/fsfw_tests/unit/CatchFactory.cpp rename to unittests/CatchFactory.cpp diff --git a/src/fsfw_tests/unit/CatchFactory.h b/unittests/CatchFactory.h similarity index 100% rename from src/fsfw_tests/unit/CatchFactory.h rename to unittests/CatchFactory.h diff --git a/src/fsfw_tests/unit/CatchRunner.cpp b/unittests/CatchRunner.cpp similarity index 100% rename from src/fsfw_tests/unit/CatchRunner.cpp rename to unittests/CatchRunner.cpp diff --git a/src/fsfw_tests/unit/CatchRunner.h b/unittests/CatchRunner.h similarity index 100% rename from src/fsfw_tests/unit/CatchRunner.h rename to unittests/CatchRunner.h diff --git a/src/fsfw_tests/unit/CatchSetup.cpp b/unittests/CatchSetup.cpp similarity index 100% rename from src/fsfw_tests/unit/CatchSetup.cpp rename to unittests/CatchSetup.cpp diff --git a/src/fsfw_tests/unit/action/CMakeLists.txt b/unittests/action/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/action/CMakeLists.txt rename to unittests/action/CMakeLists.txt diff --git a/src/fsfw_tests/unit/action/TestActionHelper.cpp b/unittests/action/TestActionHelper.cpp similarity index 100% rename from src/fsfw_tests/unit/action/TestActionHelper.cpp rename to unittests/action/TestActionHelper.cpp diff --git a/src/fsfw_tests/unit/action/TestActionHelper.h b/unittests/action/TestActionHelper.h similarity index 100% rename from src/fsfw_tests/unit/action/TestActionHelper.h rename to unittests/action/TestActionHelper.h diff --git a/src/fsfw_tests/unit/cfdp/CMakeLists.txt b/unittests/cfdp/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/cfdp/CMakeLists.txt rename to unittests/cfdp/CMakeLists.txt diff --git a/src/fsfw_tests/unit/cfdp/testAckPdu.cpp b/unittests/cfdp/testAckPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testAckPdu.cpp rename to unittests/cfdp/testAckPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testCfdp.cpp b/unittests/cfdp/testCfdp.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testCfdp.cpp rename to unittests/cfdp/testCfdp.cpp diff --git a/src/fsfw_tests/unit/cfdp/testEofPdu.cpp b/unittests/cfdp/testEofPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testEofPdu.cpp rename to unittests/cfdp/testEofPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testFileData.cpp b/unittests/cfdp/testFileData.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testFileData.cpp rename to unittests/cfdp/testFileData.cpp diff --git a/src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp b/unittests/cfdp/testFinishedPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testFinishedPdu.cpp rename to unittests/cfdp/testFinishedPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp b/unittests/cfdp/testKeepAlivePdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testKeepAlivePdu.cpp rename to unittests/cfdp/testKeepAlivePdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp b/unittests/cfdp/testMetadataPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testMetadataPdu.cpp rename to unittests/cfdp/testMetadataPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testNakPdu.cpp b/unittests/cfdp/testNakPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testNakPdu.cpp rename to unittests/cfdp/testNakPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testPromptPdu.cpp b/unittests/cfdp/testPromptPdu.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testPromptPdu.cpp rename to unittests/cfdp/testPromptPdu.cpp diff --git a/src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp b/unittests/cfdp/testTlvsLvs.cpp similarity index 100% rename from src/fsfw_tests/unit/cfdp/testTlvsLvs.cpp rename to unittests/cfdp/testTlvsLvs.cpp diff --git a/src/fsfw_tests/unit/container/CMakeLists.txt b/unittests/container/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/container/CMakeLists.txt rename to unittests/container/CMakeLists.txt diff --git a/src/fsfw_tests/unit/container/RingBufferTest.cpp b/unittests/container/RingBufferTest.cpp similarity index 100% rename from src/fsfw_tests/unit/container/RingBufferTest.cpp rename to unittests/container/RingBufferTest.cpp diff --git a/src/fsfw_tests/unit/container/TestArrayList.cpp b/unittests/container/TestArrayList.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestArrayList.cpp rename to unittests/container/TestArrayList.cpp diff --git a/src/fsfw_tests/unit/container/TestDynamicFifo.cpp b/unittests/container/TestDynamicFifo.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestDynamicFifo.cpp rename to unittests/container/TestDynamicFifo.cpp diff --git a/src/fsfw_tests/unit/container/TestFifo.cpp b/unittests/container/TestFifo.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestFifo.cpp rename to unittests/container/TestFifo.cpp diff --git a/src/fsfw_tests/unit/container/TestFixedArrayList.cpp b/unittests/container/TestFixedArrayList.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestFixedArrayList.cpp rename to unittests/container/TestFixedArrayList.cpp diff --git a/src/fsfw_tests/unit/container/TestFixedMap.cpp b/unittests/container/TestFixedMap.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestFixedMap.cpp rename to unittests/container/TestFixedMap.cpp diff --git a/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp b/unittests/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp rename to unittests/container/TestFixedOrderedMultimap.cpp diff --git a/src/fsfw_tests/unit/container/TestPlacementFactory.cpp b/unittests/container/TestPlacementFactory.cpp similarity index 100% rename from src/fsfw_tests/unit/container/TestPlacementFactory.cpp rename to unittests/container/TestPlacementFactory.cpp diff --git a/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt b/unittests/datapoollocal/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/CMakeLists.txt rename to unittests/datapoollocal/CMakeLists.txt diff --git a/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/unittests/datapoollocal/DataSetTest.cpp similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp rename to unittests/datapoollocal/DataSetTest.cpp diff --git a/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/unittests/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp rename to unittests/datapoollocal/LocalPoolManagerTest.cpp diff --git a/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp b/unittests/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp rename to unittests/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h b/unittests/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h rename to unittests/datapoollocal/LocalPoolOwnerBase.h diff --git a/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/unittests/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp rename to unittests/datapoollocal/LocalPoolVariableTest.cpp diff --git a/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/unittests/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp rename to unittests/datapoollocal/LocalPoolVectorTest.cpp diff --git a/src/fsfw_tests/unit/devicehandler/CMakeLists.txt b/unittests/devicehandler/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/devicehandler/CMakeLists.txt rename to unittests/devicehandler/CMakeLists.txt diff --git a/src/fsfw_tests/unit/devicehandler/ComIFMock.cpp b/unittests/devicehandler/ComIFMock.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/ComIFMock.cpp rename to unittests/devicehandler/ComIFMock.cpp diff --git a/src/fsfw_tests/unit/devicehandler/ComIFMock.h b/unittests/devicehandler/ComIFMock.h similarity index 100% rename from src/fsfw_tests/unit/devicehandler/ComIFMock.h rename to unittests/devicehandler/ComIFMock.h diff --git a/src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp b/unittests/devicehandler/CookieIFMock.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/CookieIFMock.cpp rename to unittests/devicehandler/CookieIFMock.cpp diff --git a/src/fsfw_tests/unit/devicehandler/CookieIFMock.h b/unittests/devicehandler/CookieIFMock.h similarity index 100% rename from src/fsfw_tests/unit/devicehandler/CookieIFMock.h rename to unittests/devicehandler/CookieIFMock.h diff --git a/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp b/unittests/devicehandler/DeviceFdirMock.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp rename to unittests/devicehandler/DeviceFdirMock.cpp diff --git a/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h b/unittests/devicehandler/DeviceFdirMock.h similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h rename to unittests/devicehandler/DeviceFdirMock.h diff --git a/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp b/unittests/devicehandler/DeviceHandlerCommander.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.cpp rename to unittests/devicehandler/DeviceHandlerCommander.cpp diff --git a/src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h b/unittests/devicehandler/DeviceHandlerCommander.h similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceHandlerCommander.h rename to unittests/devicehandler/DeviceHandlerCommander.h diff --git a/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp b/unittests/devicehandler/DeviceHandlerMock.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.cpp rename to unittests/devicehandler/DeviceHandlerMock.cpp diff --git a/src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h b/unittests/devicehandler/DeviceHandlerMock.h similarity index 100% rename from src/fsfw_tests/unit/devicehandler/DeviceHandlerMock.h rename to unittests/devicehandler/DeviceHandlerMock.h diff --git a/src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp b/unittests/devicehandler/TestDeviceHandlerBase.cpp similarity index 100% rename from src/fsfw_tests/unit/devicehandler/TestDeviceHandlerBase.cpp rename to unittests/devicehandler/TestDeviceHandlerBase.cpp diff --git a/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/unittests/globalfunctions/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/CMakeLists.txt rename to unittests/globalfunctions/CMakeLists.txt diff --git a/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp b/unittests/globalfunctions/testBitutil.cpp similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/testBitutil.cpp rename to unittests/globalfunctions/testBitutil.cpp diff --git a/src/fsfw_tests/unit/globalfunctions/testCRC.cpp b/unittests/globalfunctions/testCRC.cpp similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/testCRC.cpp rename to unittests/globalfunctions/testCRC.cpp diff --git a/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/unittests/globalfunctions/testDleEncoder.cpp similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp rename to unittests/globalfunctions/testDleEncoder.cpp diff --git a/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp b/unittests/globalfunctions/testOpDivider.cpp similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp rename to unittests/globalfunctions/testOpDivider.cpp diff --git a/src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp b/unittests/globalfunctions/testTimevalOperations.cpp similarity index 100% rename from src/fsfw_tests/unit/globalfunctions/testTimevalOperations.cpp rename to unittests/globalfunctions/testTimevalOperations.cpp diff --git a/src/fsfw_tests/unit/hal/CMakeLists.txt b/unittests/hal/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/hal/CMakeLists.txt rename to unittests/hal/CMakeLists.txt diff --git a/src/fsfw_tests/unit/hal/testCommandExecutor.cpp b/unittests/hal/testCommandExecutor.cpp similarity index 100% rename from src/fsfw_tests/unit/hal/testCommandExecutor.cpp rename to unittests/hal/testCommandExecutor.cpp diff --git a/src/fsfw_tests/unit/internalerror/CMakeLists.txt b/unittests/internalerror/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/internalerror/CMakeLists.txt rename to unittests/internalerror/CMakeLists.txt diff --git a/src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp b/unittests/internalerror/TestInternalErrorReporter.cpp similarity index 100% rename from src/fsfw_tests/unit/internalerror/TestInternalErrorReporter.cpp rename to unittests/internalerror/TestInternalErrorReporter.cpp diff --git a/src/fsfw_tests/unit/mocks/CMakeLists.txt b/unittests/mocks/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/mocks/CMakeLists.txt rename to unittests/mocks/CMakeLists.txt diff --git a/src/fsfw_tests/unit/mocks/HkReceiverMock.h b/unittests/mocks/HkReceiverMock.h similarity index 100% rename from src/fsfw_tests/unit/mocks/HkReceiverMock.h rename to unittests/mocks/HkReceiverMock.h diff --git a/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h b/unittests/mocks/MessageQueueMockBase.h similarity index 100% rename from src/fsfw_tests/unit/mocks/MessageQueueMockBase.h rename to unittests/mocks/MessageQueueMockBase.h diff --git a/src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h b/unittests/mocks/PeriodicTaskIFMock.h similarity index 100% rename from src/fsfw_tests/unit/mocks/PeriodicTaskIFMock.h rename to unittests/mocks/PeriodicTaskIFMock.h diff --git a/src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp b/unittests/mocks/PowerSwitcherMock.cpp similarity index 100% rename from src/fsfw_tests/unit/mocks/PowerSwitcherMock.cpp rename to unittests/mocks/PowerSwitcherMock.cpp diff --git a/src/fsfw_tests/unit/mocks/PowerSwitcherMock.h b/unittests/mocks/PowerSwitcherMock.h similarity index 100% rename from src/fsfw_tests/unit/mocks/PowerSwitcherMock.h rename to unittests/mocks/PowerSwitcherMock.h diff --git a/src/fsfw_tests/unit/osal/CMakeLists.txt b/unittests/osal/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/osal/CMakeLists.txt rename to unittests/osal/CMakeLists.txt diff --git a/src/fsfw_tests/unit/osal/TestClock.cpp b/unittests/osal/TestClock.cpp similarity index 100% rename from src/fsfw_tests/unit/osal/TestClock.cpp rename to unittests/osal/TestClock.cpp diff --git a/src/fsfw_tests/unit/osal/TestMessageQueue.cpp b/unittests/osal/TestMessageQueue.cpp similarity index 100% rename from src/fsfw_tests/unit/osal/TestMessageQueue.cpp rename to unittests/osal/TestMessageQueue.cpp diff --git a/src/fsfw_tests/unit/osal/TestSemaphore.cpp b/unittests/osal/TestSemaphore.cpp similarity index 100% rename from src/fsfw_tests/unit/osal/TestSemaphore.cpp rename to unittests/osal/TestSemaphore.cpp diff --git a/src/fsfw_tests/unit/power/CMakeLists.txt b/unittests/power/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/power/CMakeLists.txt rename to unittests/power/CMakeLists.txt diff --git a/src/fsfw_tests/unit/power/testPowerSwitcher.cpp b/unittests/power/testPowerSwitcher.cpp similarity index 100% rename from src/fsfw_tests/unit/power/testPowerSwitcher.cpp rename to unittests/power/testPowerSwitcher.cpp diff --git a/src/fsfw_tests/unit/printChar.cpp b/unittests/printChar.cpp similarity index 100% rename from src/fsfw_tests/unit/printChar.cpp rename to unittests/printChar.cpp diff --git a/src/fsfw_tests/unit/printChar.h b/unittests/printChar.h similarity index 100% rename from src/fsfw_tests/unit/printChar.h rename to unittests/printChar.h diff --git a/src/fsfw_tests/unit/serialize/CMakeLists.txt b/unittests/serialize/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/serialize/CMakeLists.txt rename to unittests/serialize/CMakeLists.txt diff --git a/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp b/unittests/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp rename to unittests/serialize/TestSerialBufferAdapter.cpp diff --git a/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp b/unittests/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp rename to unittests/serialize/TestSerialLinkedPacket.cpp diff --git a/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h b/unittests/serialize/TestSerialLinkedPacket.h similarity index 100% rename from src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h rename to unittests/serialize/TestSerialLinkedPacket.h diff --git a/src/fsfw_tests/unit/serialize/TestSerialization.cpp b/unittests/serialize/TestSerialization.cpp similarity index 100% rename from src/fsfw_tests/unit/serialize/TestSerialization.cpp rename to unittests/serialize/TestSerialization.cpp diff --git a/src/fsfw_tests/unit/storagemanager/CMakeLists.txt b/unittests/storagemanager/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/storagemanager/CMakeLists.txt rename to unittests/storagemanager/CMakeLists.txt diff --git a/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/unittests/storagemanager/TestNewAccessor.cpp similarity index 100% rename from src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp rename to unittests/storagemanager/TestNewAccessor.cpp diff --git a/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/unittests/storagemanager/TestPool.cpp similarity index 100% rename from src/fsfw_tests/unit/storagemanager/TestPool.cpp rename to unittests/storagemanager/TestPool.cpp diff --git a/src/fsfw_tests/unit/version.cpp b/unittests/testVersion.cpp similarity index 100% rename from src/fsfw_tests/unit/version.cpp rename to unittests/testVersion.cpp diff --git a/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/unittests/testcfg/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/testcfg/CMakeLists.txt rename to unittests/testcfg/CMakeLists.txt diff --git a/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/unittests/testcfg/FSFWConfig.h.in similarity index 100% rename from src/fsfw_tests/unit/testcfg/FSFWConfig.h.in rename to unittests/testcfg/FSFWConfig.h.in diff --git a/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in b/unittests/testcfg/OBSWConfig.h.in similarity index 100% rename from src/fsfw_tests/unit/testcfg/OBSWConfig.h.in rename to unittests/testcfg/OBSWConfig.h.in diff --git a/src/fsfw_tests/unit/testcfg/TestsConfig.h.in b/unittests/testcfg/TestsConfig.h.in similarity index 100% rename from src/fsfw_tests/unit/testcfg/TestsConfig.h.in rename to unittests/testcfg/TestsConfig.h.in diff --git a/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp b/unittests/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp rename to unittests/testcfg/devices/logicalAddresses.cpp diff --git a/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h b/unittests/testcfg/devices/logicalAddresses.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h rename to unittests/testcfg/devices/logicalAddresses.h diff --git a/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp b/unittests/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp rename to unittests/testcfg/devices/powerSwitcherList.cpp diff --git a/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h b/unittests/testcfg/devices/powerSwitcherList.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h rename to unittests/testcfg/devices/powerSwitcherList.h diff --git a/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h b/unittests/testcfg/events/subsystemIdRanges.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h rename to unittests/testcfg/events/subsystemIdRanges.h diff --git a/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp b/unittests/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp rename to unittests/testcfg/ipc/MissionMessageTypes.cpp diff --git a/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h b/unittests/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h rename to unittests/testcfg/ipc/MissionMessageTypes.h diff --git a/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/unittests/testcfg/objects/systemObjectList.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/objects/systemObjectList.h rename to unittests/testcfg/objects/systemObjectList.h diff --git a/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp b/unittests/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to unittests/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h b/unittests/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h rename to unittests/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h b/unittests/testcfg/returnvalues/classIds.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/returnvalues/classIds.h rename to unittests/testcfg/returnvalues/classIds.h diff --git a/src/fsfw_tests/unit/testcfg/tmtc/apid.h b/unittests/testcfg/tmtc/apid.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/tmtc/apid.h rename to unittests/testcfg/tmtc/apid.h diff --git a/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h b/unittests/testcfg/tmtc/pusIds.h similarity index 100% rename from src/fsfw_tests/unit/testcfg/tmtc/pusIds.h rename to unittests/testcfg/tmtc/pusIds.h diff --git a/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp b/unittests/testtemplate/TestTemplate.cpp similarity index 100% rename from src/fsfw_tests/unit/testtemplate/TestTemplate.cpp rename to unittests/testtemplate/TestTemplate.cpp diff --git a/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/unittests/timemanager/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/timemanager/CMakeLists.txt rename to unittests/timemanager/CMakeLists.txt diff --git a/src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp b/unittests/timemanager/TestCCSDSTime.cpp similarity index 100% rename from src/fsfw_tests/unit/timemanager/TestCCSDSTime.cpp rename to unittests/timemanager/TestCCSDSTime.cpp diff --git a/src/fsfw_tests/unit/timemanager/TestCountdown.cpp b/unittests/timemanager/TestCountdown.cpp similarity index 100% rename from src/fsfw_tests/unit/timemanager/TestCountdown.cpp rename to unittests/timemanager/TestCountdown.cpp diff --git a/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt b/unittests/tmtcpacket/CMakeLists.txt similarity index 100% rename from src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt rename to unittests/tmtcpacket/CMakeLists.txt diff --git a/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp b/unittests/tmtcpacket/PusTmTest.cpp similarity index 100% rename from src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp rename to unittests/tmtcpacket/PusTmTest.cpp diff --git a/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp b/unittests/tmtcpacket/testCcsds.cpp similarity index 100% rename from src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp rename to unittests/tmtcpacket/testCcsds.cpp From fdf35232eeee6d0cfb527b66d01a85e97e949d1e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 11:47:00 +0200 Subject: [PATCH 37/74] some fixes --- CMakeLists.txt | 7 +++---- src/fsfw_tests/CMakeLists.txt | 4 +--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dcfa89ae..f38eacff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,10 +163,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}) diff --git a/src/fsfw_tests/CMakeLists.txt b/src/fsfw_tests/CMakeLists.txt index f6e1b8ab..8e047e73 100644 --- a/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_UNITTESTS) add_subdirectory(integration) endif() From 78b09ed0c94f4a3517bfafa69e8cc7191736ae8c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 11:58:55 +0200 Subject: [PATCH 38/74] fixes includes --- CMakeLists.txt | 13 ++++++++----- scripts/helper.py | 4 ++-- src/fsfw_tests/CMakeLists.txt | 2 +- unittests/CMakeLists.txt | 2 ++ unittests/action/TestActionHelper.cpp | 2 +- unittests/action/TestActionHelper.h | 2 +- unittests/cfdp/testCfdp.cpp | 2 +- unittests/container/RingBufferTest.cpp | 2 +- unittests/container/TestArrayList.cpp | 2 +- unittests/container/TestDynamicFifo.cpp | 2 +- unittests/container/TestFifo.cpp | 2 +- unittests/container/TestFixedArrayList.cpp | 2 +- unittests/container/TestFixedMap.cpp | 2 +- unittests/container/TestFixedOrderedMultimap.cpp | 2 +- unittests/container/TestPlacementFactory.cpp | 2 +- unittests/datapoollocal/DataSetTest.cpp | 2 +- unittests/datapoollocal/LocalPoolManagerTest.cpp | 2 +- unittests/datapoollocal/LocalPoolVariableTest.cpp | 4 ++-- unittests/datapoollocal/LocalPoolVectorTest.cpp | 2 +- unittests/devicehandler/DeviceFdirMock.cpp | 2 +- unittests/devicehandler/TestDeviceHandlerBase.cpp | 10 +++++----- unittests/globalfunctions/testCRC.cpp | 2 +- unittests/globalfunctions/testDleEncoder.cpp | 2 +- unittests/globalfunctions/testTimevalOperations.cpp | 2 +- .../internalerror/TestInternalErrorReporter.cpp | 6 +++--- unittests/mocks/MessageQueueMockBase.h | 2 +- unittests/osal/TestClock.cpp | 2 +- unittests/osal/TestMessageQueue.cpp | 2 +- unittests/power/testPowerSwitcher.cpp | 2 +- unittests/serialize/TestSerialBufferAdapter.cpp | 2 +- unittests/serialize/TestSerialLinkedPacket.cpp | 2 +- unittests/serialize/TestSerialization.cpp | 2 +- unittests/storagemanager/TestNewAccessor.cpp | 2 +- unittests/storagemanager/TestPool.cpp | 2 +- unittests/testVersion.cpp | 2 +- unittests/timemanager/TestCCSDSTime.cpp | 4 ++-- unittests/timemanager/TestCountdown.cpp | 2 +- 37 files changed, 54 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f38eacff..ae1a621e 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() @@ -140,7 +140,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" @@ -163,7 +163,7 @@ if(FSFW_BUILD_UNITTESTS) list(APPEND FSFW_FETCH_CONTENT_TARGETS Catch2) endif() - set(FSFW_CONFIG_PATH unittests/testcfg/) + 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) @@ -282,11 +282,14 @@ message( add_subdirectory(src) 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/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/fsfw_tests/CMakeLists.txt b/src/fsfw_tests/CMakeLists.txt index 8e047e73..5e16e0a7 100644 --- a/src/fsfw_tests/CMakeLists.txt +++ b/src/fsfw_tests/CMakeLists.txt @@ -2,6 +2,6 @@ if(FSFW_ADD_INTERNAL_TESTS) add_subdirectory(internal) endif() -if(NOT FSFW_BUILD_UNITTESTS) +if(NOT FSFW_BUILD_TESTS) add_subdirectory(integration) endif() diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 49b1840f..f32c6e08 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -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/unittests/action/TestActionHelper.cpp b/unittests/action/TestActionHelper.cpp index 923b7436..6461a195 100644 --- a/unittests/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/unittests/action/TestActionHelper.h b/unittests/action/TestActionHelper.h index 243f030a..75a9f3fe 100644 --- a/unittests/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/unittests/cfdp/testCfdp.cpp b/unittests/cfdp/testCfdp.cpp index 19b1ec7f..6ca95fbc 100644 --- a/unittests/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/unittests/container/RingBufferTest.cpp b/unittests/container/RingBufferTest.cpp index a83fa2ac..ff5db76b 100644 --- a/unittests/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/unittests/container/TestArrayList.cpp b/unittests/container/TestArrayList.cpp index 2c5a37d9..4daf59d4 100644 --- a/unittests/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/unittests/container/TestDynamicFifo.cpp b/unittests/container/TestDynamicFifo.cpp index 540ea31e..6769c247 100644 --- a/unittests/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/unittests/container/TestFifo.cpp b/unittests/container/TestFifo.cpp index a9eb7956..0b4b41af 100644 --- a/unittests/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/unittests/container/TestFixedArrayList.cpp b/unittests/container/TestFixedArrayList.cpp index 42ae01d5..6beb8d5d 100644 --- a/unittests/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/unittests/container/TestFixedMap.cpp b/unittests/container/TestFixedMap.cpp index 4c3cad1e..d3c65760 100644 --- a/unittests/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/unittests/container/TestFixedOrderedMultimap.cpp b/unittests/container/TestFixedOrderedMultimap.cpp index 7dd63b34..88b32694 100644 --- a/unittests/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/unittests/container/TestPlacementFactory.cpp b/unittests/container/TestPlacementFactory.cpp index 0140ce05..1333567e 100644 --- a/unittests/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/unittests/datapoollocal/DataSetTest.cpp b/unittests/datapoollocal/DataSetTest.cpp index 902d59ef..c56ed768 100644 --- a/unittests/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/unittests/datapoollocal/LocalPoolManagerTest.cpp b/unittests/datapoollocal/LocalPoolManagerTest.cpp index f2a5c18a..019c9b59 100644 --- a/unittests/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/unittests/datapoollocal/LocalPoolVariableTest.cpp b/unittests/datapoollocal/LocalPoolVariableTest.cpp index 73d51d92..86bd6a1e 100644 --- a/unittests/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/unittests/datapoollocal/LocalPoolVectorTest.cpp b/unittests/datapoollocal/LocalPoolVectorTest.cpp index 5932db44..3a06c826 100644 --- a/unittests/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/unittests/devicehandler/DeviceFdirMock.cpp b/unittests/devicehandler/DeviceFdirMock.cpp index dfef7cd3..e3ac39ac 100644 --- a/unittests/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/unittests/devicehandler/TestDeviceHandlerBase.cpp b/unittests/devicehandler/TestDeviceHandlerBase.cpp index e82a39b7..328bc4dc 100644 --- a/unittests/devicehandler/TestDeviceHandlerBase.cpp +++ b/unittests/devicehandler/TestDeviceHandlerBase.cpp @@ -2,14 +2,14 @@ #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" +#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 - CookieIFMock* cookieIFMock = new CookieIFMock; + 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, diff --git a/unittests/globalfunctions/testCRC.cpp b/unittests/globalfunctions/testCRC.cpp index b163ea1f..884bd281 100644 --- a/unittests/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/unittests/globalfunctions/testDleEncoder.cpp b/unittests/globalfunctions/testDleEncoder.cpp index 034cb3a0..1ccaddb5 100644 --- a/unittests/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/unittests/globalfunctions/testTimevalOperations.cpp b/unittests/globalfunctions/testTimevalOperations.cpp index 347d2204..155e6b15 100644 --- a/unittests/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/unittests/internalerror/TestInternalErrorReporter.cpp b/unittests/internalerror/TestInternalErrorReporter.cpp index a993fff6..b52c5336 100644 --- a/unittests/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/unittests/mocks/MessageQueueMockBase.h b/unittests/mocks/MessageQueueMockBase.h index 4236593e..60a942d9 100644 --- a/unittests/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/unittests/osal/TestClock.cpp b/unittests/osal/TestClock.cpp index 38ec3915..9979b28c 100644 --- a/unittests/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/unittests/osal/TestMessageQueue.cpp b/unittests/osal/TestMessageQueue.cpp index 11c0739b..df15b33d 100644 --- a/unittests/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/unittests/power/testPowerSwitcher.cpp b/unittests/power/testPowerSwitcher.cpp index 941055ac..cf2f2148 100644 --- a/unittests/power/testPowerSwitcher.cpp +++ b/unittests/power/testPowerSwitcher.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include "mocks/PowerSwitcherMock.h" #include diff --git a/unittests/serialize/TestSerialBufferAdapter.cpp b/unittests/serialize/TestSerialBufferAdapter.cpp index 9b30427f..2aa76ec8 100644 --- a/unittests/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/unittests/serialize/TestSerialLinkedPacket.cpp b/unittests/serialize/TestSerialLinkedPacket.cpp index e3bdf882..2d6e476f 100644 --- a/unittests/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/unittests/serialize/TestSerialization.cpp b/unittests/serialize/TestSerialization.cpp index 52cb70f6..a3340a7d 100644 --- a/unittests/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/unittests/storagemanager/TestNewAccessor.cpp b/unittests/storagemanager/TestNewAccessor.cpp index 7b90c86e..2cc2e469 100644 --- a/unittests/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/unittests/storagemanager/TestPool.cpp b/unittests/storagemanager/TestPool.cpp index 51130047..e37c6934 100644 --- a/unittests/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/unittests/testVersion.cpp b/unittests/testVersion.cpp index 662b1290..e0b9897b 100644 --- a/unittests/testVersion.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/unittests/timemanager/TestCCSDSTime.cpp b/unittests/timemanager/TestCCSDSTime.cpp index e96ddfc9..9c457dda 100644 --- a/unittests/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/unittests/timemanager/TestCountdown.cpp b/unittests/timemanager/TestCountdown.cpp index bc39b02e..d0af659d 100644 --- a/unittests/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"); From 6e5239e9a04d1dd13f768d91e74638af69b3883c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 14:36:40 +0200 Subject: [PATCH 39/74] update jenkinsfile --- automation/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ..' } } } From f6ede7cd3e656ee51e73efab12e3e74937b51905 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 14:46:36 +0200 Subject: [PATCH 40/74] bump version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9e3e471..bfdf878e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ list(APPEND CMAKE_MODULE_PATH # Version file handling # # ############################################################################## -set(FSFW_VERSION_IF_GIT_FAILS 4) +set(FSFW_VERSION_IF_GIT_FAILS 5) set(FSFW_SUBVERSION_IF_GIT_FAILS 0) set(FSFW_REVISION_IF_GIT_FAILS 0) From 8b6dd3f86822a0df7de896b180c9cca891696bad Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 14:49:27 +0200 Subject: [PATCH 41/74] add date to changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394f1e45..80fa81aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] -# [v5.0.0] +# [v5.0.0] 18.07.2022 ## Changes From 428018e4f19852fac3e92fa4360d19c79936828f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 14:58:47 +0200 Subject: [PATCH 42/74] update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394f1e45..3854dc79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). creation call. It allows passing context information and an arbitrary user argument into 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` + PR: https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/653 ### Task Module Refactoring From 91067cde981bfa47cce8ed9138a5fbd6e047bb3f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 15:00:40 +0200 Subject: [PATCH 43/74] typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 74794bb71ba2ee538fe744883b1a7de7435caabb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Jul 2022 16:08:06 +0200 Subject: [PATCH 44/74] apply auto-formatter --- CMakeLists.txt | 4 +-- scripts/auto-formatter.sh | 3 +- src/fsfw/osal/linux/MessageQueue.cpp | 3 +- src/fsfw_hal/CMakeLists.txt | 4 +-- src/fsfw_hal/common/gpio/CMakeLists.txt | 4 +-- src/fsfw_hal/devicehandlers/CMakeLists.txt | 8 ++--- src/fsfw_hal/linux/CMakeLists.txt | 30 ++++++++----------- src/fsfw_hal/linux/gpio/CMakeLists.txt | 18 +++++------ src/fsfw_hal/linux/i2c/CMakeLists.txt | 9 +----- src/fsfw_hal/linux/rpi/CMakeLists.txt | 4 +-- src/fsfw_hal/linux/spi/CMakeLists.txt | 9 +----- src/fsfw_hal/linux/uart/CMakeLists.txt | 5 +--- src/fsfw_hal/linux/uio/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/CMakeLists.txt | 4 +-- .../stm32h7/devicetest/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/gpio/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/i2c/CMakeLists.txt | 3 +- src/fsfw_hal/stm32h7/spi/CMakeLists.txt | 18 +++++------ src/fsfw_hal/stm32h7/uart/CMakeLists.txt | 3 +- src/fsfw_tests/CMakeLists.txt | 4 +-- .../integration/assemblies/CMakeLists.txt | 4 +-- .../integration/controller/CMakeLists.txt | 4 +-- .../integration/devices/CMakeLists.txt | 7 ++--- .../integration/task/CMakeLists.txt | 4 +-- src/fsfw_tests/internal/CMakeLists.txt | 8 ++--- .../internal/globalfunctions/CMakeLists.txt | 4 +-- src/fsfw_tests/internal/osal/CMakeLists.txt | 7 ++--- .../internal/serialize/CMakeLists.txt | 4 +-- unittests/cfdp/testCfdp.cpp | 2 +- unittests/datapoollocal/DataSetTest.cpp | 2 +- .../datapoollocal/LocalPoolManagerTest.cpp | 2 +- .../datapoollocal/LocalPoolVariableTest.cpp | 2 +- .../datapoollocal/LocalPoolVectorTest.cpp | 2 +- .../devicehandler/TestDeviceHandlerBase.cpp | 2 +- unittests/globalfunctions/testCRC.cpp | 2 +- unittests/globalfunctions/testDleEncoder.cpp | 2 +- .../TestInternalErrorReporter.cpp | 2 +- unittests/mocks/MessageQueueMockBase.h | 2 +- unittests/power/testPowerSwitcher.cpp | 2 +- unittests/testVersion.cpp | 5 ++-- 40 files changed, 77 insertions(+), 137 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f74be01d..cfae2acb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,8 +104,8 @@ if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() -option(FSFW_BUILD_TESTS - "Build unittest binary in addition to static library" OFF) +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_TESTS) diff --git a/scripts/auto-formatter.sh b/scripts/auto-formatter.sh index 405d1268..c0ae7099 100755 --- a/scripts/auto-formatter.sh +++ b/scripts/auto-formatter.sh @@ -16,8 +16,7 @@ cpp_format="clang-format" file_selectors="-iname *.h -o -iname *.cpp -o -iname *.c -o -iname *.tpp" if command -v ${cpp_format} &> /dev/null; then find ./src ${file_selectors} | xargs ${cpp_format} --style=file -i - find ./hal ${file_selectors} | xargs ${cpp_format} --style=file -i - find ./tests ${file_selectors} | xargs ${cpp_format} --style=file -i + find ./unittests ${file_selectors} | xargs ${cpp_format} --style=file -i else echo "No ${cpp_format} tool found, not formatting C++/C files" fi diff --git a/src/fsfw/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp index 4ef7f756..ec212165 100644 --- a/src/fsfw/osal/linux/MessageQueue.cpp +++ b/src/fsfw/osal/linux/MessageQueue.cpp @@ -292,7 +292,8 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg << " is too small for requested message depth " << messageDepth << std::endl; sif::error << "This error can be fixed by setting the maximum " - "allowed message depth higher" << std::endl; + "allowed message depth higher" + << std::endl; #else sif::printError( "MessageQueue::MessageQueue: Default MQ size %d is too small for" diff --git a/src/fsfw_hal/CMakeLists.txt b/src/fsfw_hal/CMakeLists.txt index b7559d4b..057ab3a6 100644 --- a/src/fsfw_hal/CMakeLists.txt +++ b/src/fsfw_hal/CMakeLists.txt @@ -2,9 +2,9 @@ add_subdirectory(devicehandlers) add_subdirectory(common) if(UNIX) - add_subdirectory(linux) + add_subdirectory(linux) endif() if(FSFW_HAL_ADD_STM32H7) - add_subdirectory(stm32h7) + add_subdirectory(stm32h7) endif() diff --git a/src/fsfw_hal/common/gpio/CMakeLists.txt b/src/fsfw_hal/common/gpio/CMakeLists.txt index 098c05fa..5c81d9cc 100644 --- a/src/fsfw_hal/common/gpio/CMakeLists.txt +++ b/src/fsfw_hal/common/gpio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GpioCookie.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GpioCookie.cpp) diff --git a/src/fsfw_hal/devicehandlers/CMakeLists.txt b/src/fsfw_hal/devicehandlers/CMakeLists.txt index 94e67c72..17139416 100644 --- a/src/fsfw_hal/devicehandlers/CMakeLists.txt +++ b/src/fsfw_hal/devicehandlers/CMakeLists.txt @@ -1,5 +1,3 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GyroL3GD20Handler.cpp - MgmRM3100Handler.cpp - MgmLIS3MDLHandler.cpp -) +target_sources( + ${LIB_FSFW_NAME} PRIVATE GyroL3GD20Handler.cpp MgmRM3100Handler.cpp + MgmLIS3MDLHandler.cpp) diff --git a/src/fsfw_hal/linux/CMakeLists.txt b/src/fsfw_hal/linux/CMakeLists.txt index f6d1a460..ffa5f5ee 100644 --- a/src/fsfw_hal/linux/CMakeLists.txt +++ b/src/fsfw_hal/linux/CMakeLists.txt @@ -1,25 +1,21 @@ if(FSFW_HAL_ADD_RASPBERRY_PI) - add_subdirectory(rpi) + add_subdirectory(rpi) endif() -target_sources(${LIB_FSFW_NAME} PRIVATE - UnixFileGuard.cpp - CommandExecutor.cpp - utility.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE UnixFileGuard.cpp CommandExecutor.cpp + utility.cpp) if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS) -if(FSFW_HAL_LINUX_ADD_LIBGPIOD) - add_subdirectory(gpio) -endif() - add_subdirectory(uart) - # Adding those does not really make sense on Apple systems which - # are generally host systems. It won't even compile as the headers - # are missing - if(NOT APPLE) - add_subdirectory(i2c) - add_subdirectory(spi) - endif() + if(FSFW_HAL_LINUX_ADD_LIBGPIOD) + add_subdirectory(gpio) + endif() + add_subdirectory(uart) + # Adding those does not really make sense on Apple systems which are generally + # host systems. It won't even compile as the headers are missing + if(NOT APPLE) + add_subdirectory(i2c) + add_subdirectory(spi) + endif() endif() add_subdirectory(uio) diff --git a/src/fsfw_hal/linux/gpio/CMakeLists.txt b/src/fsfw_hal/linux/gpio/CMakeLists.txt index b1609850..f6e7f2b0 100644 --- a/src/fsfw_hal/linux/gpio/CMakeLists.txt +++ b/src/fsfw_hal/linux/gpio/CMakeLists.txt @@ -1,16 +1,12 @@ -# This abstraction layer requires the gpiod library. You can install this library -# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need -# to install the package before syncing the sysroot to your host computer. +# This abstraction layer requires the gpiod library. You can install this +# library with "sudo apt-get install -y libgpiod-dev". If you are +# cross-compiling, you need to install the package before syncing the sysroot to +# your host computer. find_library(LIB_GPIO gpiod) if(${LIB_GPIO} MATCHES LIB_GPIO-NOTFOUND) - message(STATUS "gpiod library not found, not linking against it") + message(STATUS "gpiod library not found, not linking against it") else() - target_sources(${LIB_FSFW_NAME} PRIVATE - LinuxLibgpioIF.cpp - ) - target_link_libraries(${LIB_FSFW_NAME} PRIVATE - ${LIB_GPIO} - ) + target_sources(${LIB_FSFW_NAME} PRIVATE LinuxLibgpioIF.cpp) + target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_GPIO}) endif() - diff --git a/src/fsfw_hal/linux/i2c/CMakeLists.txt b/src/fsfw_hal/linux/i2c/CMakeLists.txt index 3eb0882c..b94bdc99 100644 --- a/src/fsfw_hal/linux/i2c/CMakeLists.txt +++ b/src/fsfw_hal/linux/i2c/CMakeLists.txt @@ -1,8 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - I2cComIF.cpp - I2cCookie.cpp -) - - - - +target_sources(${LIB_FSFW_NAME} PUBLIC I2cComIF.cpp I2cCookie.cpp) diff --git a/src/fsfw_hal/linux/rpi/CMakeLists.txt b/src/fsfw_hal/linux/rpi/CMakeLists.txt index 47be218c..3a865037 100644 --- a/src/fsfw_hal/linux/rpi/CMakeLists.txt +++ b/src/fsfw_hal/linux/rpi/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GpioRPi.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GpioRPi.cpp) diff --git a/src/fsfw_hal/linux/spi/CMakeLists.txt b/src/fsfw_hal/linux/spi/CMakeLists.txt index 404e1f47..f242bb3b 100644 --- a/src/fsfw_hal/linux/spi/CMakeLists.txt +++ b/src/fsfw_hal/linux/spi/CMakeLists.txt @@ -1,8 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - SpiComIF.cpp - SpiCookie.cpp -) - - - - +target_sources(${LIB_FSFW_NAME} PUBLIC SpiComIF.cpp SpiCookie.cpp) diff --git a/src/fsfw_hal/linux/uart/CMakeLists.txt b/src/fsfw_hal/linux/uart/CMakeLists.txt index 21ed0278..9cad62a4 100644 --- a/src/fsfw_hal/linux/uart/CMakeLists.txt +++ b/src/fsfw_hal/linux/uart/CMakeLists.txt @@ -1,4 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - UartComIF.cpp - UartCookie.cpp -) +target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp) diff --git a/src/fsfw_hal/linux/uio/CMakeLists.txt b/src/fsfw_hal/linux/uio/CMakeLists.txt index e98a0865..e3498246 100644 --- a/src/fsfw_hal/linux/uio/CMakeLists.txt +++ b/src/fsfw_hal/linux/uio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - UioMapper.cpp -) +target_sources(${LIB_FSFW_NAME} PUBLIC UioMapper.cpp) diff --git a/src/fsfw_hal/stm32h7/CMakeLists.txt b/src/fsfw_hal/stm32h7/CMakeLists.txt index bae3b1ac..e8843ed3 100644 --- a/src/fsfw_hal/stm32h7/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/CMakeLists.txt @@ -2,6 +2,4 @@ add_subdirectory(spi) add_subdirectory(gpio) add_subdirectory(devicetest) -target_sources(${LIB_FSFW_NAME} PRIVATE - dma.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE dma.cpp) diff --git a/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt b/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt index 7bd4c3a9..8e789ddb 100644 --- a/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GyroL3GD20H.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20H.cpp) diff --git a/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt b/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt index 35245b25..54d76b2d 100644 --- a/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - gpio.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE gpio.cpp) diff --git a/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt b/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt index 5ecb0990..a0d48465 100644 --- a/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt @@ -1,2 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE -) +target_sources(${LIB_FSFW_NAME} PRIVATE) diff --git a/src/fsfw_hal/stm32h7/spi/CMakeLists.txt b/src/fsfw_hal/stm32h7/spi/CMakeLists.txt index aa5541bc..9a98f502 100644 --- a/src/fsfw_hal/stm32h7/spi/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/spi/CMakeLists.txt @@ -1,9 +1,9 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - spiCore.cpp - spiDefinitions.cpp - spiInterrupts.cpp - mspInit.cpp - SpiCookie.cpp - SpiComIF.cpp - stm32h743zi.cpp -) +target_sources( + ${LIB_FSFW_NAME} + PRIVATE spiCore.cpp + spiDefinitions.cpp + spiInterrupts.cpp + mspInit.cpp + SpiCookie.cpp + SpiComIF.cpp + stm32h743zi.cpp) diff --git a/src/fsfw_hal/stm32h7/uart/CMakeLists.txt b/src/fsfw_hal/stm32h7/uart/CMakeLists.txt index 5ecb0990..a0d48465 100644 --- a/src/fsfw_hal/stm32h7/uart/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/uart/CMakeLists.txt @@ -1,2 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE -) +target_sources(${LIB_FSFW_NAME} PRIVATE) diff --git a/src/fsfw_tests/CMakeLists.txt b/src/fsfw_tests/CMakeLists.txt index 5e16e0a7..d161699a 100644 --- a/src/fsfw_tests/CMakeLists.txt +++ b/src/fsfw_tests/CMakeLists.txt @@ -1,7 +1,7 @@ if(FSFW_ADD_INTERNAL_TESTS) - add_subdirectory(internal) + add_subdirectory(internal) endif() if(NOT FSFW_BUILD_TESTS) - add_subdirectory(integration) + add_subdirectory(integration) endif() diff --git a/src/fsfw_tests/integration/assemblies/CMakeLists.txt b/src/fsfw_tests/integration/assemblies/CMakeLists.txt index 22c06600..63a6447a 100644 --- a/src/fsfw_tests/integration/assemblies/CMakeLists.txt +++ b/src/fsfw_tests/integration/assemblies/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestAssembly.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestAssembly.cpp) diff --git a/src/fsfw_tests/integration/controller/CMakeLists.txt b/src/fsfw_tests/integration/controller/CMakeLists.txt index f5655b71..5eeb5c68 100644 --- a/src/fsfw_tests/integration/controller/CMakeLists.txt +++ b/src/fsfw_tests/integration/controller/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestController.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestController.cpp) diff --git a/src/fsfw_tests/integration/devices/CMakeLists.txt b/src/fsfw_tests/integration/devices/CMakeLists.txt index cfd238d2..d5799197 100644 --- a/src/fsfw_tests/integration/devices/CMakeLists.txt +++ b/src/fsfw_tests/integration/devices/CMakeLists.txt @@ -1,5 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestCookie.cpp - TestDeviceHandler.cpp - TestEchoComIF.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE TestCookie.cpp TestDeviceHandler.cpp + TestEchoComIF.cpp) diff --git a/src/fsfw_tests/integration/task/CMakeLists.txt b/src/fsfw_tests/integration/task/CMakeLists.txt index 4cd481bf..62d5e8ef 100644 --- a/src/fsfw_tests/integration/task/CMakeLists.txt +++ b/src/fsfw_tests/integration/task/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestTask.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestTask.cpp) diff --git a/src/fsfw_tests/internal/CMakeLists.txt b/src/fsfw_tests/internal/CMakeLists.txt index 2a144a9b..c1af5467 100644 --- a/src/fsfw_tests/internal/CMakeLists.txt +++ b/src/fsfw_tests/internal/CMakeLists.txt @@ -1,8 +1,6 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - InternalUnitTester.cpp - UnittDefinitions.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE InternalUnitTester.cpp + UnittDefinitions.cpp) add_subdirectory(osal) add_subdirectory(serialize) -add_subdirectory(globalfunctions) \ No newline at end of file +add_subdirectory(globalfunctions) diff --git a/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt b/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt index cde97734..6e7e58ad 100644 --- a/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt +++ b/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestArrayPrinter.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE TestArrayPrinter.cpp) diff --git a/src/fsfw_tests/internal/osal/CMakeLists.txt b/src/fsfw_tests/internal/osal/CMakeLists.txt index 8d79d759..db1031a0 100644 --- a/src/fsfw_tests/internal/osal/CMakeLists.txt +++ b/src/fsfw_tests/internal/osal/CMakeLists.txt @@ -1,5 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - testMq.cpp - testMutex.cpp - testSemaphore.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE testMq.cpp testMutex.cpp + testSemaphore.cpp) diff --git a/src/fsfw_tests/internal/serialize/CMakeLists.txt b/src/fsfw_tests/internal/serialize/CMakeLists.txt index 47e8b538..ee264d9d 100644 --- a/src/fsfw_tests/internal/serialize/CMakeLists.txt +++ b/src/fsfw_tests/internal/serialize/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - IntTestSerialization.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE IntTestSerialization.cpp) diff --git a/unittests/cfdp/testCfdp.cpp b/unittests/cfdp/testCfdp.cpp index 6ca95fbc..78ef618b 100644 --- a/unittests/cfdp/testCfdp.cpp +++ b/unittests/cfdp/testCfdp.cpp @@ -2,6 +2,7 @@ #include #include +#include "CatchDefinitions.h" #include "fsfw/cfdp/FileSize.h" #include "fsfw/cfdp/pdu/FileDirectiveDeserializer.h" #include "fsfw/cfdp/pdu/FileDirectiveSerializer.h" @@ -9,7 +10,6 @@ #include "fsfw/cfdp/pdu/HeaderSerializer.h" #include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/serialize/SerializeAdapter.h" -#include "CatchDefinitions.h" TEST_CASE("CFDP Base", "[CfdpBase]") { using namespace cfdp; diff --git a/unittests/datapoollocal/DataSetTest.cpp b/unittests/datapoollocal/DataSetTest.cpp index c56ed768..c9f023ef 100644 --- a/unittests/datapoollocal/DataSetTest.cpp +++ b/unittests/datapoollocal/DataSetTest.cpp @@ -8,8 +8,8 @@ #include #include -#include "LocalPoolOwnerBase.h" #include "CatchDefinitions.h" +#include "LocalPoolOwnerBase.h" #include "tests/TestsConfig.h" TEST_CASE("DataSetTest", "[DataSetTest]") { diff --git a/unittests/datapoollocal/LocalPoolManagerTest.cpp b/unittests/datapoollocal/LocalPoolManagerTest.cpp index 019c9b59..58a6065e 100644 --- a/unittests/datapoollocal/LocalPoolManagerTest.cpp +++ b/unittests/datapoollocal/LocalPoolManagerTest.cpp @@ -11,8 +11,8 @@ #include #include -#include "LocalPoolOwnerBase.h" #include "CatchDefinitions.h" +#include "LocalPoolOwnerBase.h" TEST_CASE("LocalPoolManagerTest", "[LocManTest]") { LocalPoolOwnerBase* poolOwner = diff --git a/unittests/datapoollocal/LocalPoolVariableTest.cpp b/unittests/datapoollocal/LocalPoolVariableTest.cpp index 86bd6a1e..3479cdbe 100644 --- a/unittests/datapoollocal/LocalPoolVariableTest.cpp +++ b/unittests/datapoollocal/LocalPoolVariableTest.cpp @@ -3,8 +3,8 @@ #include -#include "LocalPoolOwnerBase.h" #include "CatchDefinitions.h" +#include "LocalPoolOwnerBase.h" #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { diff --git a/unittests/datapoollocal/LocalPoolVectorTest.cpp b/unittests/datapoollocal/LocalPoolVectorTest.cpp index 3a06c826..2235ad39 100644 --- a/unittests/datapoollocal/LocalPoolVectorTest.cpp +++ b/unittests/datapoollocal/LocalPoolVectorTest.cpp @@ -3,8 +3,8 @@ #include -#include "LocalPoolOwnerBase.h" #include "CatchDefinitions.h" +#include "LocalPoolOwnerBase.h" #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { diff --git a/unittests/devicehandler/TestDeviceHandlerBase.cpp b/unittests/devicehandler/TestDeviceHandlerBase.cpp index 328bc4dc..e8fdd17b 100644 --- a/unittests/devicehandler/TestDeviceHandlerBase.cpp +++ b/unittests/devicehandler/TestDeviceHandlerBase.cpp @@ -2,9 +2,9 @@ #include "ComIFMock.h" #include "DeviceFdirMock.h" -#include "devicehandler/CookieIFMock.h" #include "DeviceHandlerCommander.h" #include "DeviceHandlerMock.h" +#include "devicehandler/CookieIFMock.h" #include "objects/systemObjectList.h" TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") { diff --git a/unittests/globalfunctions/testCRC.cpp b/unittests/globalfunctions/testCRC.cpp index 884bd281..2b6de4db 100644 --- a/unittests/globalfunctions/testCRC.cpp +++ b/unittests/globalfunctions/testCRC.cpp @@ -1,8 +1,8 @@ #include +#include "CatchDefinitions.h" #include "catch2/catch_test_macros.hpp" #include "fsfw/globalfunctions/CRC.h" -#include "CatchDefinitions.h" TEST_CASE("CRC", "[CRC]") { std::array testData = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; diff --git a/unittests/globalfunctions/testDleEncoder.cpp b/unittests/globalfunctions/testDleEncoder.cpp index 1ccaddb5..0c707f4c 100644 --- a/unittests/globalfunctions/testDleEncoder.cpp +++ b/unittests/globalfunctions/testDleEncoder.cpp @@ -1,8 +1,8 @@ #include +#include "CatchDefinitions.h" #include "catch2/catch_test_macros.hpp" #include "fsfw/globalfunctions/DleEncoder.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/unittests/internalerror/TestInternalErrorReporter.cpp b/unittests/internalerror/TestInternalErrorReporter.cpp index b52c5336..2b999fae 100644 --- a/unittests/internalerror/TestInternalErrorReporter.cpp +++ b/unittests/internalerror/TestInternalErrorReporter.cpp @@ -8,11 +8,11 @@ #include #include +#include "CatchDefinitions.h" #include "fsfw/action/ActionMessage.h" #include "fsfw/ipc/CommandMessage.h" #include "fsfw/ipc/MessageQueueMessage.h" #include "fsfw/objectmanager/frameworkObjects.h" -#include "CatchDefinitions.h" #include "mocks/PeriodicTaskIFMock.h" TEST_CASE("Internal Error Reporter", "[TestInternalError]") { diff --git a/unittests/mocks/MessageQueueMockBase.h b/unittests/mocks/MessageQueueMockBase.h index 60a942d9..d3323186 100644 --- a/unittests/mocks/MessageQueueMockBase.h +++ b/unittests/mocks/MessageQueueMockBase.h @@ -4,11 +4,11 @@ #include #include +#include "CatchDefinitions.h" #include "fsfw/ipc/CommandMessage.h" #include "fsfw/ipc/MessageQueueBase.h" #include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/ipc/MessageQueueMessage.h" -#include "CatchDefinitions.h" class MessageQueueMockBase : public MessageQueueBase { public: diff --git a/unittests/power/testPowerSwitcher.cpp b/unittests/power/testPowerSwitcher.cpp index cf2f2148..f6a24583 100644 --- a/unittests/power/testPowerSwitcher.cpp +++ b/unittests/power/testPowerSwitcher.cpp @@ -1,9 +1,9 @@ #include #include -#include "mocks/PowerSwitcherMock.h" #include +#include "mocks/PowerSwitcherMock.h" #include "objects/systemObjectList.h" TEST_CASE("Power Switcher", "[power-switcher]") { diff --git a/unittests/testVersion.cpp b/unittests/testVersion.cpp index e0b9897b..2f487031 100644 --- a/unittests/testVersion.cpp +++ b/unittests/testVersion.cpp @@ -1,10 +1,9 @@ -#include "fsfw/version.h" - #include -#include "fsfw/serviceinterface.h" #include "CatchDefinitions.h" +#include "fsfw/serviceinterface.h" +#include "fsfw/version.h" TEST_CASE("Version API Tests", "[TestVersionAPI]") { // Check that major version is non-zero From 42a1d6cccd5af37622eef41adba0d44520fd7814 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 10:03:42 +0200 Subject: [PATCH 45/74] default implementation of simple serialize/deserialize --- src/fsfw/serialize/SerializeIF.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index d806c161..de5abaeb 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -90,6 +90,32 @@ class SerializeIF { */ virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) = 0; + + /** + * Helper method which can be used if serialization should be performed without any additional + * pointer arithmetic on a passed buffer pointer + * @param buffer + * @param maxSize + * @param streamEndianness + * @return + */ + virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) { + size_t tmpSize = 0; + return serialize(&buffer, &tmpSize, maxSize, streamEndianness); + } + + /** + * Helper methods which can be used if deserialization should be performed without any additional + * pointer arithmetic on a passed buffer pointer + * @param buffer + * @param maxSize + * @param streamEndianness + * @return + */ + virtual ReturnValue_t deSerialize(const uint8_t* buffer, size_t maxSize, + Endianness streamEndianness) { + return deSerialize(&buffer, &maxSize, streamEndianness); + } }; #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */ From ddad97033d6224c65fa27195da7693f7907b963b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 10:06:42 +0200 Subject: [PATCH 46/74] expand serialize IF further --- CMakeLists.txt | 4 +-- src/fsfw/osal/linux/MessageQueue.cpp | 3 +- src/fsfw/serialize/SerializeIF.h | 9 +++--- src/fsfw_hal/CMakeLists.txt | 4 +-- src/fsfw_hal/common/gpio/CMakeLists.txt | 4 +-- src/fsfw_hal/devicehandlers/CMakeLists.txt | 8 ++--- src/fsfw_hal/linux/CMakeLists.txt | 30 ++++++++----------- src/fsfw_hal/linux/gpio/CMakeLists.txt | 18 +++++------ src/fsfw_hal/linux/i2c/CMakeLists.txt | 9 +----- src/fsfw_hal/linux/rpi/CMakeLists.txt | 4 +-- src/fsfw_hal/linux/spi/CMakeLists.txt | 9 +----- src/fsfw_hal/linux/uart/CMakeLists.txt | 5 +--- src/fsfw_hal/linux/uio/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/CMakeLists.txt | 4 +-- .../stm32h7/devicetest/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/gpio/CMakeLists.txt | 4 +-- src/fsfw_hal/stm32h7/i2c/CMakeLists.txt | 3 +- src/fsfw_hal/stm32h7/spi/CMakeLists.txt | 18 +++++------ src/fsfw_hal/stm32h7/uart/CMakeLists.txt | 3 +- src/fsfw_tests/CMakeLists.txt | 4 +-- .../integration/assemblies/CMakeLists.txt | 4 +-- .../integration/controller/CMakeLists.txt | 4 +-- .../integration/devices/CMakeLists.txt | 7 ++--- .../integration/task/CMakeLists.txt | 4 +-- src/fsfw_tests/internal/CMakeLists.txt | 8 ++--- .../internal/globalfunctions/CMakeLists.txt | 4 +-- src/fsfw_tests/internal/osal/CMakeLists.txt | 7 ++--- .../internal/serialize/CMakeLists.txt | 4 +-- 28 files changed, 68 insertions(+), 125 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae1a621e..e59eb4c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,8 +104,8 @@ if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() -option(FSFW_BUILD_TESTS - "Build unittest binary in addition to static library" OFF) +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_TESTS) diff --git a/src/fsfw/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp index 4ef7f756..ec212165 100644 --- a/src/fsfw/osal/linux/MessageQueue.cpp +++ b/src/fsfw/osal/linux/MessageQueue.cpp @@ -292,7 +292,8 @@ ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, uint32_t messag sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg << " is too small for requested message depth " << messageDepth << std::endl; sif::error << "This error can be fixed by setting the maximum " - "allowed message depth higher" << std::endl; + "allowed message depth higher" + << std::endl; #else sif::printError( "MessageQueue::MessageQueue: Default MQ size %d is too small for" diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index de5abaeb..3f4fdc38 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -34,7 +34,7 @@ class SerializeIF { static const ReturnValue_t TOO_MANY_ELEMENTS = MAKE_RETURN_CODE(3); // !< There are too many elements to be deserialized - virtual ~SerializeIF() {} + virtual ~SerializeIF() = default; /** * @brief * Function to serialize the object into a buffer with maxSize. Size represents the written @@ -66,7 +66,7 @@ class SerializeIF { * Gets the size of a object if it would be serialized in a buffer * @return Size of serialized object */ - virtual size_t getSerializedSize() const = 0; + [[nodiscard]] virtual size_t getSerializedSize() const = 0; /** * @brief @@ -99,7 +99,8 @@ class SerializeIF { * @param streamEndianness * @return */ - virtual ReturnValue_t serialize(uint8_t* buffer, size_t maxSize, Endianness streamEndianness) { + virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, + Endianness streamEndianness) const { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } @@ -112,7 +113,7 @@ class SerializeIF { * @param streamEndianness * @return */ - virtual ReturnValue_t deSerialize(const uint8_t* buffer, size_t maxSize, + virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t maxSize, Endianness streamEndianness) { return deSerialize(&buffer, &maxSize, streamEndianness); } diff --git a/src/fsfw_hal/CMakeLists.txt b/src/fsfw_hal/CMakeLists.txt index b7559d4b..057ab3a6 100644 --- a/src/fsfw_hal/CMakeLists.txt +++ b/src/fsfw_hal/CMakeLists.txt @@ -2,9 +2,9 @@ add_subdirectory(devicehandlers) add_subdirectory(common) if(UNIX) - add_subdirectory(linux) + add_subdirectory(linux) endif() if(FSFW_HAL_ADD_STM32H7) - add_subdirectory(stm32h7) + add_subdirectory(stm32h7) endif() diff --git a/src/fsfw_hal/common/gpio/CMakeLists.txt b/src/fsfw_hal/common/gpio/CMakeLists.txt index 098c05fa..5c81d9cc 100644 --- a/src/fsfw_hal/common/gpio/CMakeLists.txt +++ b/src/fsfw_hal/common/gpio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GpioCookie.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GpioCookie.cpp) diff --git a/src/fsfw_hal/devicehandlers/CMakeLists.txt b/src/fsfw_hal/devicehandlers/CMakeLists.txt index 94e67c72..17139416 100644 --- a/src/fsfw_hal/devicehandlers/CMakeLists.txt +++ b/src/fsfw_hal/devicehandlers/CMakeLists.txt @@ -1,5 +1,3 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GyroL3GD20Handler.cpp - MgmRM3100Handler.cpp - MgmLIS3MDLHandler.cpp -) +target_sources( + ${LIB_FSFW_NAME} PRIVATE GyroL3GD20Handler.cpp MgmRM3100Handler.cpp + MgmLIS3MDLHandler.cpp) diff --git a/src/fsfw_hal/linux/CMakeLists.txt b/src/fsfw_hal/linux/CMakeLists.txt index f6d1a460..ffa5f5ee 100644 --- a/src/fsfw_hal/linux/CMakeLists.txt +++ b/src/fsfw_hal/linux/CMakeLists.txt @@ -1,25 +1,21 @@ if(FSFW_HAL_ADD_RASPBERRY_PI) - add_subdirectory(rpi) + add_subdirectory(rpi) endif() -target_sources(${LIB_FSFW_NAME} PRIVATE - UnixFileGuard.cpp - CommandExecutor.cpp - utility.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE UnixFileGuard.cpp CommandExecutor.cpp + utility.cpp) if(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS) -if(FSFW_HAL_LINUX_ADD_LIBGPIOD) - add_subdirectory(gpio) -endif() - add_subdirectory(uart) - # Adding those does not really make sense on Apple systems which - # are generally host systems. It won't even compile as the headers - # are missing - if(NOT APPLE) - add_subdirectory(i2c) - add_subdirectory(spi) - endif() + if(FSFW_HAL_LINUX_ADD_LIBGPIOD) + add_subdirectory(gpio) + endif() + add_subdirectory(uart) + # Adding those does not really make sense on Apple systems which are generally + # host systems. It won't even compile as the headers are missing + if(NOT APPLE) + add_subdirectory(i2c) + add_subdirectory(spi) + endif() endif() add_subdirectory(uio) diff --git a/src/fsfw_hal/linux/gpio/CMakeLists.txt b/src/fsfw_hal/linux/gpio/CMakeLists.txt index b1609850..f6e7f2b0 100644 --- a/src/fsfw_hal/linux/gpio/CMakeLists.txt +++ b/src/fsfw_hal/linux/gpio/CMakeLists.txt @@ -1,16 +1,12 @@ -# This abstraction layer requires the gpiod library. You can install this library -# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need -# to install the package before syncing the sysroot to your host computer. +# This abstraction layer requires the gpiod library. You can install this +# library with "sudo apt-get install -y libgpiod-dev". If you are +# cross-compiling, you need to install the package before syncing the sysroot to +# your host computer. find_library(LIB_GPIO gpiod) if(${LIB_GPIO} MATCHES LIB_GPIO-NOTFOUND) - message(STATUS "gpiod library not found, not linking against it") + message(STATUS "gpiod library not found, not linking against it") else() - target_sources(${LIB_FSFW_NAME} PRIVATE - LinuxLibgpioIF.cpp - ) - target_link_libraries(${LIB_FSFW_NAME} PRIVATE - ${LIB_GPIO} - ) + target_sources(${LIB_FSFW_NAME} PRIVATE LinuxLibgpioIF.cpp) + target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_GPIO}) endif() - diff --git a/src/fsfw_hal/linux/i2c/CMakeLists.txt b/src/fsfw_hal/linux/i2c/CMakeLists.txt index 3eb0882c..b94bdc99 100644 --- a/src/fsfw_hal/linux/i2c/CMakeLists.txt +++ b/src/fsfw_hal/linux/i2c/CMakeLists.txt @@ -1,8 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - I2cComIF.cpp - I2cCookie.cpp -) - - - - +target_sources(${LIB_FSFW_NAME} PUBLIC I2cComIF.cpp I2cCookie.cpp) diff --git a/src/fsfw_hal/linux/rpi/CMakeLists.txt b/src/fsfw_hal/linux/rpi/CMakeLists.txt index 47be218c..3a865037 100644 --- a/src/fsfw_hal/linux/rpi/CMakeLists.txt +++ b/src/fsfw_hal/linux/rpi/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GpioRPi.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GpioRPi.cpp) diff --git a/src/fsfw_hal/linux/spi/CMakeLists.txt b/src/fsfw_hal/linux/spi/CMakeLists.txt index 404e1f47..f242bb3b 100644 --- a/src/fsfw_hal/linux/spi/CMakeLists.txt +++ b/src/fsfw_hal/linux/spi/CMakeLists.txt @@ -1,8 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - SpiComIF.cpp - SpiCookie.cpp -) - - - - +target_sources(${LIB_FSFW_NAME} PUBLIC SpiComIF.cpp SpiCookie.cpp) diff --git a/src/fsfw_hal/linux/uart/CMakeLists.txt b/src/fsfw_hal/linux/uart/CMakeLists.txt index 21ed0278..9cad62a4 100644 --- a/src/fsfw_hal/linux/uart/CMakeLists.txt +++ b/src/fsfw_hal/linux/uart/CMakeLists.txt @@ -1,4 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - UartComIF.cpp - UartCookie.cpp -) +target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp) diff --git a/src/fsfw_hal/linux/uio/CMakeLists.txt b/src/fsfw_hal/linux/uio/CMakeLists.txt index e98a0865..e3498246 100644 --- a/src/fsfw_hal/linux/uio/CMakeLists.txt +++ b/src/fsfw_hal/linux/uio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PUBLIC - UioMapper.cpp -) +target_sources(${LIB_FSFW_NAME} PUBLIC UioMapper.cpp) diff --git a/src/fsfw_hal/stm32h7/CMakeLists.txt b/src/fsfw_hal/stm32h7/CMakeLists.txt index bae3b1ac..e8843ed3 100644 --- a/src/fsfw_hal/stm32h7/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/CMakeLists.txt @@ -2,6 +2,4 @@ add_subdirectory(spi) add_subdirectory(gpio) add_subdirectory(devicetest) -target_sources(${LIB_FSFW_NAME} PRIVATE - dma.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE dma.cpp) diff --git a/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt b/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt index 7bd4c3a9..8e789ddb 100644 --- a/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - GyroL3GD20H.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20H.cpp) diff --git a/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt b/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt index 35245b25..54d76b2d 100644 --- a/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - gpio.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE gpio.cpp) diff --git a/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt b/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt index 5ecb0990..a0d48465 100644 --- a/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt @@ -1,2 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE -) +target_sources(${LIB_FSFW_NAME} PRIVATE) diff --git a/src/fsfw_hal/stm32h7/spi/CMakeLists.txt b/src/fsfw_hal/stm32h7/spi/CMakeLists.txt index aa5541bc..9a98f502 100644 --- a/src/fsfw_hal/stm32h7/spi/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/spi/CMakeLists.txt @@ -1,9 +1,9 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - spiCore.cpp - spiDefinitions.cpp - spiInterrupts.cpp - mspInit.cpp - SpiCookie.cpp - SpiComIF.cpp - stm32h743zi.cpp -) +target_sources( + ${LIB_FSFW_NAME} + PRIVATE spiCore.cpp + spiDefinitions.cpp + spiInterrupts.cpp + mspInit.cpp + SpiCookie.cpp + SpiComIF.cpp + stm32h743zi.cpp) diff --git a/src/fsfw_hal/stm32h7/uart/CMakeLists.txt b/src/fsfw_hal/stm32h7/uart/CMakeLists.txt index 5ecb0990..a0d48465 100644 --- a/src/fsfw_hal/stm32h7/uart/CMakeLists.txt +++ b/src/fsfw_hal/stm32h7/uart/CMakeLists.txt @@ -1,2 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE -) +target_sources(${LIB_FSFW_NAME} PRIVATE) diff --git a/src/fsfw_tests/CMakeLists.txt b/src/fsfw_tests/CMakeLists.txt index 5e16e0a7..d161699a 100644 --- a/src/fsfw_tests/CMakeLists.txt +++ b/src/fsfw_tests/CMakeLists.txt @@ -1,7 +1,7 @@ if(FSFW_ADD_INTERNAL_TESTS) - add_subdirectory(internal) + add_subdirectory(internal) endif() if(NOT FSFW_BUILD_TESTS) - add_subdirectory(integration) + add_subdirectory(integration) endif() diff --git a/src/fsfw_tests/integration/assemblies/CMakeLists.txt b/src/fsfw_tests/integration/assemblies/CMakeLists.txt index 22c06600..63a6447a 100644 --- a/src/fsfw_tests/integration/assemblies/CMakeLists.txt +++ b/src/fsfw_tests/integration/assemblies/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestAssembly.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestAssembly.cpp) diff --git a/src/fsfw_tests/integration/controller/CMakeLists.txt b/src/fsfw_tests/integration/controller/CMakeLists.txt index f5655b71..5eeb5c68 100644 --- a/src/fsfw_tests/integration/controller/CMakeLists.txt +++ b/src/fsfw_tests/integration/controller/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestController.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestController.cpp) diff --git a/src/fsfw_tests/integration/devices/CMakeLists.txt b/src/fsfw_tests/integration/devices/CMakeLists.txt index cfd238d2..d5799197 100644 --- a/src/fsfw_tests/integration/devices/CMakeLists.txt +++ b/src/fsfw_tests/integration/devices/CMakeLists.txt @@ -1,5 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestCookie.cpp - TestDeviceHandler.cpp - TestEchoComIF.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE TestCookie.cpp TestDeviceHandler.cpp + TestEchoComIF.cpp) diff --git a/src/fsfw_tests/integration/task/CMakeLists.txt b/src/fsfw_tests/integration/task/CMakeLists.txt index 4cd481bf..62d5e8ef 100644 --- a/src/fsfw_tests/integration/task/CMakeLists.txt +++ b/src/fsfw_tests/integration/task/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestTask.cpp -) \ No newline at end of file +target_sources(${LIB_FSFW_NAME} PRIVATE TestTask.cpp) diff --git a/src/fsfw_tests/internal/CMakeLists.txt b/src/fsfw_tests/internal/CMakeLists.txt index 2a144a9b..c1af5467 100644 --- a/src/fsfw_tests/internal/CMakeLists.txt +++ b/src/fsfw_tests/internal/CMakeLists.txt @@ -1,8 +1,6 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - InternalUnitTester.cpp - UnittDefinitions.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE InternalUnitTester.cpp + UnittDefinitions.cpp) add_subdirectory(osal) add_subdirectory(serialize) -add_subdirectory(globalfunctions) \ No newline at end of file +add_subdirectory(globalfunctions) diff --git a/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt b/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt index cde97734..6e7e58ad 100644 --- a/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt +++ b/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TestArrayPrinter.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE TestArrayPrinter.cpp) diff --git a/src/fsfw_tests/internal/osal/CMakeLists.txt b/src/fsfw_tests/internal/osal/CMakeLists.txt index 8d79d759..db1031a0 100644 --- a/src/fsfw_tests/internal/osal/CMakeLists.txt +++ b/src/fsfw_tests/internal/osal/CMakeLists.txt @@ -1,5 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - testMq.cpp - testMutex.cpp - testSemaphore.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE testMq.cpp testMutex.cpp + testSemaphore.cpp) diff --git a/src/fsfw_tests/internal/serialize/CMakeLists.txt b/src/fsfw_tests/internal/serialize/CMakeLists.txt index 47e8b538..ee264d9d 100644 --- a/src/fsfw_tests/internal/serialize/CMakeLists.txt +++ b/src/fsfw_tests/internal/serialize/CMakeLists.txt @@ -1,3 +1 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - IntTestSerialization.cpp -) +target_sources(${LIB_FSFW_NAME} PRIVATE IntTestSerialization.cpp) From 8e05fc0417d7fa247bf10c65ecc559b0de1fe3bb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 10:28:01 +0200 Subject: [PATCH 47/74] added a few more methods --- src/fsfw/serialize/SerializeIF.h | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 3f4fdc38..9fc5b731 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -61,6 +61,18 @@ class SerializeIF { */ virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const = 0; + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t serializeNe(uint8_t** buffer, size_t* size, size_t maxSize) { + return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) { + return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); + } /** * Gets the size of a object if it would be serialized in a buffer @@ -90,6 +102,18 @@ class SerializeIF { */ virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) = 0; + /** + * Forwards to regular @deSerialize call with network endianness + */ + virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size, size_t maxSize) { + return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t *size, size_t maxSize) { + return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); + } /** * Helper method which can be used if serialization should be performed without any additional @@ -104,6 +128,18 @@ class SerializeIF { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t serializeNe(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + } /** * Helper methods which can be used if deserialization should be performed without any additional @@ -117,6 +153,18 @@ class SerializeIF { Endianness streamEndianness) { return deSerialize(&buffer, &maxSize, streamEndianness); } + /** + * Forwards to regular @serialize call with network endianness + */ + virtual ReturnValue_t deSerializeNe(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + } + /** + * If endianness is not explicitly specified, use machine endianness + */ + virtual ReturnValue_t deSerialize(uint8_t *buffer, size_t maxSize) const { + return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + } }; #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */ From f2bf4b463e8bfe3219a368479ada88346528af18 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 10:34:19 +0200 Subject: [PATCH 48/74] expand serializeIF tests --- CMakeLists.txt | 2 +- unittests/serialize/CMakeLists.txt | 7 ++++--- ...rialLinkedPacket.h => SerialLinkedListAdapterPacket.h} | 8 ++++---- ...erialBufferAdapter.cpp => testSerialBufferAdapter.cpp} | 4 ++-- ...tSerialLinkedPacket.cpp => testSerialLinkedPacket.cpp} | 3 +-- .../{TestSerialization.cpp => testSerializeAdapter.cpp} | 0 unittests/serialize/testSerializeIF.cpp | 6 ++++++ 7 files changed, 18 insertions(+), 12 deletions(-) rename unittests/serialize/{TestSerialLinkedPacket.h => SerialLinkedListAdapterPacket.h} (80%) rename unittests/serialize/{TestSerialBufferAdapter.cpp => testSerialBufferAdapter.cpp} (98%) rename unittests/serialize/{TestSerialLinkedPacket.cpp => testSerialLinkedPacket.cpp} (98%) rename unittests/serialize/{TestSerialization.cpp => testSerializeAdapter.cpp} (100%) create mode 100644 unittests/serialize/testSerializeIF.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index e59eb4c5..949c9403 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ if(FSFW_BUILD_TESTS) configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) project(${FSFW_TEST_TGT} CXX C) - add_executable(${FSFW_TEST_TGT}) + add_executable(${FSFW_TEST_TGT} unittests/serialize/testSerializeIF.cpp) if(IPO_SUPPORTED AND FSFW_ENABLE_IPO) set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) diff --git a/unittests/serialize/CMakeLists.txt b/unittests/serialize/CMakeLists.txt index 96c80f4a..be4301db 100644 --- a/unittests/serialize/CMakeLists.txt +++ b/unittests/serialize/CMakeLists.txt @@ -1,5 +1,6 @@ target_sources(${FSFW_TEST_TGT} PRIVATE - TestSerialBufferAdapter.cpp - TestSerialization.cpp - TestSerialLinkedPacket.cpp + testSerialBufferAdapter.cpp + testSerializeAdapter.cpp + testSerialLinkedPacket.cpp + testSerializeIF.cpp ) diff --git a/unittests/serialize/TestSerialLinkedPacket.h b/unittests/serialize/SerialLinkedListAdapterPacket.h similarity index 80% rename from unittests/serialize/TestSerialLinkedPacket.h rename to unittests/serialize/SerialLinkedListAdapterPacket.h index 0cfdd9ff..81268d28 100644 --- a/unittests/serialize/TestSerialLinkedPacket.h +++ b/unittests/serialize/SerialLinkedListAdapterPacket.h @@ -26,13 +26,13 @@ class TestPacket : public SerialLinkedListAdapter { setLinks(); } - uint32_t getHeader() const { return header.entry; } + [[nodiscard]] uint32_t getHeader() const { return header.entry; } - const uint8_t* getBuffer() { return buffer.entry.getConstBuffer(); } + [[nodiscard]] const uint8_t* getBuffer() const { return buffer.entry.getConstBuffer(); } size_t getBufferLength() { return buffer.getSerializedSize(); } - uint16_t getTail() const { return tail.entry; } + [[nodiscard]] uint16_t getTail() const { return tail.entry; } private: void setLinks() { @@ -47,4 +47,4 @@ class TestPacket : public SerialLinkedListAdapter { SerializeElement tail = 0; }; -#endif /* UNITTEST_TESTFW_NEWTESTS_TESTTEMPLATE_H_ */ +#endif /* UNITTEST_HOSTED_TESTSERIALLINKEDPACKET_H_ */ diff --git a/unittests/serialize/TestSerialBufferAdapter.cpp b/unittests/serialize/testSerialBufferAdapter.cpp similarity index 98% rename from unittests/serialize/TestSerialBufferAdapter.cpp rename to unittests/serialize/testSerialBufferAdapter.cpp index 2aa76ec8..f9fbece1 100644 --- a/unittests/serialize/TestSerialBufferAdapter.cpp +++ b/unittests/serialize/testSerialBufferAdapter.cpp @@ -92,7 +92,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") { testArray[3] = 1; testArray[4] = 1; testArray[5] = 0; - std::array test_recv_array; + std::array test_recv_array{}; arrayPtr = testArray.data(); // copy testArray[1] to testArray[4] into receive buffer, skip // size field (testArray[0]) for deSerialization. @@ -116,7 +116,7 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") { testArray[3] = 1; testArray[4] = 1; testArray[5] = 0; - std::array test_recv_array; + std::array test_recv_array{}; arrayPtr = testArray.data() + 2; // copy testArray[1] to testArray[4] into receive buffer, skip // size field (testArray[0]) diff --git a/unittests/serialize/TestSerialLinkedPacket.cpp b/unittests/serialize/testSerialLinkedPacket.cpp similarity index 98% rename from unittests/serialize/TestSerialLinkedPacket.cpp rename to unittests/serialize/testSerialLinkedPacket.cpp index 2d6e476f..40910efb 100644 --- a/unittests/serialize/TestSerialLinkedPacket.cpp +++ b/unittests/serialize/testSerialLinkedPacket.cpp @@ -1,11 +1,10 @@ -#include "TestSerialLinkedPacket.h" - #include #include #include #include "CatchDefinitions.h" +#include "SerialLinkedListAdapterPacket.h" TEST_CASE("Serial Linked Packet", "[SerLinkPacket]") { // perform set-up here diff --git a/unittests/serialize/TestSerialization.cpp b/unittests/serialize/testSerializeAdapter.cpp similarity index 100% rename from unittests/serialize/TestSerialization.cpp rename to unittests/serialize/testSerializeAdapter.cpp diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp new file mode 100644 index 00000000..80bcba64 --- /dev/null +++ b/unittests/serialize/testSerializeIF.cpp @@ -0,0 +1,6 @@ + +#include + +TEST_CASE("Simple Test", "[SerSizeTest]") { + +} \ No newline at end of file From b809f90e727bb9669badc179446a91b00dbdf53d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 11:10:44 +0200 Subject: [PATCH 49/74] added unittests for new helpers --- src/fsfw/serialize.h | 10 +- src/fsfw/serialize/EndianConverter.h | 14 +- src/fsfw/serialize/SerializeIF.h | 14 +- unittests/mocks/SimpleSerializable.h | 40 ++++++ unittests/serialize/testSerializeIF.cpp | 170 +++++++++++++++++++++++- 5 files changed, 226 insertions(+), 22 deletions(-) create mode 100644 unittests/mocks/SimpleSerializable.h diff --git a/src/fsfw/serialize.h b/src/fsfw/serialize.h index edd7c9c7..514e1e0c 100644 --- a/src/fsfw/serialize.h +++ b/src/fsfw/serialize.h @@ -1,10 +1,10 @@ #ifndef FSFW_INC_FSFW_SERIALIZE_H_ #define FSFW_INC_FSFW_SERIALIZE_H_ -#include "src/core/serialize/EndianConverter.h" -#include "src/core/serialize/SerialArrayListAdapter.h" -#include "src/core/serialize/SerialBufferAdapter.h" -#include "src/core/serialize/SerialLinkedListAdapter.h" -#include "src/core/serialize/SerializeElement.h" +#include "fsfw/serialize/EndianConverter.h" +#include "fsfw/serialize/SerialArrayListAdapter.h" +#include "fsfw/serialize/SerialBufferAdapter.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/serialize/SerializeElement.h" #endif /* FSFW_INC_FSFW_SERIALIZE_H_ */ diff --git a/src/fsfw/serialize/EndianConverter.h b/src/fsfw/serialize/EndianConverter.h index 3beae46a..9d6c73a3 100644 --- a/src/fsfw/serialize/EndianConverter.h +++ b/src/fsfw/serialize/EndianConverter.h @@ -4,7 +4,7 @@ #include #include -#include "../osal/Endiness.h" +#include "fsfw/osal/Endiness.h" /** * Helper class to convert variables or bitstreams between machine @@ -36,7 +36,7 @@ */ class EndianConverter { private: - EndianConverter(){}; + EndianConverter() = default; public: /** @@ -49,8 +49,8 @@ class EndianConverter { #error BYTE_ORDER_SYSTEM not defined #elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN T tmp; - uint8_t *pointerOut = (uint8_t *)&tmp; - uint8_t *pointerIn = (uint8_t *)∈ + auto *pointerOut = reinterpret_cast(&tmp); + auto *pointerIn = reinterpret_cast(&in); for (size_t count = 0; count < sizeof(T); count++) { pointerOut[sizeof(T) - count - 1] = pointerIn[count]; } @@ -73,7 +73,6 @@ class EndianConverter { for (size_t count = 0; count < size; count++) { out[size - count - 1] = in[count]; } - return; #elif BYTE_ORDER_SYSTEM == BIG_ENDIAN memcpy(out, in, size); return; @@ -90,8 +89,8 @@ class EndianConverter { #error BYTE_ORDER_SYSTEM not defined #elif BYTE_ORDER_SYSTEM == BIG_ENDIAN T tmp; - uint8_t *pointerOut = (uint8_t *)&tmp; - uint8_t *pointerIn = (uint8_t *)∈ + auto *pointerOut = reinterpret_cast(&tmp); + auto *pointerIn = reinterpret_cast(&in); for (size_t count = 0; count < sizeof(T); count++) { pointerOut[sizeof(T) - count - 1] = pointerIn[count]; } @@ -116,7 +115,6 @@ class EndianConverter { return; #elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN memcpy(out, in, size); - return; #endif } }; diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 9fc5b731..54a1f4e3 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -3,7 +3,7 @@ #include -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * @defgroup serialize Serialization @@ -105,13 +105,13 @@ class SerializeIF { /** * Forwards to regular @deSerialize call with network endianness */ - virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size, size_t maxSize) { + virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t *size, size_t maxSize) { + virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t *size) { return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); } @@ -156,14 +156,14 @@ class SerializeIF { /** * Forwards to regular @serialize call with network endianness */ - virtual ReturnValue_t deSerializeNe(uint8_t *buffer, size_t maxSize) const { - return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + virtual ReturnValue_t deSerializeNe(const uint8_t *buffer, size_t maxSize) { + return deSerialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t deSerialize(uint8_t *buffer, size_t maxSize) const { - return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t maxSize) { + return deSerialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); } }; diff --git a/unittests/mocks/SimpleSerializable.h b/unittests/mocks/SimpleSerializable.h new file mode 100644 index 00000000..5c28a09a --- /dev/null +++ b/unittests/mocks/SimpleSerializable.h @@ -0,0 +1,40 @@ +#ifndef FSFW_TESTS_SIMPLESERIALIZABLE_H +#define FSFW_TESTS_SIMPLESERIALIZABLE_H + +#include "fsfw/serialize.h" +#include "fsfw/osal/Endiness.h" + +class SimpleSerializable : public SerializeIF { + public: + ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, + Endianness streamEndianness) const override { + if (*size + getSerializedSize() > maxSize) { + return SerializeIF::BUFFER_TOO_SHORT; + } + **buffer = someU8; + *buffer += 1; + *size += 1; + return SerializeAdapter::serialize(&someU16, buffer, size, maxSize, streamEndianness); + } + + [[nodiscard]] size_t getSerializedSize() const override { return 3; } + ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, + Endianness streamEndianness) override { + if (*size < getSerializedSize()) { + return SerializeIF::STREAM_TOO_SHORT; + } + someU8 = **buffer; + *size -= 1; + *buffer += 1; + return SerializeAdapter::deSerialize(&someU16, buffer, size, streamEndianness); + } + + [[nodiscard]] uint8_t getU8() const { return someU8; } + [[nodiscard]] uint16_t getU16() const { return someU16; } + + private: + uint8_t someU8 = 1; + uint16_t someU16 = 0x0203; +}; + +#endif // FSFW_TESTS_SIMPLESERIALIZABLE_H diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 80bcba64..2cbe6132 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -1,6 +1,172 @@ +#include #include -TEST_CASE("Simple Test", "[SerSizeTest]") { - +#include "mocks/SimpleSerializable.h" + +using namespace std; + +TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { + auto simpleSer = SimpleSerializable(); + array buf{}; + uint8_t* ptr = buf.data(); + size_t len = 0; + + SECTION("Little Endian Normal") { + REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + CHECK(buf[0] == 1); + CHECK(buf[1] == 3); + CHECK(buf[2] == 2); + // Verify pointer arithmetic and size increment + CHECK(ptr == buf.data() + 3); + CHECK(len == 3); + } + + SECTION("Little Endian Simple") { + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + CHECK(buf[0] == 1); + CHECK(buf[1] == 3); + CHECK(buf[2] == 2); + } + + SECTION("Big Endian Normal") { + SECTION("Explicit") { + REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::BIG) == + HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 0") { + REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 1") { + REQUIRE(simpleSer.serializeNe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); + } + + CHECK(buf[0] == 1); + CHECK(buf[1] == 2); + CHECK(buf[2] == 3); + // Verify pointer arithmetic and size increment + CHECK(ptr == buf.data() + 3); + CHECK(len == 3); + } + + SECTION("Big Endian Simple") { + SECTION("Explicit") { + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::BIG) == + HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 0") { + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 1") { + REQUIRE(simpleSer.SerializeIF::serializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + } + CHECK(buf[0] == 1); + CHECK(buf[1] == 2); + CHECK(buf[2] == 3); + } + + SECTION("Machine Endian Implicit") { + REQUIRE(simpleSer.SerializeIF::serialize(&ptr, &len, buf.size()) == + HasReturnvaluesIF::RETURN_OK); + CHECK(buf[0] == 1); +#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN + CHECK(buf[1] == 3); + CHECK(buf[2] == 2); +#else + CHECK(buf[1] == 2); + CHECK(buf[2] == 3); +#endif + // Verify pointer arithmetic and size increment + CHECK(ptr == buf.data() + 3); + CHECK(len == 3); + } + + SECTION("Machine Endian Simple Implicit") { + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size()) == + HasReturnvaluesIF::RETURN_OK); + CHECK(buf[0] == 1); +#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN + CHECK(buf[1] == 3); + CHECK(buf[2] == 2); +#else + CHECK(buf[1] == 2); + CHECK(buf[2] == 3); +#endif + } +} + +TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { + auto simpleSer = SimpleSerializable(); + array buf = {5, 0, 1}; + const uint8_t* ptr = buf.data(); + size_t len = buf.size(); + + SECTION("Little Endian Normal") { + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + CHECK(simpleSer.getU8() == 5); + CHECK(simpleSer.getU16() == 0x0100); + CHECK(ptr == buf.data() + 3); + CHECK(len == 0); + } + + SECTION("Little Endian Simple") { + REQUIRE(simpleSer.SerializeIF::deSerialize(ptr, len, SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + CHECK(simpleSer.getU8() == 5); + CHECK(simpleSer.getU16() == 0x0100); + } + + SECTION("Big Endian Normal") { + SECTION("Explicit") { + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 0") { + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 1") { + REQUIRE(simpleSer.SerializeIF::deSerializeNe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); + } + CHECK(simpleSer.getU8() == 5); + CHECK(simpleSer.getU16() == 1); + CHECK(ptr == buf.data() + 3); + CHECK(len == 0); + } + + SECTION("Big Endian Simple") { + SECTION("Explicit") { + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::BIG) == + HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 0") { + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + } + SECTION("Network 1") { + REQUIRE(simpleSer.SerializeIF::deSerializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + } + CHECK(simpleSer.getU8() == 5); + CHECK(simpleSer.getU16() == 1); + } + + SECTION("Machine Endian Implicit") { + REQUIRE(simpleSer.SerializeIF::deSerialize(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); + CHECK(simpleSer.getU8() == 5); +#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN + CHECK(simpleSer.getU16() == 0x0100); +#else + CHECK(simpleSer.getU16() == 1); +#endif + // Verify pointer arithmetic and size increment + CHECK(ptr == buf.data() + 3); + CHECK(len == 0); + } + + SECTION("Machine Endian Simple Implicit") { + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size()) == + HasReturnvaluesIF::RETURN_OK); + CHECK(simpleSer.getU8() == 5); +#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN + CHECK(simpleSer.getU16() == 0x0100); +#else + CHECK(simpleSer.getU16() == 1); +#endif + } } \ No newline at end of file From 3708df242320cc0edd5b103504a2ce926df6f078 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 23 Jul 2022 11:15:55 +0200 Subject: [PATCH 50/74] small fix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 949c9403..e59eb4c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ if(FSFW_BUILD_TESTS) configure_file(unittests/testcfg/TestsConfig.h.in tests/TestsConfig.h) project(${FSFW_TEST_TGT} CXX C) - add_executable(${FSFW_TEST_TGT} unittests/serialize/testSerializeIF.cpp) + add_executable(${FSFW_TEST_TGT}) if(IPO_SUPPORTED AND FSFW_ENABLE_IPO) set_property(TARGET ${FSFW_TEST_TGT} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) From 2a34c831b199ab747e2bbab6db4237602157d873 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 11:33:12 +0200 Subject: [PATCH 51/74] use Be instead of Ne, which could be confused --- src/fsfw/serialize/SerializeIF.h | 16 ++++++++-------- unittests/serialize/testSerializeIF.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 54a1f4e3..921d8a5e 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -62,9 +62,9 @@ class SerializeIF { virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const = 0; /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeNe(uint8_t** buffer, size_t* size, size_t maxSize) { + virtual ReturnValue_t serializeBe(uint8_t** buffer, size_t* size, size_t maxSize) { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } /** @@ -103,9 +103,9 @@ class SerializeIF { virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, Endianness streamEndianness) = 0; /** - * Forwards to regular @deSerialize call with network endianness + * Forwards to regular @deSerialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeNe(const uint8_t** buffer, size_t* size) { + virtual ReturnValue_t deSerializeBe(const uint8_t** buffer, size_t* size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } /** @@ -129,9 +129,9 @@ class SerializeIF { return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeNe(uint8_t *buffer, size_t maxSize) const { + virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** @@ -154,9 +154,9 @@ class SerializeIF { return deSerialize(&buffer, &maxSize, streamEndianness); } /** - * Forwards to regular @serialize call with network endianness + * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeNe(const uint8_t *buffer, size_t maxSize) { + virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t maxSize) { return deSerialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 2cbe6132..694f6d7f 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -38,7 +38,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.serializeNe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.serializeBe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(buf[0] == 1); @@ -58,7 +58,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::serializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::serializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(buf[0] == 1); CHECK(buf[1] == 2); @@ -123,7 +123,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::deSerializeNe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerializeBe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); } CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 1); @@ -140,7 +140,7 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::deSerializeNe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); } CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 1); From e030878023080a487fc8a14853ac51486316fe71 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 14:33:10 +0200 Subject: [PATCH 52/74] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b814840..1cfcc568 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] -# [v5.0.0] 18.07.2022 +# [v5.0.0] 25.07.2022 ## Changes From 54fc35eae7e4778cff19eb8ab358e26ae53dd393 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 14:36:18 +0200 Subject: [PATCH 53/74] re-run afmt --- src/fsfw/container/SimpleRingBuffer.cpp | 14 +++++++------- unittests/container/RingBufferTest.cpp | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index 437e72ea..c104ea97 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -1,10 +1,10 @@ #include "fsfw/container/SimpleRingBuffer.h" -#include "fsfw/FSFW.h" - -#include "fsfw/serviceinterface.h" #include +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface.h" + SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, size_t maxExcessBytes) : RingBufferBase<>(0, size, overwriteOld), maxExcessBytes(maxExcessBytes) { if (maxExcessBytes > size) { @@ -51,15 +51,15 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { - if(data == nullptr) { + if (data == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } - if(amount > getMaxSize()) { + if (amount > getMaxSize()) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl; + sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl; #else - sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); + sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); #endif #endif return HasReturnvaluesIF::RETURN_FAILED; diff --git a/unittests/container/RingBufferTest.cpp b/unittests/container/RingBufferTest.cpp index 9ae58388..f4f111a6 100644 --- a/unittests/container/RingBufferTest.cpp +++ b/unittests/container/RingBufferTest.cpp @@ -237,12 +237,12 @@ TEST_CASE("Ring Buffer Test3", "[RingBufferTest3]") { SECTION("Overflow") { REQUIRE(ringBuffer.availableWriteSpace() == 9); - // Writing more than the buffer is large. + // Writing more than the buffer is large. // This write will be rejected and is seen as a configuration mistake REQUIRE(ringBuffer.writeData(testData, 13) == retval::CATCH_FAILED); REQUIRE(ringBuffer.getAvailableReadData() == 0); ringBuffer.clear(); - // Using FreeElement allows the usage of excessBytes but + // Using FreeElement allows the usage of excessBytes but // should be used with caution uint8_t *ptr = nullptr; REQUIRE(ringBuffer.getFreeElement(&ptr, 13) == retval::CATCH_OK); From 380f1d02069debf2267f25cd432a49bea40ad1ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 14:40:10 +0200 Subject: [PATCH 54/74] remove obsolete returns --- src/fsfw/serialize/EndianConverter.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/fsfw/serialize/EndianConverter.h b/src/fsfw/serialize/EndianConverter.h index 9d6c73a3..dc8944ca 100644 --- a/src/fsfw/serialize/EndianConverter.h +++ b/src/fsfw/serialize/EndianConverter.h @@ -75,7 +75,6 @@ class EndianConverter { } #elif BYTE_ORDER_SYSTEM == BIG_ENDIAN memcpy(out, in, size); - return; #endif } @@ -112,7 +111,6 @@ class EndianConverter { for (size_t count = 0; count < size; count++) { out[size - count - 1] = in[count]; } - return; #elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN memcpy(out, in, size); #endif From f3af88ae40e3dbaddac256cfcf13d0b4e9774c45 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 14:44:19 +0200 Subject: [PATCH 55/74] add [[nodiscard]] and const specifiers --- src/fsfw/serialize/SerializeIF.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 921d8a5e..7ef8c925 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -59,18 +59,18 @@ class SerializeIF { * - @c RETURN_FAILED Generic error * - @c RETURN_OK Successful serialization */ - virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, Endianness streamEndianness) const = 0; /** * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeBe(uint8_t** buffer, size_t* size, size_t maxSize) { + [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t** buffer, size_t* size, size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) { + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); } @@ -123,7 +123,7 @@ class SerializeIF { * @param streamEndianness * @return */ - virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, Endianness streamEndianness) const { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); @@ -131,13 +131,13 @@ class SerializeIF { /** * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { + [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); } From f80be9e9fac34bfb2c3fb25647e6b11289b0934c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 25 Jul 2022 14:44:49 +0200 Subject: [PATCH 56/74] run afmt --- src/fsfw/container/SimpleRingBuffer.cpp | 14 +++++++------- src/fsfw/serialize/SerializeIF.h | 14 ++++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/fsfw/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp index 437e72ea..c104ea97 100644 --- a/src/fsfw/container/SimpleRingBuffer.cpp +++ b/src/fsfw/container/SimpleRingBuffer.cpp @@ -1,10 +1,10 @@ #include "fsfw/container/SimpleRingBuffer.h" -#include "fsfw/FSFW.h" - -#include "fsfw/serviceinterface.h" #include +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface.h" + SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, size_t maxExcessBytes) : RingBufferBase<>(0, size, overwriteOld), maxExcessBytes(maxExcessBytes) { if (maxExcessBytes > size) { @@ -51,15 +51,15 @@ void SimpleRingBuffer::confirmBytesWritten(size_t amount) { } ReturnValue_t SimpleRingBuffer::writeData(const uint8_t* data, size_t amount) { - if(data == nullptr) { + if (data == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } - if(amount > getMaxSize()) { + if (amount > getMaxSize()) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl; + sif::error << "SimpleRingBuffer::writeData: Amount of data too large" << std::endl; #else - sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); + sif::printError("SimpleRingBuffer::writeData: Amount of data too large\n"); #endif #endif return HasReturnvaluesIF::RETURN_FAILED; diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 7ef8c925..47212ab1 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -60,17 +60,19 @@ class SerializeIF { * - @c RETURN_OK Successful serialization */ [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, - Endianness streamEndianness) const = 0; + Endianness streamEndianness) const = 0; /** * Forwards to regular @serialize call with big (network) endianness */ - [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t** buffer, size_t* size, size_t maxSize) const { + [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, + size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const { + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, + size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); } @@ -105,13 +107,13 @@ class SerializeIF { /** * Forwards to regular @deSerialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeBe(const uint8_t** buffer, size_t* size) { + virtual ReturnValue_t deSerializeBe(const uint8_t **buffer, size_t *size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t *size) { + virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size) { return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); } @@ -124,7 +126,7 @@ class SerializeIF { * @return */ [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, - Endianness streamEndianness) const { + Endianness streamEndianness) const { size_t tmpSize = 0; return serialize(&buffer, &tmpSize, maxSize, streamEndianness); } From dc31358d525a9a8aed2eed855a68176c288c36dd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Jul 2022 21:31:09 +0200 Subject: [PATCH 57/74] adaption for SerializeIF - Returns serialized and deserialized size now --- src/fsfw/serialize/SerializeIF.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 47212ab1..5e7a2fb9 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -125,22 +125,26 @@ class SerializeIF { * @param streamEndianness * @return */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize, + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t &serLen, size_t maxSize, Endianness streamEndianness) const { size_t tmpSize = 0; - return serialize(&buffer, &tmpSize, maxSize, streamEndianness); + ReturnValue_t result = serialize(&buffer, &tmpSize, maxSize, streamEndianness); + serLen = tmpSize; + return result; } /** * Forwards to regular @serialize call with big (network) endianness */ - [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t maxSize) const { - return serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + [[nodiscard]] virtual ReturnValue_t serializeBe(uint8_t *buffer, size_t &serLen, + size_t maxSize) const { + return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t maxSize) const { - return serialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t &serLen, + size_t maxSize) const { + return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::MACHINE); } /** @@ -151,21 +155,24 @@ class SerializeIF { * @param streamEndianness * @return */ - virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t maxSize, + virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t &deserSize, size_t maxSize, Endianness streamEndianness) { - return deSerialize(&buffer, &maxSize, streamEndianness); + size_t deserLen = maxSize; + ReturnValue_t result = deSerialize(&buffer, &deserLen, streamEndianness); + deserSize = maxSize - deserLen; + return result; } /** * Forwards to regular @serialize call with big (network) endianness */ - virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t maxSize) { - return deSerialize(buffer, maxSize, SerializeIF::Endianness::NETWORK); + virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { + return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::NETWORK); } /** * If endianness is not explicitly specified, use machine endianness */ - virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t maxSize) { - return deSerialize(buffer, maxSize, SerializeIF::Endianness::MACHINE); + virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { + return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::MACHINE); } }; From b11cdf618405574ec1e603f79cae1166f7579a79 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Jul 2022 21:32:22 +0200 Subject: [PATCH 58/74] update unittests --- unittests/serialize/testSerializeIF.cpp | 59 ++++++++++++++++++------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 694f6d7f..5200f8b7 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -13,7 +13,8 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { size_t len = 0; SECTION("Little Endian Normal") { - REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::LITTLE) == + HasReturnvaluesIF::RETURN_OK); CHECK(buf[0] == 1); CHECK(buf[1] == 3); CHECK(buf[2] == 2); @@ -23,10 +24,14 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { } SECTION("Little Endian Simple") { - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + size_t serLen = 0xff; + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), + SerializeIF::Endianness::LITTLE) == + HasReturnvaluesIF::RETURN_OK); CHECK(buf[0] == 1); CHECK(buf[1] == 3); CHECK(buf[2] == 2); + CHECK(serLen == 3); } SECTION("Big Endian Normal") { @@ -35,7 +40,8 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { HasReturnvaluesIF::RETURN_OK); } SECTION("Network 0") { - REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.serialize(&ptr, &len, buf.size(), SerializeIF::Endianness::NETWORK) == + HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { REQUIRE(simpleSer.serializeBe(&ptr, &len, buf.size()) == HasReturnvaluesIF::RETURN_OK); @@ -50,19 +56,25 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { } SECTION("Big Endian Simple") { + size_t serLen = 0xff; SECTION("Explicit") { - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::BIG) == + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), + SerializeIF::Endianness::BIG) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 0") { - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size(), + SerializeIF::Endianness::NETWORK) == + HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::serializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::serializeBe(buf.data(), serLen, buf.size()) == + HasReturnvaluesIF::RETURN_OK); } CHECK(buf[0] == 1); CHECK(buf[1] == 2); CHECK(buf[2] == 3); + CHECK(serLen == 3); } SECTION("Machine Endian Implicit") { @@ -82,7 +94,8 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { } SECTION("Machine Endian Simple Implicit") { - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), buf.size()) == + size_t serLen = 0xff; + REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(buf[0] == 1); #if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN @@ -92,6 +105,7 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { CHECK(buf[1] == 2); CHECK(buf[2] == 3); #endif + CHECK(serLen == 3); } } @@ -102,7 +116,8 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { size_t len = buf.size(); SECTION("Little Endian Normal") { - REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::LITTLE) == + HasReturnvaluesIF::RETURN_OK); CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 0x0100); CHECK(ptr == buf.data() + 3); @@ -110,17 +125,23 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { } SECTION("Little Endian Simple") { - REQUIRE(simpleSer.SerializeIF::deSerialize(ptr, len, SerializeIF::Endianness::LITTLE) == HasReturnvaluesIF::RETURN_OK); + size_t deserLen = 0xff; + REQUIRE( + simpleSer.SerializeIF::deSerialize(ptr, deserLen, len, SerializeIF::Endianness::LITTLE) == + HasReturnvaluesIF::RETURN_OK); CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 0x0100); + CHECK(deserLen == 3); } SECTION("Big Endian Normal") { SECTION("Explicit") { - REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::BIG) == + HasReturnvaluesIF::RETURN_OK); } SECTION("Network 0") { - REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.deSerialize(&ptr, &len, SerializeIF::Endianness::NETWORK) == + HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { REQUIRE(simpleSer.SerializeIF::deSerializeBe(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); @@ -132,18 +153,24 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { } SECTION("Big Endian Simple") { + size_t deserLen = 0xff; SECTION("Explicit") { - REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::BIG) == + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(), + SerializeIF::Endianness::BIG) == HasReturnvaluesIF::RETURN_OK); } SECTION("Network 0") { - REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size(), SerializeIF::Endianness::NETWORK) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size(), + SerializeIF::Endianness::NETWORK) == + HasReturnvaluesIF::RETURN_OK); } SECTION("Network 1") { - REQUIRE(simpleSer.SerializeIF::deSerializeBe(buf.data(), buf.size()) == HasReturnvaluesIF::RETURN_OK); + REQUIRE(simpleSer.SerializeIF::deSerializeBe(buf.data(), deserLen, buf.size()) == + HasReturnvaluesIF::RETURN_OK); } CHECK(simpleSer.getU8() == 5); CHECK(simpleSer.getU16() == 1); + CHECK(deserLen == 3); } SECTION("Machine Endian Implicit") { @@ -160,7 +187,8 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { } SECTION("Machine Endian Simple Implicit") { - REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), buf.size()) == + size_t deserLen = 0xff; + REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(simpleSer.getU8() == 5); #if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN @@ -168,5 +196,6 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { #else CHECK(simpleSer.getU16() == 1); #endif + CHECK(deserLen == 3); } } \ No newline at end of file From 03e12a2388902cd178c4443fd17c9db789166a5d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 29 Jul 2022 14:15:05 +0200 Subject: [PATCH 59/74] new object ID type --- src/fsfw/objectmanager/SystemObjectIF.h | 2 +- src/fsfw/util/ObjectId.h | 57 ++++++++++++++++++ src/fsfw/util/UnsignedByteField.h | 52 +++++++++++++++++ unittests/CMakeLists.txt | 1 + unittests/util/CMakeLists.txt | 4 ++ unittests/util/testObjectId.cpp | 23 ++++++++ unittests/util/testUnsignedByteField.cpp | 74 ++++++++++++++++++++++++ 7 files changed, 212 insertions(+), 1 deletion(-) create mode 100644 src/fsfw/util/ObjectId.h create mode 100644 src/fsfw/util/UnsignedByteField.h create mode 100644 unittests/util/CMakeLists.txt create mode 100644 unittests/util/testObjectId.cpp create mode 100644 unittests/util/testUnsignedByteField.cpp diff --git a/src/fsfw/objectmanager/SystemObjectIF.h b/src/fsfw/objectmanager/SystemObjectIF.h index 72fe9044..99e26b9c 100644 --- a/src/fsfw/objectmanager/SystemObjectIF.h +++ b/src/fsfw/objectmanager/SystemObjectIF.h @@ -16,7 +16,7 @@ * This is the typedef for object identifiers. * @ingroup system_objects */ -typedef uint32_t object_id_t; +using object_id_t = uint32_t; /** * This interface allows a class to be included in the object manager diff --git a/src/fsfw/util/ObjectId.h b/src/fsfw/util/ObjectId.h new file mode 100644 index 00000000..b51f63e6 --- /dev/null +++ b/src/fsfw/util/ObjectId.h @@ -0,0 +1,57 @@ +#ifndef FSFW_UTIL_OBJECTID_H +#define FSFW_UTIL_OBJECTID_H + +#include "fsfw/objectmanager.h" +#include "UnsignedByteField.h" + +#include + +class ObjectId: public UnsignedByteField { + public: + ObjectId(object_id_t id, const char* name): UnsignedByteField(id), name_(name) {} + + [[nodiscard]] const char* name() const { + return name_; + } + + [[nodiscard]] object_id_t id() const { + return getValue(); + } + + bool operator==(const ObjectId& other) const { + return id() == other.id(); + } + + bool operator!=(const ObjectId& other) const { + return id() != other.id(); + } + + bool operator<(const ObjectId& other) const { + return id() < other.id(); + } + + bool operator>(const ObjectId& other) const { + return id() > other.id(); + } + + bool operator>=(const ObjectId& other) const { + return id() >= other.id(); + } + + bool operator<=(const ObjectId& other) const { + return id() <= other.id(); + } + private: + const char* name_; +}; + +template<> +struct std::hash +{ + std::size_t operator()(ObjectId const& s) const noexcept + { + return std::hash{}(s.id()); + } +}; + +#endif // FSFW_UTIL_OBJECTID_H diff --git a/src/fsfw/util/UnsignedByteField.h b/src/fsfw/util/UnsignedByteField.h new file mode 100644 index 00000000..b02e8b3a --- /dev/null +++ b/src/fsfw/util/UnsignedByteField.h @@ -0,0 +1,52 @@ +#ifndef FSFW_UTIL_UNSIGNEDBYTEFIELD_H +#define FSFW_UTIL_UNSIGNEDBYTEFIELD_H + +#include "fsfw/serialize.h" + +template +class UnsignedByteField: public SerializeIF { + public: + static_assert(std::is_unsigned::value); + + explicit UnsignedByteField(T value): value(value) {} + [[nodiscard]] ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, + Endianness streamEndianness) const override { + return SerializeAdapter::serialize(&value, buffer, size, maxSize, streamEndianness); + } + + ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, + Endianness streamEndianness) override { + return SerializeAdapter::deSerialize(&value, buffer, size, streamEndianness); + } + + [[nodiscard]] size_t getSerializedSize() const override { + return sizeof(T); + } + + [[nodiscard]] T getValue() const { + return value; + } + + void setValue(T value_) { + value = value_; + } + private: + T value; +}; + +class U32ByteField: public UnsignedByteField { + public: + explicit U32ByteField(uint32_t value): UnsignedByteField(value) {} +}; + +class U16ByteField: public UnsignedByteField { + public: + explicit U16ByteField(uint16_t value): UnsignedByteField(value) {} +}; + +class U8ByteField: public UnsignedByteField { + public: + explicit U8ByteField(uint8_t value): UnsignedByteField(value) {} +}; + +#endif // FSFW_UTIL_UNSIGNEDBYTEFIELD_H diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index f32c6e08..8c7f2463 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -15,6 +15,7 @@ add_subdirectory(mocks) add_subdirectory(action) add_subdirectory(power) +add_subdirectory(util) add_subdirectory(container) add_subdirectory(osal) add_subdirectory(serialize) diff --git a/unittests/util/CMakeLists.txt b/unittests/util/CMakeLists.txt new file mode 100644 index 00000000..b79b77db --- /dev/null +++ b/unittests/util/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${FSFW_TEST_TGT} PRIVATE + testUnsignedByteField.cpp + testObjectId.cpp +) diff --git a/unittests/util/testObjectId.cpp b/unittests/util/testObjectId.cpp new file mode 100644 index 00000000..f8dd48ea --- /dev/null +++ b/unittests/util/testObjectId.cpp @@ -0,0 +1,23 @@ +#include + +#include "fsfw/util/ObjectId.h" +#include + +TEST_CASE("Object Id", "[object-id]") { + auto objectId = ObjectId(10, "TEST_ID"); + std::map testMap; + + SECTION("State") { + CHECK(objectId.id() == 10); + CHECK(std::strcmp(objectId.name(), "TEST_ID") == 0); + } + + SECTION("ID as map key") { + auto insertPair = testMap.emplace(objectId, 10); + CHECK(insertPair.second); + auto iter = testMap.find(objectId); + CHECK(iter != testMap.end()); + CHECK(std::strcmp(iter->first.name(), "TEST_ID") == 0); + CHECK(iter->second == 10); + } +} \ No newline at end of file diff --git a/unittests/util/testUnsignedByteField.cpp b/unittests/util/testUnsignedByteField.cpp new file mode 100644 index 00000000..54757f8c --- /dev/null +++ b/unittests/util/testUnsignedByteField.cpp @@ -0,0 +1,74 @@ + +#include + +#include "fsfw/util/UnsignedByteField.h" + +#include + +TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") { + auto testByteField = UnsignedByteField(10); + auto u32ByteField = U32ByteField(10); + auto u16ByteField = U16ByteField(5); + auto u8ByteField = U8ByteField(2); + std::array buf{}; + size_t serLen = 0; + SECTION("State") { + CHECK(testByteField.getValue() == 10); + CHECK(testByteField.getSerializedSize() == 4); + CHECK(u32ByteField.getValue() == 10); + CHECK(u32ByteField.getSerializedSize() == 4); + CHECK(u16ByteField.getValue() == 5); + CHECK(u8ByteField.getValue() == 2); + CHECK(u8ByteField.getSerializedSize() == 1); + } + + SECTION("Setter") { + u32ByteField.setValue(20); + REQUIRE(u32ByteField.getValue() == 20); + } + + SECTION("Serialize U32") { + CHECK(testByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(serLen == 4); + CHECK(buf[0] == 0); + CHECK(buf[3] == 10); + } + + SECTION("Serialize U32 Concrete") { + CHECK(u32ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(serLen == 4); + CHECK(buf[0] == 0); + CHECK(buf[3] == 10); + } + + SECTION("Serialize U16 Concrete") { + CHECK(u16ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(serLen == 2); + CHECK(buf[0] == 0); + CHECK(buf[1] == 5); + } + + SECTION("Serialize U8 Concrete") { + CHECK(u8ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(serLen == 1); + CHECK(buf[0] == 2); + } + + SECTION("Deserialize") { + buf[0] = 0x50; + buf[1] = 0x40; + buf[2] = 0x30; + buf[3] = 0x20; + size_t deserLen = 0; + CHECK(testByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == result::OK); + CHECK(testByteField.getValue() == 0x50403020); + } + + SECTION("Deserialize U16") { + buf[0] = 0x50; + buf[1] = 0x40; + size_t deserLen = 0; + CHECK(u16ByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == result::OK); + CHECK(u16ByteField.getValue() == 0x5040); + } +} \ No newline at end of file From 47e148af8fd21898134d5a7d37848e8f3e8f8c04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 29 Jul 2022 14:19:10 +0200 Subject: [PATCH 60/74] decoupling --- unittests/util/testUnsignedByteField.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/unittests/util/testUnsignedByteField.cpp b/unittests/util/testUnsignedByteField.cpp index 54757f8c..9a67c092 100644 --- a/unittests/util/testUnsignedByteField.cpp +++ b/unittests/util/testUnsignedByteField.cpp @@ -28,28 +28,28 @@ TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") { } SECTION("Serialize U32") { - CHECK(testByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(testByteField.serializeBe(buf.data(), serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(serLen == 4); CHECK(buf[0] == 0); CHECK(buf[3] == 10); } SECTION("Serialize U32 Concrete") { - CHECK(u32ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(u32ByteField.serializeBe(buf.data(), serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(serLen == 4); CHECK(buf[0] == 0); CHECK(buf[3] == 10); } SECTION("Serialize U16 Concrete") { - CHECK(u16ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(u16ByteField.serializeBe(buf.data(), serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(serLen == 2); CHECK(buf[0] == 0); CHECK(buf[1] == 5); } SECTION("Serialize U8 Concrete") { - CHECK(u8ByteField.serializeBe(buf.data(), serLen, buf.size()) == result::OK); + CHECK(u8ByteField.serializeBe(buf.data(), serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(serLen == 1); CHECK(buf[0] == 2); } @@ -60,7 +60,7 @@ TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") { buf[2] = 0x30; buf[3] = 0x20; size_t deserLen = 0; - CHECK(testByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == result::OK); + CHECK(testByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(testByteField.getValue() == 0x50403020); } @@ -68,7 +68,7 @@ TEST_CASE("Unsigned Byte Field", "[unsigned-byte-field]") { buf[0] = 0x50; buf[1] = 0x40; size_t deserLen = 0; - CHECK(u16ByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == result::OK); + CHECK(u16ByteField.deSerializeBe(buf.data(), deserLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); CHECK(u16ByteField.getValue() == 0x5040); } } \ No newline at end of file From 4a4d23573d11834d9575875a3c772cb9cc7bf1f9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 29 Jul 2022 14:24:16 +0200 Subject: [PATCH 61/74] verify correct key behaviour --- unittests/util/testObjectId.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/unittests/util/testObjectId.cpp b/unittests/util/testObjectId.cpp index f8dd48ea..cead2c15 100644 --- a/unittests/util/testObjectId.cpp +++ b/unittests/util/testObjectId.cpp @@ -19,5 +19,8 @@ TEST_CASE("Object Id", "[object-id]") { CHECK(iter != testMap.end()); CHECK(std::strcmp(iter->first.name(), "TEST_ID") == 0); CHECK(iter->second == 10); + auto otherIdSameName = ObjectId(12, "TEST_ID"); + insertPair = testMap.emplace(otherIdSameName, 10); + CHECK(insertPair.second); } } \ No newline at end of file From 96f092ef75a0b2209407d8faed5a11eae203c037 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 29 Jul 2022 14:30:58 +0200 Subject: [PATCH 62/74] type correction --- src/fsfw/util/ObjectId.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/util/ObjectId.h b/src/fsfw/util/ObjectId.h index b51f63e6..5b1cf461 100644 --- a/src/fsfw/util/ObjectId.h +++ b/src/fsfw/util/ObjectId.h @@ -50,7 +50,7 @@ struct std::hash { std::size_t operator()(ObjectId const& s) const noexcept { - return std::hash{}(s.id()); + return std::hash{}(s.id()); } }; From 52ee50ba8c616f736dc107c007688a5cf03b50c1 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 1 Aug 2022 16:21:07 +0200 Subject: [PATCH 63/74] Fixed cmake variable for tests in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 847e5e9a..1b2ca52d 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ You can use the following commands inside the `fsfw` folder to set up the build ```sh mkdir build-tests && cd build-tests -cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. +cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. ``` You can also use `-DFSFW_OSAL=linux` on Linux systems. From 1db04cf20c6250fd02a1dd19f4bd8bd796130708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20M=C3=BCller?= Date: Mon, 1 Aug 2022 20:45:39 +0200 Subject: [PATCH 64/74] Update 'docs/getting_started.rst' Update for new recommended build folder and cmake define name --- docs/getting_started.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 01724b3a..9e739f8b 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -105,8 +105,8 @@ You can use the following commands inside the ``fsfw`` folder to set up the buil .. code-block:: console - mkdir build-tests && cd build-tests - cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host .. + mkdir cmake-build-tests && cd cmake-build-tests + cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host .. You can also use ``-DFSFW_OSAL=linux`` on Linux systems. From 19817bd3a582a42e457526a22d52bd84cc74be58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20M=C3=BCller?= Date: Mon, 1 Aug 2022 20:47:53 +0200 Subject: [PATCH 65/74] Update 'docs/getting_started.rst' Actually, this version still uses old folder names --- docs/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 9e739f8b..4f8ae543 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -105,7 +105,7 @@ You can use the following commands inside the ``fsfw`` folder to set up the buil .. code-block:: console - mkdir cmake-build-tests && cd cmake-build-tests + mkdir build-tests && cd build-tests cmake -DFSFW_BUILD_TESTS=ON -DFSFW_OSAL=host .. From 03fa77e2b305d66b65d6db8f1181972b7b2643d2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 12:29:10 +0200 Subject: [PATCH 66/74] get current uptime correctly --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 8efac940..da977fdc 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -377,6 +377,8 @@ void DeviceHandlerBase::doStateMachine() { setMode(MODE_OFF); break; } + uint32_t currentUptime; + Clock::getUptime(¤tUptime); if (currentUptime - timeoutStart >= powerSwitcher->getSwitchDelayMs()) { triggerEvent(MODE_TRANSITION_FAILED, PowerSwitchIF::SWITCH_TIMEOUT, 0); setMode(MODE_ERROR_ON); From fdcfd89ed271118ddb2daf0de3db5d69bdbc95d4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 12:55:31 +0200 Subject: [PATCH 67/74] add some Linux HAL options --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7de32501..79fd3e59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,11 @@ 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) +if(UNIX) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) +endif() + # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) From 8b4253bc46818852d4ea7913540366b69338452e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 12 Aug 2022 13:02:30 +0200 Subject: [PATCH 68/74] update cmakelists.txt --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfae2acb..1f99086b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,11 @@ 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) +if(UNIX) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) +endif() + # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) @@ -183,7 +188,10 @@ if(FSFW_BUILD_TESTS) endif() endif() -message(STATUS "${MSG_PREFIX} Finding and/or providing ETL library") +message( + STATUS + "${MSG_PREFIX} Finding and/or providing etl library with version ${FSFW_ETL_LIB_MAJOR_VERSION}" +) # Check whether the user has already installed ETL first find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET) @@ -191,7 +199,7 @@ find_package(${FSFW_ETL_LIB_NAME} ${FSFW_ETL_LIB_MAJOR_VERSION} QUIET) if(NOT ${FSFW_ETL_LIB_NAME}_FOUND) message( STATUS - "No ETL installation was found with find_package. Installing and providing " + "${MSG_PREFIX} No ETL installation was found with find_package. Installing and providing " "etl with FindPackage") include(FetchContent) From b28c26b288ca9e261a95d9564202336fb3c5cf5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 10:49:00 +0200 Subject: [PATCH 69/74] group MGM data in local pool vectors --- CMakeLists.txt | 6 +++++ .../devicehandlers/MgmLIS3MDLHandler.cpp | 27 ++++++++----------- .../devicehandlers/MgmLIS3MDLHandler.h | 2 ++ .../devicehandlers/MgmRM3100Handler.cpp | 11 ++++---- .../devicehandlers/MgmRM3100Handler.h | 1 + .../devicedefinitions/MgmLIS3HandlerDefs.h | 14 ++++------ .../devicedefinitions/MgmRM3100HandlerDefs.h | 14 ++++------ 7 files changed, 35 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cfae2acb..95c00f28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,12 @@ 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) +if(UNIX) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" + OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) +endif() + # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) diff --git a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp index 644b488d..5ddc3245 100644 --- a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp +++ b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp @@ -286,26 +286,22 @@ ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, cons PoolReadGuard readHelper(&dataset); if (readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if (std::abs(mgmX) > absLimitX or std::abs(mgmY) > absLimitY or + std::abs(mgmZ) > absLimitZ) { + dataset.fieldStrengths.setValid(false); + } if (std::abs(mgmX) < absLimitX) { - dataset.fieldStrengthX = mgmX; - dataset.fieldStrengthX.setValid(true); - } else { - dataset.fieldStrengthX.setValid(false); + dataset.fieldStrengths[0] = mgmX; } if (std::abs(mgmY) < absLimitY) { - dataset.fieldStrengthY = mgmY; - dataset.fieldStrengthY.setValid(true); - } else { - dataset.fieldStrengthY.setValid(false); + dataset.fieldStrengths[1] = mgmY; } if (std::abs(mgmZ) < absLimitZ) { - dataset.fieldStrengthZ = mgmZ; - dataset.fieldStrengthZ.setValid(true); - } else { - dataset.fieldStrengthZ.setValid(false); + dataset.fieldStrengths[2] = mgmZ; } + dataset.fieldStrengths.setValid(true); } break; } @@ -468,10 +464,9 @@ void MgmLIS3MDLHandler::modeChanged(void) { internalState = InternalState::STATE ReturnValue_t MgmLIS3MDLHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z, new PoolEntry({0.0})); - localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, new PoolEntry({0.0})); + localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTHS, &mgmXYZ); + localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, &temperature); + poolManager.subscribeForPeriodicPacket(dataset.getSid(), false, 10.0, false); return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h index 42bd5d4c..3250a739 100644 --- a/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h +++ b/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h @@ -103,6 +103,8 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase { CommunicationStep communicationStep = CommunicationStep::DATA; bool commandExecuted = false; + PoolEntry mgmXYZ = PoolEntry(3); + PoolEntry temperature = PoolEntry(); /*------------------------------------------------------------------------*/ /* Device specific commands and variables */ /*------------------------------------------------------------------------*/ diff --git a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp index f9929d63..c329f5a6 100644 --- a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp +++ b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -309,9 +309,8 @@ void MgmRM3100Handler::modeChanged(void) { internalState = InternalState::NONE; ReturnValue_t MgmRM3100Handler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry({0.0})); - localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry({0.0})); + localDataPoolMap.emplace(RM3100::FIELD_STRENGTHS, &mgmXYZ); + poolManager.subscribeForPeriodicPacket(primaryDataset.getSid(), false, 10.0, false); return HasReturnvaluesIF::RETURN_OK; } @@ -354,9 +353,9 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) { // TODO: Sanity check on values? PoolReadGuard readGuard(&primaryDataset); if (readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - primaryDataset.fieldStrengthX = fieldStrengthX; - primaryDataset.fieldStrengthY = fieldStrengthY; - primaryDataset.fieldStrengthZ = fieldStrengthZ; + primaryDataset.fieldStrengths[0] = fieldStrengthX; + primaryDataset.fieldStrengths[1] = fieldStrengthY; + primaryDataset.fieldStrengths[2] = fieldStrengthZ; primaryDataset.setValidity(true, true); } return RETURN_OK; diff --git a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h index d1048cb6..d45b2404 100644 --- a/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h +++ b/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h @@ -85,6 +85,7 @@ class MgmRM3100Handler : public DeviceHandlerBase { bool goToNormalModeAtStartup = false; uint32_t transitionDelay; + PoolEntry mgmXYZ = PoolEntry(3); ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, size_t commandDataLen); diff --git a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h index 3d78c5c9..34237637 100644 --- a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h +++ b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h @@ -139,12 +139,7 @@ static const uint8_t CTRL_REG5_DEFAULT = 0; static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA; -enum MgmPoolIds : lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, - TEMPERATURE_CELCIUS -}; +enum MgmPoolIds : lp_id_t { FIELD_STRENGTHS, TEMPERATURE_CELCIUS }; class MgmPrimaryDataset : public StaticLocalDataSet<4> { public: @@ -152,9 +147,10 @@ class MgmPrimaryDataset : public StaticLocalDataSet<4> { MgmPrimaryDataset(object_id_t mgmId) : StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {} - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, FIELD_STRENGTH_Z, this); + /** + * Field strenghts in uT + */ + lp_vec_t fieldStrengths = lp_vec_t(sid.objectId, FIELD_STRENGTHS, this); lp_var_t temperature = lp_var_t(sid.objectId, TEMPERATURE_CELCIUS, this); }; diff --git a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h index e3eaff22..a2aa8ab0 100644 --- a/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h +++ b/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h @@ -101,11 +101,7 @@ class CycleCountCommand : public SerialLinkedListAdapter { static constexpr uint32_t MGM_DATASET_ID = READ_DATA; -enum MgmPoolIds : lp_id_t { - FIELD_STRENGTH_X, - FIELD_STRENGTH_Y, - FIELD_STRENGTH_Z, -}; +enum MgmPoolIds : lp_id_t { FIELD_STRENGTHS }; class Rm3100PrimaryDataset : public StaticLocalDataSet<3> { public: @@ -113,10 +109,10 @@ class Rm3100PrimaryDataset : public StaticLocalDataSet<3> { Rm3100PrimaryDataset(object_id_t mgmId) : StaticLocalDataSet(sid_t(mgmId, MGM_DATASET_ID)) {} - // Field strengths in micro Tesla. - lp_var_t fieldStrengthX = lp_var_t(sid.objectId, FIELD_STRENGTH_X, this); - lp_var_t fieldStrengthY = lp_var_t(sid.objectId, FIELD_STRENGTH_Y, this); - lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, FIELD_STRENGTH_Z, this); + /** + * Field strenghts in uT + */ + lp_vec_t fieldStrengths = lp_vec_t(sid.objectId, FIELD_STRENGTHS, this); }; } // namespace RM3100 From f4c4f9946c7fb9fd050178baa4865da654366b70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 11:18:53 +0200 Subject: [PATCH 70/74] printout preproc block --- src/fsfw/pus/Service3Housekeeping.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsfw/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp index 97addd7c..aa1bf824 100644 --- a/src/fsfw/pus/Service3Housekeeping.cpp +++ b/src/fsfw/pus/Service3Housekeeping.cpp @@ -249,9 +249,12 @@ void Service3Housekeeping::handleUnrequestedReply(CommandMessage* reply) { break; } case (CommandMessage::REPLY_REJECTED): { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "Service3Housekeeping::handleUnrequestedReply: Unexpected reply " "rejected with error code" << reply->getParameter() << std::endl; +#else +#endif break; } From d3cabd8984a69febfcf53979cfc0320e628beb95 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 11:26:29 +0200 Subject: [PATCH 71/74] afmt --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f99086b..5351aeb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,8 +119,9 @@ option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF) option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) if(UNIX) - option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" OFF) - option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) + option(FSFW_HAL_LINUX_ADD_PERIPHERAL_DRIVERS "Add Linux peripheral drivers" + OFF) + option(FSFW_HAL_LINUX_ADD_LIBGPIOD "Attempt to add Linux GPIOD drivers" OFF) endif() # Optional sources From deeeef553b118192d45a921d6d3a1a3b5881ebd7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 14:34:04 +0200 Subject: [PATCH 72/74] remove implicit machine endianness variants --- src/fsfw/serialize/SerializeIF.h | 26 ----------- unittests/serialize/testSerializeIF.cpp | 57 ------------------------- 2 files changed, 83 deletions(-) diff --git a/src/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h index 5e7a2fb9..f20bf21f 100644 --- a/src/fsfw/serialize/SerializeIF.h +++ b/src/fsfw/serialize/SerializeIF.h @@ -68,13 +68,6 @@ class SerializeIF { size_t maxSize) const { return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, - size_t maxSize) const { - return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); - } /** * Gets the size of a object if it would be serialized in a buffer @@ -110,12 +103,6 @@ class SerializeIF { virtual ReturnValue_t deSerializeBe(const uint8_t **buffer, size_t *size) { return deSerialize(buffer, size, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size) { - return deSerialize(buffer, size, SerializeIF::Endianness::MACHINE); - } /** * Helper method which can be used if serialization should be performed without any additional @@ -139,13 +126,6 @@ class SerializeIF { size_t maxSize) const { return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - [[nodiscard]] virtual ReturnValue_t serialize(uint8_t *buffer, size_t &serLen, - size_t maxSize) const { - return serialize(buffer, serLen, maxSize, SerializeIF::Endianness::MACHINE); - } /** * Helper methods which can be used if deserialization should be performed without any additional @@ -168,12 +148,6 @@ class SerializeIF { virtual ReturnValue_t deSerializeBe(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::NETWORK); } - /** - * If endianness is not explicitly specified, use machine endianness - */ - virtual ReturnValue_t deSerialize(const uint8_t *buffer, size_t &deserSize, size_t maxSize) { - return deSerialize(buffer, deserSize, maxSize, SerializeIF::Endianness::MACHINE); - } }; #endif /* FSFW_SERIALIZE_SERIALIZEIF_H_ */ diff --git a/unittests/serialize/testSerializeIF.cpp b/unittests/serialize/testSerializeIF.cpp index 5200f8b7..7aafe98f 100644 --- a/unittests/serialize/testSerializeIF.cpp +++ b/unittests/serialize/testSerializeIF.cpp @@ -76,37 +76,6 @@ TEST_CASE("Serialize IF Serialize", "[serialize-if-ser]") { CHECK(buf[2] == 3); CHECK(serLen == 3); } - - SECTION("Machine Endian Implicit") { - REQUIRE(simpleSer.SerializeIF::serialize(&ptr, &len, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(buf[0] == 1); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(buf[1] == 3); - CHECK(buf[2] == 2); -#else - CHECK(buf[1] == 2); - CHECK(buf[2] == 3); -#endif - // Verify pointer arithmetic and size increment - CHECK(ptr == buf.data() + 3); - CHECK(len == 3); - } - - SECTION("Machine Endian Simple Implicit") { - size_t serLen = 0xff; - REQUIRE(simpleSer.SerializeIF::serialize(buf.data(), serLen, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(buf[0] == 1); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(buf[1] == 3); - CHECK(buf[2] == 2); -#else - CHECK(buf[1] == 2); - CHECK(buf[2] == 3); -#endif - CHECK(serLen == 3); - } } TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { @@ -172,30 +141,4 @@ TEST_CASE("SerializeIF Deserialize", "[serialize-if-de]") { CHECK(simpleSer.getU16() == 1); CHECK(deserLen == 3); } - - SECTION("Machine Endian Implicit") { - REQUIRE(simpleSer.SerializeIF::deSerialize(&ptr, &len) == HasReturnvaluesIF::RETURN_OK); - CHECK(simpleSer.getU8() == 5); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(simpleSer.getU16() == 0x0100); -#else - CHECK(simpleSer.getU16() == 1); -#endif - // Verify pointer arithmetic and size increment - CHECK(ptr == buf.data() + 3); - CHECK(len == 0); - } - - SECTION("Machine Endian Simple Implicit") { - size_t deserLen = 0xff; - REQUIRE(simpleSer.SerializeIF::deSerialize(buf.data(), deserLen, buf.size()) == - HasReturnvaluesIF::RETURN_OK); - CHECK(simpleSer.getU8() == 5); -#if BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - CHECK(simpleSer.getU16() == 0x0100); -#else - CHECK(simpleSer.getU16() == 1); -#endif - CHECK(deserLen == 3); - } } \ No newline at end of file From ca2efb60218b85414bc3857d1ce57a6f798f6c23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 15:02:05 +0200 Subject: [PATCH 73/74] remove object ID --- src/fsfw/util/ObjectId.h | 57 --------------------------------- unittests/util/CMakeLists.txt | 1 - unittests/util/testObjectId.cpp | 26 --------------- 3 files changed, 84 deletions(-) delete mode 100644 src/fsfw/util/ObjectId.h delete mode 100644 unittests/util/testObjectId.cpp diff --git a/src/fsfw/util/ObjectId.h b/src/fsfw/util/ObjectId.h deleted file mode 100644 index 5b1cf461..00000000 --- a/src/fsfw/util/ObjectId.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef FSFW_UTIL_OBJECTID_H -#define FSFW_UTIL_OBJECTID_H - -#include "fsfw/objectmanager.h" -#include "UnsignedByteField.h" - -#include - -class ObjectId: public UnsignedByteField { - public: - ObjectId(object_id_t id, const char* name): UnsignedByteField(id), name_(name) {} - - [[nodiscard]] const char* name() const { - return name_; - } - - [[nodiscard]] object_id_t id() const { - return getValue(); - } - - bool operator==(const ObjectId& other) const { - return id() == other.id(); - } - - bool operator!=(const ObjectId& other) const { - return id() != other.id(); - } - - bool operator<(const ObjectId& other) const { - return id() < other.id(); - } - - bool operator>(const ObjectId& other) const { - return id() > other.id(); - } - - bool operator>=(const ObjectId& other) const { - return id() >= other.id(); - } - - bool operator<=(const ObjectId& other) const { - return id() <= other.id(); - } - private: - const char* name_; -}; - -template<> -struct std::hash -{ - std::size_t operator()(ObjectId const& s) const noexcept - { - return std::hash{}(s.id()); - } -}; - -#endif // FSFW_UTIL_OBJECTID_H diff --git a/unittests/util/CMakeLists.txt b/unittests/util/CMakeLists.txt index b79b77db..d4caa4d5 100644 --- a/unittests/util/CMakeLists.txt +++ b/unittests/util/CMakeLists.txt @@ -1,4 +1,3 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testUnsignedByteField.cpp - testObjectId.cpp ) diff --git a/unittests/util/testObjectId.cpp b/unittests/util/testObjectId.cpp deleted file mode 100644 index cead2c15..00000000 --- a/unittests/util/testObjectId.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -#include "fsfw/util/ObjectId.h" -#include - -TEST_CASE("Object Id", "[object-id]") { - auto objectId = ObjectId(10, "TEST_ID"); - std::map testMap; - - SECTION("State") { - CHECK(objectId.id() == 10); - CHECK(std::strcmp(objectId.name(), "TEST_ID") == 0); - } - - SECTION("ID as map key") { - auto insertPair = testMap.emplace(objectId, 10); - CHECK(insertPair.second); - auto iter = testMap.find(objectId); - CHECK(iter != testMap.end()); - CHECK(std::strcmp(iter->first.name(), "TEST_ID") == 0); - CHECK(iter->second == 10); - auto otherIdSameName = ObjectId(12, "TEST_ID"); - insertPair = testMap.emplace(otherIdSameName, 10); - CHECK(insertPair.second); - } -} \ No newline at end of file From 9d64b96e9a1375f920707a720cfd664f5937322e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 15 Aug 2022 15:02:39 +0200 Subject: [PATCH 74/74] update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f83c5078..bf50b683 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). # [unreleased] +## Added + +- Add new `UnsignedByteField` class + # [v5.0.0] 25.07.2022 ## Changes