Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Svc/FpySequencer/FpySequencerRunState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,16 @@ Fw::Success FpySequencer::deserializeDirective(const Fpy::Statement& stmt, Direc
}
break;
}
case Fpy::DirectiveId::POP_SERIALIZABLE: {
new (&deserializedDirective.popSerializable) FpySequencer_PopSerializableDirective();
status = argBuf.deserializeTo(deserializedDirective.popSerializable);
if (status != Fw::SerializeStatus::FW_SERIALIZE_OK || argBuf.getDeserializeSizeLeft() != 0) {
this->log_WARNING_HI_DirectiveDeserializeError(stmt.get_opCode(), this->currentStatementIdx(), status,
argBuf.getDeserializeSizeLeft(), argBuf.getSize());
return Fw::Success::FAILURE;
}
break;
}
default: {
// unsure what this opcode is. check compiler version matches sequencer
this->log_WARNING_HI_UnknownSequencerDirective(stmt.get_opCode(), this->currentStatementIdx(),
Expand Down
20 changes: 20 additions & 0 deletions Svc/FpySequencer/test/ut/FpySequencerTestMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3607,6 +3607,26 @@ TEST_F(FpySequencerTester, deserialize_popEvent) {
ASSERT_EQ(result, Fw::Success::SUCCESS);
}

TEST_F(FpySequencerTester, deserialize_popSerializable) {
FpySequencer::DirectiveUnion actual;
FpySequencer_PopSerializableDirective popSerializable(0, 4);
add_POP_SERIALIZABLE(popSerializable);
Fw::Success result = tester_deserializeDirective(seq.get_statements()[0], actual);
ASSERT_EQ(result, Fw::Success::SUCCESS);
ASSERT_EQ(actual.popSerializable, popSerializable);
// write some junk after buf, make sure it fails
seq.get_statements()[0].get_argBuf().serializeFrom(123);
result = tester_deserializeDirective(seq.get_statements()[0], actual);
ASSERT_EQ(result, Fw::Success::FAILURE);
ASSERT_EVENTS_DirectiveDeserializeError_SIZE(1);
this->clearHistory();
// clear args, make sure it fails
seq.get_statements()[0].get_argBuf().resetSer();
result = tester_deserializeDirective(seq.get_statements()[0], actual);
ASSERT_EQ(result, Fw::Success::FAILURE);
ASSERT_EVENTS_DirectiveDeserializeError_SIZE(1);
}

// caught a bug
TEST_F(FpySequencerTester, checkTimers) {
allocMem();
Expand Down
10 changes: 10 additions & 0 deletions Svc/FpySequencer/test/ut/FpySequencerTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ void FpySequencerTester::add_POP_EVENT() {
Fw::StatementArgBuffer buf;
addDirective(Fpy::DirectiveId::POP_EVENT, buf);
}

void FpySequencerTester::add_POP_SERIALIZABLE(FwIndexType portIndex, Fpy::StackSizeType size) {
add_POP_SERIALIZABLE(FpySequencer_PopSerializableDirective(portIndex, size));
}

void FpySequencerTester::add_POP_SERIALIZABLE(FpySequencer_PopSerializableDirective dir) {
Fw::StatementArgBuffer buf;
FW_ASSERT(buf.serializeFrom(dir) == Fw::SerializeStatus::FW_SERIALIZE_OK);
addDirective(Fpy::DirectiveId::POP_SERIALIZABLE, buf);
}
//! Handle a text event
void FpySequencerTester::textLogIn(FwEventIdType id, //!< The event ID
const Fw::Time& timeTag, //!< The time
Expand Down
2 changes: 2 additions & 0 deletions Svc/FpySequencer/test/ut/FpySequencerTester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class FpySequencerTester : public FpySequencerGTestBase, public ::testing::Test
void add_STORE_ABS_CONST_OFFSET(Fpy::StackSizeType globalOffset, Fpy::StackSizeType size);
void add_STORE_ABS_CONST_OFFSET(FpySequencer_StoreAbsConstOffsetDirective dir);
void add_POP_EVENT();
void add_POP_SERIALIZABLE(FwIndexType portIndex, Fpy::StackSizeType size);
void add_POP_SERIALIZABLE(FpySequencer_PopSerializableDirective dir);
template <typename T>
void add_PUSH_VAL(T val);
//! Handle a text event
Expand Down
Loading