Merge remote-tracking branch 'upstream/development' into mohr/merge-upstream

This commit is contained in:
2022-09-14 12:54:15 +02:00
48 changed files with 315 additions and 381 deletions

View File

@ -18,6 +18,7 @@ add_subdirectory(power)
add_subdirectory(util)
add_subdirectory(container)
add_subdirectory(osal)
add_subdirectory(pus)
add_subdirectory(serialize)
add_subdirectory(datapoollocal)
add_subdirectory(storagemanager)

View File

@ -4,9 +4,9 @@
#include <array>
#include "fsfw/timemanager/TimeReaderIF.h"
#include "fsfw/timemanager/TimeStamperIF.h"
#include "fsfw/timemanager/TimeWriterIF.h"
class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
class CdsShortTimestamperMock : public TimeWriterIF, public TimeReaderIF {
public:
unsigned int serializeCallCount = 0;
unsigned int deserializeCallCount = 0;
@ -61,7 +61,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
}
[[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); }
ReturnValue_t addTimeStamp(uint8_t *buffer, uint8_t maxSize) override { return 0; }
void reset() {
serializeCallCount = 0;
@ -75,9 +74,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
serFailRetval = returnvalue::FAILED;
}
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override {
return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK);
}
timeval &getTime() override { return dummyTime; }
private:

View File

@ -0,0 +1,3 @@
target_sources(${FSFW_TEST_TGT} PRIVATE
testService11.cpp
)

View File

@ -0,0 +1,14 @@
#include <fsfw/pus/Service11TelecommandScheduling.h>
#include <catch2/catch_test_macros.hpp>
#include "objects/systemObjectList.h"
#include "tmtc/apid.h"
#include "tmtc/pusIds.h"
TEST_CASE("PUS Service 11", "[pus-srvc11]") {
Service11TelecommandScheduling<13> pusService11(
{objects::PUS_SERVICE_11_TC_SCHEDULER, apid::DEFAULT_APID, pus::PUS_SERVICE_11}, nullptr);
// TODO test something...
}

View File

@ -64,7 +64,8 @@ TEST_CASE("Serial Buffer Adapter", "[single-file]") {
SECTION("Test set buffer function") {
SerialBufferAdapter<uint8_t> tv_serial_buffer_adapter_loc =
SerialBufferAdapter<uint8_t>((uint8_t*)nullptr, 0, true);
tv_serial_buffer_adapter_loc.setBuffer(test_serial_buffer.data(), test_serial_buffer.size());
tv_serial_buffer_adapter_loc.setConstBuffer(test_serial_buffer.data(),
test_serial_buffer.size());
serialized_size = 0;
arrayPtr = testArray.data();
SerializeAdapter::serialize(&test_value_bool, &arrayPtr, &serialized_size, testArray.size(),

View File

@ -71,7 +71,7 @@ TEST_CASE("PUS TC Creator", "[pus-tc-creator]") {
SECTION("Test with Application Data Raw") {
auto& params = creator.getPusParams();
std::array<uint8_t, 3> data{1, 2, 3};
params.dataWrapper.setRawData({data.data(), data.size()});
params.setRawAppData(data.data(), data.size());
// To get correct size information, the SP length field needs to be updated automatically
REQUIRE(creator.getSerializedSize() == 13);
creator.updateSpLengthField();

View File

@ -44,9 +44,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(creator.getSubService() == 2);
REQUIRE(creator.getService() == 17);
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == util::DataTypes::RAW);
REQUIRE(params.dataWrapper.dataUnion.raw.data == nullptr);
REQUIRE(params.dataWrapper.dataUnion.raw.len == 0);
REQUIRE(params.sourceData == nullptr);
REQUIRE(tmHelper.sendCounter == 0);
REQUIRE(tmHelper.storeAndSendTmPacket() == returnvalue::OK);
REQUIRE(tmHelper.sendCounter == 1);
@ -65,9 +63,9 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, data.data(), data.size()) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == util::DataTypes::RAW);
REQUIRE(params.dataWrapper.dataUnion.raw.data == data.data());
REQUIRE(params.dataWrapper.dataUnion.raw.len == data.size());
REQUIRE(params.sourceData != nullptr);
REQUIRE(params.sourceData->getSerializedSize() == data.size());
REQUIRE(params.adapter.getConstBuffer() == data.data());
}
SECTION("Serializable Helper") {
@ -75,8 +73,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, simpleSer) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == util::DataTypes::SERIALIZABLE);
REQUIRE(params.dataWrapper.dataUnion.serializable == &simpleSer);
REQUIRE(params.sourceData == &simpleSer);
}
SECTION("Object ID prefix Helper") {
@ -86,8 +83,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
REQUIRE(tmHelper.prepareTmPacket(2, dataWithObjId) == returnvalue::OK);
auto& creator = storeHelper.getCreatorRef();
auto& params = creator.getParams();
REQUIRE(params.dataWrapper.type == util::DataTypes::SERIALIZABLE);
REQUIRE(params.dataWrapper.dataUnion.serializable == &dataWithObjId);
REQUIRE(params.sourceData == &dataWithObjId);
}
// TODO: Error handling