Unit test for Internal Error Reporter #563

Merged
gaisser merged 9 commits from gaisser/fsfw:gaisser_unit_test_internal_error into development 2022-02-28 15:26:01 +01:00
Showing only changes of commit 45ea09291a - Show all commits

View File

@ -3,6 +3,7 @@
#include <fsfw/internalerror/InternalErrorReporter.h>
#include <fsfw/objectmanager/ObjectManager.h>
#include <fsfw/timemanager/CCSDSTime.h>
#include <fsfw/housekeeping/HousekeepingSnapshot.h>
#include <array>
#include <catch2/catch_test_macros.hpp>
@ -34,6 +35,7 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
REQUIRE(result == retval::CATCH_OK);
internalErrorReporter->performOperation(0);
uint32_t queueHits = 0;
{
CommandMessage hkMessage;
result = hkQueue->receiveMessage(&hkMessage);
@ -45,10 +47,13 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
InternalErrorDataset dataset(objects::NO_OBJECT);
CCSDSTime::CDS_short time;
ConstAccessorPair data = ipcStore->getData(storeAddress);
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
HousekeepingSnapshot hkSnapshot(&time, &dataset);
const uint8_t* buffer = data.second.data();
size_t size = data.second.size();
hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
queueHits = dataset.queueHits.value;
}
result = hkQueue->sendMessage(testQueue->getId(), &message);
REQUIRE(result == MessageQueueIF::FULL);
@ -64,6 +69,14 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
ConstAccessorPair data = ipcStore->getData(storeAddress);
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
CCSDSTime::CDS_short time;
InternalErrorDataset dataset(objects::NO_OBJECT);
HousekeepingSnapshot hkSnapshot(&time, &dataset);
const uint8_t* buffer = data.second.data();
size_t size = data.second.size();
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
REQUIRE(dataset.queueHits == (queueHits + 1));
}
}
delete testQueue;