tests running again

This commit is contained in:
Robin Müller 2022-07-27 21:06:23 +02:00
parent 7e8afcc12f
commit 93acac02f5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
10 changed files with 35 additions and 19 deletions

View File

@ -50,13 +50,15 @@ ReturnValue_t Service1TelecommandVerification::sendVerificationReport(
PusVerificationMessage* message) { PusVerificationMessage* message) {
ReturnValue_t result; ReturnValue_t result;
uint8_t reportId = message->getReportId(); uint8_t reportId = message->getReportId();
if(reportId == 0 or reportId > 8) { if (reportId == 0 or reportId > 8) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID " << sif::error << "Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
static_cast<int>(reportId) << " detected" << std::endl; << static_cast<int>(reportId) << " detected" << std::endl;
#else #else
sif::printError("Service1TelecommandVerification::sendVerificationReport: Invalid report ID " sif::printError(
"%d detected\n", reportId); "Service1TelecommandVerification::sendVerificationReport: Invalid report ID "
"%d detected\n",
reportId);
#endif #endif
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }

View File

@ -64,13 +64,13 @@ class SerializeIF {
/** /**
* Forwards to regular @serialize call with big (network) endianness * Forwards to regular @serialize call with big (network) endianness
*/ */
virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, size_t maxSize) { virtual ReturnValue_t serializeBe(uint8_t **buffer, size_t *size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK); return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
} }
/** /**
* If endianness is not explicitly specified, use machine endianness * If endianness is not explicitly specified, use machine endianness
*/ */
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) { virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE); return serialize(buffer, size, maxSize, SerializeIF::Endianness::MACHINE);
} }

View File

@ -146,3 +146,11 @@ void PusTmCreator::setSubservice(uint8_t subservice) {
pusParams.secHeader.subservice = subservice; pusParams.secHeader.subservice = subservice;
} }
bool PusTmCreator::crcCalculationEnabled() const { return calculateCrcOnSerialization; } bool PusTmCreator::crcCalculationEnabled() const { return calculateCrcOnSerialization; }
ReturnValue_t PusTmCreator::serialize(uint8_t** buffer, size_t* size, size_t maxSize) const {
return serialize(buffer, size, maxSize, SerializeIF::Endianness::NETWORK);
}
ReturnValue_t PusTmCreator::serialize(uint8_t* buffer, size_t maxSize) const {
return SerializeIF::serialize(buffer, maxSize, SerializeIF::Endianness::NETWORK);
}

View File

@ -72,6 +72,9 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
uint8_t getScTimeRefStatus() override; uint8_t getScTimeRefStatus() override;
uint16_t getMessageTypeCounter() override; uint16_t getMessageTypeCounter() override;
uint16_t getDestId() override; uint16_t getDestId() override;
// Override these to use default big endianness
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize) const override;
ReturnValue_t serialize(uint8_t* buffer, size_t maxSize) const override;
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;

View File

@ -140,9 +140,10 @@ void PusServiceBase::setErrorReporter(InternalErrorReporterIF& errReporter_) {
psbParams.errReporter = &errReporter_; psbParams.errReporter = &errReporter_;
} }
ReturnValue_t PusServiceBase::initializeTmHelpers(TmSendHelper& tmSendHelper, TmStoreHelper& tmStoreHelper) { ReturnValue_t PusServiceBase::initializeTmHelpers(TmSendHelper& tmSendHelper,
TmStoreHelper& tmStoreHelper) {
ReturnValue_t result = initializeTmSendHelper(tmSendHelper); ReturnValue_t result = initializeTmSendHelper(tmSendHelper);
if(result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }
return initializeTmStoreHelper(tmStoreHelper); return initializeTmStoreHelper(tmStoreHelper);
@ -166,11 +167,11 @@ ReturnValue_t PusServiceBase::initializeTmSendHelper(TmSendHelper& tmSendHelper)
return RETURN_OK; return RETURN_OK;
} }
ReturnValue_t PusServiceBase::initializeTmStoreHelper(TmStoreHelper& tmStoreHelper) const { ReturnValue_t PusServiceBase::initializeTmStoreHelper(TmStoreHelper& tmStoreHelper) const {
tmStoreHelper.setApid(psbParams.apid); tmStoreHelper.setApid(psbParams.apid);
if(tmStoreHelper.getTmStore() == nullptr) { if (tmStoreHelper.getTmStore() == nullptr) {
auto* tmStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE); auto* tmStore = ObjectManager::instance()->get<StorageManagerIF>(objects::TM_STORE);
if(tmStore == nullptr) { if (tmStore == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }
tmStoreHelper.setTmStore(*tmStore); tmStoreHelper.setTmStore(*tmStore);

View File

@ -78,7 +78,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override { ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override {
return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK); return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK);
} }
size_t getTimestampLen() override { return getSerializedSize(); }
timeval &getTime() override { return dummyTime; } timeval &getTime() override { return dummyTime; }
private: private:

View File

@ -24,7 +24,7 @@ TEST_CASE("CCSDS Low Level", "[ccsds-ll]") {
uint16_t packetIdRaw = 0x3ff; uint16_t packetIdRaw = 0x3ff;
ccsds::setPacketId(header, packetIdRaw); ccsds::setPacketId(header, packetIdRaw);
ccsds::setApid(header, 0x1ff); ccsds::setApid(header, 0x1ff);
REQUIRE(ccsds::getPacketId(header) == 0x1ff); REQUIRE(ccsds::getPacketId(header) == 0x3ff);
} }
SECTION("Lowlevel Packet Length Test") { SECTION("Lowlevel Packet Length Test") {

View File

@ -44,7 +44,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
} }
SECTION("Serialization") { SECTION("Serialization") {
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); REQUIRE(creator.SerializeIF::serializeBe(&dataPtr, &serLen, buf.size()) ==
HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf[0] == 0x08); REQUIRE(buf[0] == 0x08);
REQUIRE(buf[1] == 0xef); REQUIRE(buf[1] == 0xef);
// Unsegmented is the default // Unsegmented is the default
@ -105,7 +106,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
std::array<uint8_t, 3> data{1, 2, 3}; std::array<uint8_t, 3> data{1, 2, 3};
creator.setRawUserData(data.data(), data.size()); creator.setRawUserData(data.data(), data.size());
REQUIRE(creator.getFullPacketLen() == 25); REQUIRE(creator.getFullPacketLen() == 25);
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); REQUIRE(creator.SerializeIF::serialize(&dataPtr, &serLen, buf.size()) ==
HasReturnvaluesIF::RETURN_OK);
REQUIRE(buf[20] == 1); REQUIRE(buf[20] == 1);
REQUIRE(buf[21] == 2); REQUIRE(buf[21] == 2);
REQUIRE(buf[22] == 3); REQUIRE(buf[22] == 3);
@ -139,7 +141,8 @@ TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
for (size_t maxSize = 0; maxSize < reqSize; maxSize++) { for (size_t maxSize = 0; maxSize < reqSize; maxSize++) {
dataPtr = buf.data(); dataPtr = buf.data();
serLen = 0; serLen = 0;
REQUIRE(creator.serialize(&dataPtr, &serLen, maxSize) == SerializeIF::BUFFER_TOO_SHORT); REQUIRE(creator.SerializeIF::serialize(&dataPtr, &serLen, maxSize) ==
SerializeIF::BUFFER_TOO_SHORT);
} }
} }
} }

View File

@ -22,7 +22,7 @@ TEST_CASE("PUS TM Reader", "[pus-tm-reader]") {
bool deleteReader = false; bool deleteReader = false;
dataPtr = buf.data(); dataPtr = buf.data();
serLen = 0; serLen = 0;
REQUIRE(creator.serialize(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK); REQUIRE(creator.serializeBe(&dataPtr, &serLen, buf.size()) == HasReturnvaluesIF::RETURN_OK);
REQUIRE(not(*readerPtr)); REQUIRE(not(*readerPtr));
REQUIRE(readerPtr->isNull()); REQUIRE(readerPtr->isNull());

View File

@ -57,7 +57,7 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") {
SECTION("Two Arg CTOR") { SECTION("Two Arg CTOR") {
TmSendHelper helper(msgQueue, errReporter); TmSendHelper helper(msgQueue, errReporter);
REQUIRE(helper.getInternalErrorReporter() == &errReporter); REQUIRE(helper.getInternalErrorReporter() == &errReporter);
REQUIRE(helper.getDefaultDestination() == MessageQueueIF::NO_QUEUE); REQUIRE(helper.getDefaultDestination() == 2);
REQUIRE(helper.getMsgQueue() == &msgQueue); REQUIRE(helper.getMsgQueue() == &msgQueue);
} }
SECTION("Send") { SECTION("Send") {