Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPP v2.0 integration #2181

Merged
merged 10 commits into from
Sep 28, 2023
5 changes: 0 additions & 5 deletions FppTest/component/active/test/ut/Tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ class Tester : public ActiveTestGTestBase {
*/
);

void cmdResponseIn(const FwOpcodeType opCode, const U32 cmdSeq, const Fw::CmdResponse response);

PRIVATE:
// ----------------------------------------------------------------------
// Handlers for serial from ports
Expand Down Expand Up @@ -278,9 +276,6 @@ class Tester : public ActiveTestGTestBase {
Fw::SerialBuffer structBuf;
Fw::SerialBuffer serialBuf;

// Command test values
Fw::CmdResponse cmdResp;

// Parameter test values
FppTest::Types::BoolParam boolPrm;
FppTest::Types::U32Param u32Prm;
Expand Down
2 changes: 0 additions & 2 deletions FppTest/component/include/typed_ports.fppi
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ output port structReturnOut: StructReturn
# Ports for testing special ports
# ----------------------------------------------------------------------

sync input port cmdOut: Fw.Cmd

output port prmGetIn: Fw.PrmGet

output port prmSetIn: Fw.PrmSet
5 changes: 0 additions & 5 deletions FppTest/component/passive/test/ut/Tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ class Tester : public PassiveTestGTestBase {
*/
);

void cmdResponseIn(const FwOpcodeType opCode, const U32 cmdSeq, const Fw::CmdResponse response);

PRIVATE:
// ----------------------------------------------------------------------
// Handlers for serial from ports
Expand Down Expand Up @@ -268,9 +266,6 @@ class Tester : public PassiveTestGTestBase {
Fw::SerialBuffer structBuf;
Fw::SerialBuffer serialBuf;

// Command test values
Fw::CmdResponse cmdResp;

// Parameter test values
FppTest::Types::BoolParam boolPrm;
FppTest::Types::U32Param u32Prm;
Expand Down
5 changes: 0 additions & 5 deletions FppTest/component/queued/test/ut/Tester.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,6 @@ class Tester : public QueuedTestGTestBase {
*/
);

void cmdResponseIn(const FwOpcodeType opCode, const U32 cmdSeq, const Fw::CmdResponse response);

PRIVATE:
// ----------------------------------------------------------------------
// Handlers for serial from ports
Expand Down Expand Up @@ -278,9 +276,6 @@ class Tester : public QueuedTestGTestBase {
Fw::SerialBuffer structBuf;
Fw::SerialBuffer serialBuf;

// Command test values
Fw::CmdResponse cmdResp;

// Parameter test values
FppTest::Types::BoolParam boolPrm;
FppTest::Types::U32Param u32Prm;
Expand Down
2 changes: 1 addition & 1 deletion FppTest/component/tests/AsyncCmdTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#include "Fw/Cmd/CmdArgBuffer.hpp"

CMD_TEST_INVOKE_DEFS_ASYNC
CMD_TEST_DEFS(Async)
CMD_TEST_DEFS(Async, _ASYNC)
2 changes: 1 addition & 1 deletion FppTest/component/tests/CmdTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#include "Fw/Cmd/CmdArgBuffer.hpp"

CMD_TEST_INVOKE_DEFS
CMD_TEST_DEFS()
CMD_TEST_DEFS(, )
584 changes: 315 additions & 269 deletions FppTest/component/tests/CmdTests.hpp

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions FppTest/component/tests/EventTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::NoParams& data)

ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_EventNoArgs_SIZE(1);

this->printTextLogHistory(stdout);
}

void Tester ::testEventHelper(NATIVE_INT_TYPE portNum, FppTest::Types::PrimitiveParams& data, NATIVE_UINT_TYPE size) {
Expand All @@ -50,6 +52,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::PrimitiveParams
// Test throttle reset
component.log_ACTIVITY_LO_EventPrimitive_ThrottleClear();
testEventHelper(portNum, data, component.EVENTID_EVENTPRIMITIVE_THROTTLE + 1);

this->printTextLogHistory(stdout);
}

void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::LogStringParams& data) {
Expand All @@ -58,6 +62,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::LogStringParams
ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_EventString_SIZE(1);
ASSERT_EVENTS_EventString(portNum, data.args.val1.toChar(), data.args.val2.toChar());

this->printTextLogHistory(stdout);
}

void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::EnumParam& data) {
Expand All @@ -69,6 +75,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::EnumParam& data
ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_EventEnum_SIZE(1);
ASSERT_EVENTS_EventEnum(portNum, data.args.val);

this->printTextLogHistory(stdout);
}

void Tester ::testEventHelper(NATIVE_INT_TYPE portNum, FppTest::Types::ArrayParam& data, NATIVE_UINT_TYPE size) {
Expand Down Expand Up @@ -96,6 +104,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::ArrayParam& dat
// Test throttle reset
component.log_FATAL_EventArray_ThrottleClear();
testEventHelper(portNum, data, component.EVENTID_EVENTARRAY_THROTTLE + 1);

this->printTextLogHistory(stdout);
}

void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::StructParam& data) {
Expand All @@ -107,6 +117,8 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::StructParam& da
ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_EventStruct_SIZE(1);
ASSERT_EVENTS_EventStruct(portNum, data.args.val);

this->printTextLogHistory(stdout);
}

void Tester ::testEventHelper(NATIVE_INT_TYPE portNum, FppTest::Types::BoolParam& data, NATIVE_UINT_TYPE size) {
Expand Down Expand Up @@ -134,4 +146,6 @@ void Tester ::testEvent(NATIVE_INT_TYPE portNum, FppTest::Types::BoolParam& data
// Test throttle reset
component.log_WARNING_LO_EventBool_ThrottleClear();
testEventHelper(portNum, data, component.EVENTID_EVENTBOOL_THROTTLE + 1);

this->printTextLogHistory(stdout);
}
138 changes: 78 additions & 60 deletions FppTest/component/tests/ParamTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,178 +65,196 @@ void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::BoolPara
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMBOOL_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMBOOL_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMBOOL_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMBOOL_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMBOOL_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMBOOL_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);
this->paramSet_ParamBool(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamBool(0, 1);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMBOOL_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMBOOL_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMBOOL_SAVE, 1, buf);
this->paramSave_ParamBool(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMBOOL_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(boolPrm.args.val, data.args.val);
}

void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::U32Param& data) {
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMU32_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMU32_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMU32_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMU32_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMU32_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMU32_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMU32_SET, 1, buf);
this->paramSet_ParamU32(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamU32(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMU32_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMU32_SAVE, 1, buf);
this->paramSave_ParamU32(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMU32_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(u32Prm.args.val, data.args.val);
}

void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::PrmStringParam& data) {
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRING_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMSTRING_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMSTRING_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRING_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMSTRING_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMSTRING_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRING_SET, 1, buf);
this->paramSet_ParamString(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamString(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMSTRING_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRING_SAVE, 1, buf);
this->paramSave_ParamString(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMSTRING_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(stringPrm.args.val, data.args.val);
}

void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::EnumParam& data) {
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMENUM_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMENUM_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMENUM_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMENUM_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMENUM_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMENUM_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);
this->paramSet_ParamEnum(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamEnum(0, 1);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMENUM_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMENUM_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMENUM_SAVE, 1, buf);
this->paramSave_ParamEnum(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMENUM_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(enumPrm.args.val, data.args.val);
}

void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::ArrayParam& data) {
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMARRAY_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMARRAY_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMARRAY_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMARRAY_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMARRAY_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMARRAY_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMARRAY_SET, 1, buf);
this->paramSet_ParamArray(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamArray(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMARRAY_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMARRAY_SAVE, 1, buf);
this->paramSave_ParamArray(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMARRAY_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(arrayPrm.args.val, data.args.val);
}

void Tester ::testParamCommand(NATIVE_INT_TYPE portNum, FppTest::Types::StructParam& data) {
Fw::CmdArgBuffer buf;

// Test unsuccessful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRUCT_SAVE, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMSTRUCT_SAVE, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::EXECUTION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(1);
ASSERT_CMD_RESPONSE(0, component.OPCODE_PARAMSTRUCT_SAVE, 1, Fw::CmdResponse::EXECUTION_ERROR);

this->connectPrmSetIn();
ASSERT_TRUE(component.isConnected_prmSetOut_OutputPort(portNum));

// Test incorrect deserialization when setting param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRUCT_SET, 1, buf);
this->sendRawCmd(component.OPCODE_PARAMSTRUCT_SET, 1, buf);

ASSERT_EQ(cmdResp, Fw::CmdResponse::VALIDATION_ERROR);
ASSERT_CMD_RESPONSE_SIZE(2);
ASSERT_CMD_RESPONSE(1, component.OPCODE_PARAMSTRUCT_SET, 1, Fw::CmdResponse::VALIDATION_ERROR);

// Test successful setting of param
buf.serialize(data.args.val);

this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRUCT_SET, 1, buf);
this->paramSet_ParamStruct(data.args.val, Fw::ParamValid::VALID);
this->paramSend_ParamStruct(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(3);
ASSERT_CMD_RESPONSE(2, component.OPCODE_PARAMSTRUCT_SET, 1, Fw::CmdResponse::OK);

// Test successful saving of param
this->invoke_to_cmdOut(portNum, component.OPCODE_PARAMSTRUCT_SAVE, 1, buf);
this->paramSave_ParamStruct(0, 1);

ASSERT_EQ(cmdResp, Fw::CmdResponse::OK);
ASSERT_CMD_RESPONSE_SIZE(4);
ASSERT_CMD_RESPONSE(3, component.OPCODE_PARAMSTRUCT_SAVE, 1, Fw::CmdResponse::OK);
ASSERT_EQ(structPrm.args.val, data.args.val);
}
Loading