Fixed an issue in host OSAL and added more coverage to IER
This commit is contained in:
parent
45ea09291a
commit
a50b52df51
@ -84,7 +84,7 @@ ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "initialize", HasReturnvaluesIF::RETURN_FAILED,
|
printWarningOrError(sif::OutputTypes::OUT_WARNING, "initializeHousekeepingPoolEntriesOnce", HasReturnvaluesIF::RETURN_FAILED,
|
||||||
"The map should only be initialized once");
|
"The map should only be initialized once");
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
@ -125,6 +125,13 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
|
|||||||
memcpy(targetQueue->messageQueue.back().data(), message->getBuffer(),
|
memcpy(targetQueue->messageQueue.back().data(), message->getBuffer(),
|
||||||
message->getMaximumMessageSize());
|
message->getMaximumMessageSize());
|
||||||
} else {
|
} else {
|
||||||
|
if (not ignoreFault) {
|
||||||
|
InternalErrorReporterIF* internalErrorReporter =
|
||||||
|
ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
if (internalErrorReporter != nullptr) {
|
||||||
|
internalErrorReporter->queueMessageNotSent();
|
||||||
|
}
|
||||||
|
}
|
||||||
return MessageQueueIF::FULL;
|
return MessageQueueIF::FULL;
|
||||||
}
|
}
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
|
@ -23,6 +23,9 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
}
|
}
|
||||||
InternalErrorReporter* internalErrorReporter =
|
InternalErrorReporter* internalErrorReporter =
|
||||||
dynamic_cast<InternalErrorReporter*>(ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER));
|
dynamic_cast<InternalErrorReporter*>(ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER));
|
||||||
|
if(internalErrorReporter == nullptr){
|
||||||
|
FAIL();
|
||||||
|
}
|
||||||
task.addComponent(objects::INTERNAL_ERROR_REPORTER);
|
task.addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
MessageQueueIF* testQueue = QueueFactory::instance()->createMessageQueue(1);
|
MessageQueueIF* testQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||||
MessageQueueIF* hkQueue = QueueFactory::instance()->createMessageQueue(1);
|
MessageQueueIF* hkQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||||
@ -34,8 +37,13 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
ActionMessage::setCompletionReply(&message, 10, true);
|
ActionMessage::setCompletionReply(&message, 10, true);
|
||||||
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
||||||
REQUIRE(result == retval::CATCH_OK);
|
REQUIRE(result == retval::CATCH_OK);
|
||||||
internalErrorReporter->performOperation(0);
|
|
||||||
uint32_t queueHits = 0;
|
uint32_t queueHits = 0;
|
||||||
|
uint32_t lostTm = 0;
|
||||||
|
uint32_t storeHits = 0;
|
||||||
|
/* We don't know if another test caused a queue Hit so we will enforce one,
|
||||||
|
then remeber the queueHit count and force another hit */
|
||||||
|
internalErrorReporter->queueMessageNotSent();
|
||||||
|
internalErrorReporter->performOperation(0);
|
||||||
{
|
{
|
||||||
CommandMessage hkMessage;
|
CommandMessage hkMessage;
|
||||||
result = hkQueue->receiveMessage(&hkMessage);
|
result = hkQueue->receiveMessage(&hkMessage);
|
||||||
@ -44,7 +52,8 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
gp_id_t gpid = HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
gp_id_t gpid = HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
||||||
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
||||||
InternalErrorDataset dataset(objects::NO_OBJECT);
|
// We need the object ID of the reporter here (NO_OBJECT)
|
||||||
|
InternalErrorDataset dataset(objects::INTERNAL_ERROR_REPORTER);
|
||||||
CCSDSTime::CDS_short time;
|
CCSDSTime::CDS_short time;
|
||||||
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
||||||
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
||||||
@ -53,10 +62,15 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
size_t size = data.second.size();
|
size_t size = data.second.size();
|
||||||
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
||||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
// Remember the amount of queueHits before to see the increase
|
||||||
queueHits = dataset.queueHits.value;
|
queueHits = dataset.queueHits.value;
|
||||||
|
lostTm = dataset.tmHits.value;
|
||||||
|
storeHits = dataset.storeHits.value;
|
||||||
}
|
}
|
||||||
result = hkQueue->sendMessage(testQueue->getId(), &message);
|
result = hkQueue->sendMessage(testQueue->getId(), &message);
|
||||||
REQUIRE(result == MessageQueueIF::FULL);
|
REQUIRE(result == MessageQueueIF::FULL);
|
||||||
|
internalErrorReporter->lostTm();
|
||||||
|
internalErrorReporter->storeFull();
|
||||||
{
|
{
|
||||||
internalErrorReporter->performOperation(0);
|
internalErrorReporter->performOperation(0);
|
||||||
CommandMessage hkMessage;
|
CommandMessage hkMessage;
|
||||||
@ -70,15 +84,19 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
||||||
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
||||||
CCSDSTime::CDS_short time;
|
CCSDSTime::CDS_short time;
|
||||||
InternalErrorDataset dataset(objects::NO_OBJECT);
|
// We need the object ID of the reporter here (NO_OBJECT)
|
||||||
|
InternalErrorDataset dataset(objects::INTERNAL_ERROR_REPORTER);
|
||||||
HousekeepingSnapshot hkSnapshot(&time, &dataset);
|
HousekeepingSnapshot hkSnapshot(&time, &dataset);
|
||||||
const uint8_t* buffer = data.second.data();
|
const uint8_t* buffer = data.second.data();
|
||||||
size_t size = data.second.size();
|
size_t size = data.second.size();
|
||||||
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
||||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
REQUIRE(dataset.queueHits == (queueHits + 1));
|
// Test that we had one more queueHit
|
||||||
|
REQUIRE(dataset.queueHits.value == (queueHits + 1));
|
||||||
|
REQUIRE(dataset.tmHits.value == (lostTm + 1));
|
||||||
|
REQUIRE(dataset.storeHits.value == (storeHits + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete testQueue;
|
QueueFactory::instance()->deleteMessageQueue(testQueue);
|
||||||
delete hkQueue;
|
QueueFactory::instance()->deleteMessageQueue(hkQueue);
|
||||||
}
|
}
|
@ -54,6 +54,6 @@ TEST_CASE("MessageQueue Basic Test", "[TestMq]") {
|
|||||||
CHECK(recvMessage.getData()[0] == 42);
|
CHECK(recvMessage.getData()[0] == 42);
|
||||||
}
|
}
|
||||||
// We have to clear MQs ourself ATM
|
// We have to clear MQs ourself ATM
|
||||||
delete testSenderMq;
|
QueueFactory::instance()->deleteMessageQueue(testSenderMq);
|
||||||
delete testReceiverMq;
|
QueueFactory::instance()->deleteMessageQueue(testReceiverMq);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user