windows unittests succeed
fsfw/fsfw/pipeline/head This commit looks good Details

This commit is contained in:
Ulrich Mohr 2023-01-26 18:14:35 +01:00
parent c66fab90f9
commit 9589d702dd
8 changed files with 17 additions and 13 deletions

View File

@ -3,7 +3,7 @@
#include "fsfw/serialize/SerializeAdapter.h"
#include "fsfw/serviceinterface.h"
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, size_t value) : VarLenField() {
cfdp::VarLenField::VarLenField(cfdp::WidthInBytes width, uint64_t value) : VarLenField() {
ReturnValue_t result = this->setValue(width, value);
if (result != returnvalue::OK) {
#if FSFW_DISABLE_PRINTOUT == 0
@ -20,7 +20,7 @@ cfdp::VarLenField::VarLenField() : width(cfdp::WidthInBytes::ONE_BYTE) { value.o
cfdp::WidthInBytes cfdp::VarLenField::getWidth() const { return width; }
ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_t value_) {
ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, uint64_t value_) {
switch (widthInBytes) {
case (cfdp::WidthInBytes::ONE_BYTE): {
if (value_ > UINT8_MAX) {
@ -51,7 +51,7 @@ ReturnValue_t cfdp::VarLenField::setValue(cfdp::WidthInBytes widthInBytes, size_
return returnvalue::OK;
}
size_t cfdp::VarLenField::getValue() const {
uint64_t cfdp::VarLenField::getValue() const {
switch (width) {
case (cfdp::WidthInBytes::ONE_BYTE): {
return value.oneByte;

View File

@ -25,13 +25,13 @@ class VarLenField : public SerializeIF {
template <typename T>
explicit VarLenField(UnsignedByteField<T> byteField);
VarLenField(cfdp::WidthInBytes width, size_t value);
VarLenField(cfdp::WidthInBytes width, uint64_t value);
bool operator==(const VarLenField &other) const;
bool operator!=(const VarLenField &other) const;
bool operator<(const VarLenField &other) const;
ReturnValue_t setValue(cfdp::WidthInBytes, size_t value);
ReturnValue_t setValue(cfdp::WidthInBytes, uint64_t value);
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override;
@ -42,7 +42,7 @@ class VarLenField : public SerializeIF {
Endianness streamEndianness);
[[nodiscard]] cfdp::WidthInBytes getWidth() const;
[[nodiscard]] size_t getValue() const;
[[nodiscard]] uint64_t getValue() const;
#if FSFW_CPP_OSTREAM_ENABLED == 1
friend std::ostream &operator<<(std::ostream &os, const VarLenField &id) {

View File

@ -42,6 +42,6 @@ size_t EofInfo::getSerializedSize(bool fssLarge) {
return size;
}
ReturnValue_t EofInfo::setFileSize(size_t fileSize, bool isLarge) {
ReturnValue_t EofInfo::setFileSize(uint64_t fileSize, bool isLarge) {
return this->fileSize.setFileSize(fileSize, isLarge);
}

View File

@ -21,7 +21,7 @@ struct EofInfo {
void setChecksum(uint32_t checksum);
void setConditionCode(cfdp::ConditionCode conditionCode);
void setFaultLoc(EntityIdTlv* faultLoc);
ReturnValue_t setFileSize(size_t size, bool isLarge);
ReturnValue_t setFileSize(uint64_t size, bool isLarge);
private:
cfdp::ConditionCode conditionCode;

View File

@ -109,7 +109,7 @@ ReturnValue_t LocalPool::deleteData(uint8_t* ptr, size_t size, store_address_t*
ReturnValue_t result = ILLEGAL_ADDRESS;
for (uint16_t n = 0; n < NUMBER_OF_SUBPOOLS; n++) {
// Not sure if new allocates all stores in order. so better be careful.
if ((store[n].data() <= ptr) and (&store[n][numberOfElements[n] * elementSizes[n]] > ptr)) {
if ((store[n].data() <= ptr) and (&store[n][numberOfElements[n] * elementSizes[n] - 1] >= ptr)) {
localId.poolIndex = n;
uint32_t deltaAddress = ptr - store[n].data();
// Getting any data from the right "block" is ok.

View File

@ -42,7 +42,9 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
REQUIRE(sz == 20);
eofInfo.setConditionCode(cfdp::ConditionCode::FILESTORE_REJECTION);
eofInfo.setFileSize(0x10ffffff10, true);
uint64_t value = 0x13ffffffff;
size_t vlaue1 = value;
eofInfo.setFileSize(0x13fffefd10, true);
pduConf.largeFile = true;
// Should serialize with fault location now
auto serializeWithFaultLocation = EofPduCreator(pduConf, eofInfo);
@ -57,7 +59,7 @@ TEST_CASE("EOF PDU", "[cfdp][pdu]") {
uint64_t fileSizeLarge = 0;
result = SerializeAdapter::deSerialize(&fileSizeLarge, buf.data() + 16, nullptr,
SerializeIF::Endianness::NETWORK);
REQUIRE(fileSizeLarge == 0x10ffffff10);
REQUIRE(fileSizeLarge == 0x13fffefd10);
REQUIRE(buf[sz - 4] == cfdp::TlvType::ENTITY_ID);
// width of entity ID is 2
REQUIRE(buf[sz - 3] == 2);

View File

@ -40,7 +40,6 @@ TEST_CASE("PlacementFactory Tests", "[containers]") {
REQUIRE(storagePool.getFreeElement(&address, sizeof(uint64_t), &ptr) ==
static_cast<int>(returnvalue::OK));
REQUIRE(storagePool.deleteData(address) == static_cast<int>(returnvalue::OK));
// Check that PlacementFactory checks for nullptr
ptr = nullptr;
REQUIRE(factory.destroy(ptr) == static_cast<int>(returnvalue::FAILED));

View File

@ -221,9 +221,12 @@ TEST_CASE("Host Filesystem", "[hal][host]") {
SECTION("Remove recursively") {
fs::create_directory(dir0.string().c_str());
ofstream of(fileInDir0);
of.close();
CHECK(fs::is_directory(dir0));
CHECK(fs::is_regular_file(fileInDir0));
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0.string().c_str()), true) ==
// See note at the top
std::string dir0_string = dir0.string();
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) ==
returnvalue::OK);
CHECK(not fs::is_directory(dir0));
CHECK(not fs::is_regular_file(fileInDir0));