start verifying metadata PDU
This commit is contained in:
parent
3167988951
commit
c075f27e20
@ -284,7 +284,7 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
|
||||
uint8_t* dataPtr;
|
||||
store_address_t storeId;
|
||||
ReturnValue_t result =
|
||||
fsfwParams.tcStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
|
||||
fsfwParams.tmStore->getFreeElement(&storeId, pdu.getSerializedSize(), &dataPtr);
|
||||
if (result != OK) {
|
||||
// TODO: Better error handling?
|
||||
return result;
|
||||
@ -294,8 +294,8 @@ ReturnValue_t cfdp::SourceHandler::sendGenericPdu(const SerializeIF& pdu) const
|
||||
if (result != OK) {
|
||||
return result;
|
||||
}
|
||||
TmTcMessage tcMsg(storeId);
|
||||
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tcMsg);
|
||||
TmTcMessage tmMsg(storeId);
|
||||
return fsfwParams.msgQueue->sendMessage(fsfwParams.packetDest.getReportReceptionQueue(), &tmMsg);
|
||||
}
|
||||
|
||||
ReturnValue_t cfdp::SourceHandler::noticeOfCompletion() {
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
class MetadataGenericInfo {
|
||||
public:
|
||||
MetadataGenericInfo() = default;
|
||||
explicit MetadataGenericInfo(cfdp::Fss fileSize);
|
||||
MetadataGenericInfo(bool closureRequested, cfdp::ChecksumType checksumType, cfdp::Fss fileSize);
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
||||
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
|
||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||
#include "fsfw/util/SeqCountProvider.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
@ -66,9 +67,18 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
||||
CHECK(fsmResult.packetsSent == 1);
|
||||
CHECK(mqMock.numberOfSentMessages() == 1);
|
||||
CommandMessage msg;
|
||||
CHECK(mqMock.getNextSentMessage(destQueueId, msg) == OK);
|
||||
REQUIRE(mqMock.getNextSentMessage(destQueueId, msg) == OK);
|
||||
store_address_t storeId = CfdpMessage::getStoreId(&msg);
|
||||
auto accessor = tmStore.getData(storeId);
|
||||
// CHECK(fsmResult.)
|
||||
REQUIRE(accessor.first == OK);
|
||||
const uint8_t* pduPtr = accessor.second.data();
|
||||
MetadataGenericInfo metadataInfo;
|
||||
MetadataPduReader metadataReader(pduPtr, accessor.second.size(), metadataInfo, nullptr, 0);
|
||||
size_t srcFileSize = 0;
|
||||
REQUIRE(metadataReader.parseData() == OK);
|
||||
const char* srcNameRead = metadataReader.getSourceFileName().getString(srcFileSize);
|
||||
REQUIRE(srcNameRead != nullptr);
|
||||
std::string srcNameReadStr(srcNameRead, srcFileSize);
|
||||
CHECK(std::string(srcFileName.path) == srcNameReadStr);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user