1
0
forked from fsfw/fsfw

clang -Weverything -Wno-gnu-anonymous-struct

This commit is contained in:
2023-01-26 23:22:13 +01:00
parent 9589d702dd
commit bc312243df
39 changed files with 97 additions and 86 deletions

View File

@ -69,8 +69,8 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") {
// Bit 4: Segment metadata flag is set
// Bit 5 to seven: length of transaction seq num is 2
REQUIRE(fileDataBuffer[3] == 0b10101010);
REQUIRE((fileDataBuffer[10] >> 6) &
0b11 == cfdp::RecordContinuationState::CONTAINS_START_AND_END);
REQUIRE(((fileDataBuffer[10] >> 6) & 0b11) ==
cfdp::RecordContinuationState::CONTAINS_START_AND_END);
// Segment metadata length
REQUIRE((fileDataBuffer[10] & 0x3f) == 10);
buffer = fileDataBuffer.data() + 11;

View File

@ -14,7 +14,7 @@ class DeviceHandlerCommander : public ExecutableObjectIF,
DeviceHandlerCommander(object_id_t objectId);
virtual ~DeviceHandlerCommander();
ReturnValue_t performOperation(uint8_t operationCode = 0);
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
ReturnValue_t initialize() override;
MessageQueueIF* getCommandQueuePtr() override;
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;

View File

@ -19,7 +19,7 @@ using namespace std;
* - To be safe, whenever there is a path object to be passed as C string into the FSFW API,
* it needs to be converted to std::string and then .c_str() can be used to get a C string
* Note: path.string().c_string() does not work as it is returning a pointer to a temporary
*/
*/
TEST_CASE("Host Filesystem", "[hal][host]") {
namespace fs = filesystem;
@ -226,8 +226,7 @@ TEST_CASE("Host Filesystem", "[hal][host]") {
CHECK(fs::is_regular_file(fileInDir0));
// See note at the top
std::string dir0_string = dir0.string();
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) ==
returnvalue::OK);
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) == returnvalue::OK);
CHECK(not fs::is_directory(dir0));
CHECK(not fs::is_regular_file(fileInDir0));
}

View File

@ -6,8 +6,7 @@
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
// not multibyte encoding safe!
std::filesystem::path::string_type native_filename(filename.begin(),
filename.end());
std::filesystem::path::string_type native_filename(filename.begin(), filename.end());
if (not std::filesystem::exists(native_filename)) {
return returnvalue::FAILED;
@ -58,8 +57,7 @@ ReturnValue_t FilesystemMock::createFile(FilesystemParams params, const uint8_t
return returnvalue::OK;
}
ReturnValue_t FilesystemMock::removeFile(const char *path,
FileSystemArgsIF *args) {
ReturnValue_t FilesystemMock::removeFile(const char *path, FileSystemArgsIF *args) {
std::string filename_c(path);
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
@ -88,8 +86,7 @@ ReturnValue_t FilesystemMock::removeDirectory(FilesystemParams params, bool dele
return returnvalue::OK;
}
ReturnValue_t FilesystemMock::rename(const char *oldPath,
const char *newPath,
ReturnValue_t FilesystemMock::rename(const char *oldPath, const char *newPath,
FileSystemArgsIF *args) {
renameQueue.push(RenameInfo(oldPath, newPath));
return returnvalue::OK;

View File

@ -1,12 +1,12 @@
#ifndef FSFW_MOCKS_FILESYSTEMMOCK_H
#define FSFW_MOCKS_FILESYSTEMMOCK_H
#include <filesystem>
#include <fstream>
#include <map>
#include <queue>
#include <string>
#include <utility>
#include <filesystem>
#include "fsfw/filesystem.h"
@ -21,8 +21,8 @@
class FilesystemMock : public HasFileSystemIF {
public:
struct FileWriteInfo {
FileWriteInfo(std::filesystem::path::string_type filename, size_t offset,
const uint8_t *data, size_t len)
FileWriteInfo(std::filesystem::path::string_type filename, size_t offset, const uint8_t *data,
size_t len)
: offset(offset) {
this->filename = filename;
this->data.insert(this->data.end(), data, data + len);
@ -49,14 +49,14 @@ class FilesystemMock : public HasFileSystemIF {
std::map<std::filesystem::path::string_type, DirInfo> dirMap;
struct RenameInfo {
RenameInfo(const char* oldName, const char *newName)
RenameInfo(const char *oldName, const char *newName)
: oldName(std::move(oldName)), newName(std::move(newName)) {}
const char *oldName;
const char *newName;
};
std::queue<RenameInfo> renameQueue;
const char* truncateCalledOnFile;
const char *truncateCalledOnFile;
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
bool fileExists(FilesystemParams params) override;
@ -66,13 +66,10 @@ class FilesystemMock : public HasFileSystemIF {
ReturnValue_t readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
size_t maxSize) override;
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) override;
ReturnValue_t removeFile(const char *path,
FileSystemArgsIF *args) override;
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
ReturnValue_t rename(const char *oldPath,
const char *newPath,
FileSystemArgsIF *args) override;
ReturnValue_t rename(const char *oldPath, const char *newPath, FileSystemArgsIF *args) override;
void reset();

View File

@ -13,7 +13,7 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
/* Add polling sequence table here */
thisSequence->addSlot(objects::TEST_DEVICE, 0, DeviceHandlerIF::PERFORM_OPERATION);
thisSequence->addSlot(objects::TEST_DEVICE, 0.3, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TEST_DEVICE, 0.3 * length, DeviceHandlerIF::SEND_WRITE);
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length, DeviceHandlerIF::GET_WRITE);
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length, DeviceHandlerIF::SEND_READ);
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length, DeviceHandlerIF::GET_READ);