Merge branch 'development' into mueller/mac-os

This commit is contained in:
Robin Müller 2022-05-02 15:15:53 +02:00
commit cddf16f941
8 changed files with 40 additions and 16 deletions

View File

@ -18,7 +18,7 @@ set(FSFW_ETL_LINK_TARGET etl::etl)
set(FSFW_CATCH2_LIB_MAJOR_VERSION 3 CACHE STRING set(FSFW_CATCH2_LIB_MAJOR_VERSION 3 CACHE STRING
"Catch2 library major version requirement" "Catch2 library major version requirement"
) )
set(FSFW_CATCH2_LIB_VERSION v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview4 CACHE STRING set(FSFW_CATCH2_LIB_VERSION v${FSFW_CATCH2_LIB_MAJOR_VERSION}.0.0-preview5 CACHE STRING
"Catch2 library exact version requirement" "Catch2 library exact version requirement"
) )
@ -135,6 +135,7 @@ if(FSFW_FETCH_CONTENT_TARGETS)
endif() endif()
if(TARGET Catch2) if(TARGET Catch2)
# Fixes regression -preview4, to be confirmed in later releases # Fixes regression -preview4, to be confirmed in later releases
# Related GitHub issue: https://github.com/catchorg/Catch2/issues/2417
set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "") set_target_properties(Catch2 PROPERTIES DEBUG_POSTFIX "")
endif() endif()
endif() endif()

View File

@ -6,3 +6,9 @@ RUN apt-get --yes upgrade
#tzdata is a dependency, won't install otherwise #tzdata is a dependency, won't install otherwise
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano iputils-ping
RUN git clone https://github.com/catchorg/Catch2.git && \
cd Catch2 && \
git checkout v3.0.0-preview5 && \
cmake -Bbuild -H. -DBUILD_TESTING=OFF && \
cmake --build build/ --target install

View File

@ -3,7 +3,7 @@ pipeline {
BUILDDIR = 'build-tests' BUILDDIR = 'build-tests'
} }
agent { agent {
docker { image 'fsfw-ci:d1'} docker { image 'fsfw-ci:d2'}
} }
stages { stages {
stage('Clean') { stage('Clean') {

View File

@ -10,16 +10,23 @@ class HybridIterator : public LinkedElement<T>::Iterator, public ArrayList<T, co
HybridIterator() {} HybridIterator() {}
HybridIterator(typename LinkedElement<T>::Iterator *iter) HybridIterator(typename LinkedElement<T>::Iterator *iter)
: LinkedElement<T>::Iterator(*iter), value(iter->value), linked(true) {} : LinkedElement<T>::Iterator(*iter), linked(true) {
if (iter != nullptr) {
value = iter->value;
}
}
HybridIterator(LinkedElement<T> *start) HybridIterator(LinkedElement<T> *start) : LinkedElement<T>::Iterator(start), linked(true) {
: LinkedElement<T>::Iterator(start), value(start->value), linked(true) {} if (start != nullptr) {
value = start->value;
}
}
HybridIterator(typename ArrayList<T, count_t>::Iterator start, HybridIterator(typename ArrayList<T, count_t>::Iterator start,
typename ArrayList<T, count_t>::Iterator end) typename ArrayList<T, count_t>::Iterator end)
: ArrayList<T, count_t>::Iterator(start), value(start.value), linked(false), end(end.value) { : ArrayList<T, count_t>::Iterator(start), value(start.value), linked(false), end(end.value) {
if (value == this->end) { if (value == this->end) {
value = NULL; value = nullptr;
} }
} }

View File

@ -179,6 +179,9 @@ class MatchTree : public SerializeableMatcherIF<T>, public BinaryTree<Serializea
virtual ReturnValue_t cleanUpElement(iterator position) { return HasReturnvaluesIF::RETURN_OK; } virtual ReturnValue_t cleanUpElement(iterator position) { return HasReturnvaluesIF::RETURN_OK; }
bool matchSubtree(iterator iter, T number) { bool matchSubtree(iterator iter, T number) {
if (iter == nullptr) {
return false;
}
bool isMatch = iter->match(number); bool isMatch = iter->match(number);
if (isMatch) { if (isMatch) {
if (iter.left() == this->end()) { if (iter.left() == this->end()) {

View File

@ -30,11 +30,11 @@ ReturnValue_t Subsystem::checkSequence(HybridIterator<ModeListEntry> iter,
return FALLBACK_SEQUENCE_DOES_NOT_EXIST; return FALLBACK_SEQUENCE_DOES_NOT_EXIST;
} }
if (iter.value == NULL) { if (iter.value == nullptr) {
return NO_TARGET_TABLE; return NO_TARGET_TABLE;
} }
for (; iter.value != NULL; ++iter) { for (; iter.value != nullptr; ++iter) {
if (!existsModeTable(iter->getTableId())) { if (!existsModeTable(iter->getTableId())) {
return TABLE_DOES_NOT_EXIST; return TABLE_DOES_NOT_EXIST;
} else { } else {
@ -66,13 +66,18 @@ HybridIterator<ModeListEntry> Subsystem::getCurrentTable() {
void Subsystem::performChildOperation() { void Subsystem::performChildOperation() {
if (isInTransition) { if (isInTransition) {
if (commandsOutstanding <= 0) { // all children of the current table were commanded and replied if (commandsOutstanding <= 0) { // all children of the current table were commanded and replied
if (currentSequenceIterator.value == NULL) { // we're through with this sequence if (currentSequenceIterator.value == nullptr) { // we're through with this sequence
if (checkStateAgainstTable(currentTargetTable, targetSubmode) == RETURN_OK) { if (checkStateAgainstTable(currentTargetTable, targetSubmode) == RETURN_OK) {
setMode(targetMode, targetSubmode); setMode(targetMode, targetSubmode);
isInTransition = false; isInTransition = false;
return; return;
} else { } else {
transitionFailed(TARGET_TABLE_NOT_REACHED, getSequence(targetMode)->getTableId()); Mode_t tableId = 0;
auto seq = getSequence(targetMode);
if (seq.value != nullptr) {
tableId = seq->getTableId();
}
transitionFailed(TARGET_TABLE_NOT_REACHED, tableId);
return; return;
} }
} }
@ -248,10 +253,13 @@ ReturnValue_t Subsystem::handleCommandMessage(CommandMessage *message) {
case ModeSequenceMessage::READ_TABLE: { case ModeSequenceMessage::READ_TABLE: {
ReturnValue_t result; ReturnValue_t result;
Mode_t table = ModeSequenceMessage::getSequenceId(message); Mode_t table = ModeSequenceMessage::getSequenceId(message);
EntryPointer *entry = NULL; EntryPointer *entry = nullptr;
result = modeTables.find(table, &entry); result = modeTables.find(table, &entry);
if (result != RETURN_OK) { if (result != RETURN_OK or entry == nullptr) {
replyToCommand(result, 0); replyToCommand(result, 0);
if (entry == nullptr) {
return result;
}
} }
SerializeIF *elements[2]; SerializeIF *elements[2];

View File

@ -1,14 +1,13 @@
#ifndef FSFW_SUBSYSTEM_SUBSYSTEM_H_ #ifndef FSFW_SUBSYSTEM_SUBSYSTEM_H_
#define FSFW_SUBSYSTEM_SUBSYSTEM_H_ #define FSFW_SUBSYSTEM_SUBSYSTEM_H_
#include <FSFWConfig.h>
#include "../container/FixedArrayList.h" #include "../container/FixedArrayList.h"
#include "../container/FixedMap.h" #include "../container/FixedMap.h"
#include "../container/HybridIterator.h" #include "../container/HybridIterator.h"
#include "../container/SinglyLinkedList.h" #include "../container/SinglyLinkedList.h"
#include "../serialize/SerialArrayListAdapter.h" #include "../serialize/SerialArrayListAdapter.h"
#include "SubsystemBase.h" #include "SubsystemBase.h"
#include "fsfw/FSFW.h"
#include "modes/ModeDefinitions.h" #include "modes/ModeDefinitions.h"
/** /**

View File

@ -19,8 +19,8 @@ SpacePacket::SpacePacket(uint16_t packetDataLength, bool isTelecommand, uint16_t
SpacePacket::~SpacePacket(void) {} SpacePacket::~SpacePacket(void) {}
bool SpacePacket::addWholeData(const uint8_t* p_Data, uint32_t packet_size) { bool SpacePacket::addWholeData(const uint8_t* p_Data, uint32_t packet_size) {
if (packet_size <= sizeof(this->data)) { if (packet_size <= sizeof(this->localData)) {
memcpy(&this->localData.byteStream, p_Data, packet_size); memcpy(this->localData.byteStream, p_Data, packet_size);
return true; return true;
} else { } else {
return false; return false;