@@ -2169,7 +2169,7 @@ TEST_F(FpySequencerTester, cmd_RUN_ARGS_oversized) {
21692169
21702170 sendCmd_RUN_ARGS (0 , 0 , Fw::String (" test.bin" ), FpySequencer_BlockState::BLOCK, largeArgs);
21712171 dispatchUntilState (State::VALIDATING);
2172- // should fail when trying to push args to stack
2172+ // should fail during validation when checking args size
21732173 dispatchUntilState (State::IDLE);
21742174 ASSERT_CMD_RESPONSE_SIZE (1 );
21752175 ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_ARGS (), 0 , Fw::CmdResponse::EXECUTION_ERROR);
@@ -2245,24 +2245,12 @@ TEST_F(FpySequencerTester, cmd_RUN_VALIDATED) {
22452245 ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED (), 0 , Fw::CmdResponse::OK);
22462246}
22472247
2248- TEST_F (FpySequencerTester, cmd_RUN_VALIDATED_ARGS) {
2249- // should fail because in idle
2250- this ->tester_setState (State::IDLE);
2251- Svc::SeqArgs emptyArgs{0 , 0 };
2252- sendCmd_RUN_VALIDATED_ARGS (0 , 0 , FpySequencer_BlockState::NO_BLOCK, emptyArgs);
2253- dispatchCurrentMessages (cmp);
2254- ASSERT_CMD_RESPONSE_SIZE (1 );
2255- ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED_ARGS (), 0 , Fw::CmdResponse::EXECUTION_ERROR);
2256- this ->clearHistory ();
2257-
2248+ TEST_F (FpySequencerTester, cmd_VALIDATE_ARGS) {
22582249 allocMem ();
22592250 add_LOAD_REL (0 , 4 ); // Load first arg (U32 at offset 0) - duplicates it on stack
22602251 add_LOAD_REL (4 , 4 ); // Load second arg (U32 at offset 4) - duplicates it on stack
22612252 add_DISCARD (16 ); // Discard all: 2 loaded copies + 2 original args
22622253 writeToFile (" test.bin" );
2263- sendCmd_VALIDATE (0 , 0 , Fw::String (" test.bin" ));
2264- dispatchUntilState (State::AWAITING_CMD_RUN_VALIDATED);
2265- this ->clearHistory ();
22662254
22672255 // Pass two U32 args: 10 and 20
22682256 Svc::SeqArgs args{0 , 0 };
@@ -2272,11 +2260,20 @@ TEST_F(FpySequencerTester, cmd_RUN_VALIDATED_ARGS) {
22722260 ASSERT_EQ (argBuf.serializeFrom (arg2), Fw::FW_SERIALIZE_OK);
22732261 args.set_size (argBuf.getSize ());
22742262
2263+ sendCmd_VALIDATE_ARGS (0 , 0 , Fw::String (" test.bin" ), args);
2264+ dispatchUntilState (State::VALIDATING);
2265+ ASSERT_EQ (tester_get_m_sequencesStarted (), 0 );
2266+ ASSERT_EQ (tester_get_m_statementsDispatched (), 0 );
2267+ dispatchUntilState (State::AWAITING_CMD_RUN_VALIDATED);
2268+ ASSERT_CMD_RESPONSE_SIZE (1 );
2269+ ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_VALIDATE_ARGS (), 0 , Fw::CmdResponse::OK);
2270+ this ->clearHistory ();
2271+
22752272 // should succeed immediately
2276- sendCmd_RUN_VALIDATED_ARGS (0 , 0 , FpySequencer_BlockState::NO_BLOCK, args );
2273+ sendCmd_RUN_VALIDATED (0 , 0 , FpySequencer_BlockState::NO_BLOCK);
22772274 this ->tester_doDispatch ();
22782275 ASSERT_CMD_RESPONSE_SIZE (1 );
2279- ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED_ARGS (), 0 , Fw::CmdResponse::OK);
2276+ ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED (), 0 , Fw::CmdResponse::OK);
22802277 dispatchUntilState (State::RUNNING_AWAITING_STATEMENT_RESPONSE);
22812278 ASSERT_EQ (tester_get_m_sequencesStarted (), 1 );
22822279
@@ -2289,11 +2286,11 @@ TEST_F(FpySequencerTester, cmd_RUN_VALIDATED_ARGS) {
22892286 ASSERT_CMD_RESPONSE_SIZE (1 );
22902287 clearHistory ();
22912288
2292- sendCmd_VALIDATE (0 , 0 , Fw::String (" test.bin" ));
2289+ sendCmd_VALIDATE_ARGS (0 , 0 , Fw::String (" test.bin" ), args );
22932290 dispatchUntilState (State::AWAITING_CMD_RUN_VALIDATED);
22942291 this ->clearHistory ();
22952292 // should succeed immediately
2296- sendCmd_RUN_VALIDATED_ARGS (0 , 0 , FpySequencer_BlockState::BLOCK, args );
2293+ sendCmd_RUN_VALIDATED (0 , 0 , FpySequencer_BlockState::BLOCK);
22972294 this ->tester_doDispatch ();
22982295 ASSERT_CMD_RESPONSE_SIZE (0 );
22992296 dispatchUntilState (State::RUNNING_AWAITING_STATEMENT_RESPONSE);
@@ -2305,33 +2302,29 @@ TEST_F(FpySequencerTester, cmd_RUN_VALIDATED_ARGS) {
23052302 // should go back to IDLE
23062303 dispatchUntilState (State::IDLE);
23072304 ASSERT_CMD_RESPONSE_SIZE (1 );
2308- ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED_ARGS (), 0 , Fw::CmdResponse::OK);
2305+ ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED (), 0 , Fw::CmdResponse::OK);
23092306
23102307 // Stack should be empty after discards
23112308 ASSERT_EQ (runtime->stack .size , static_cast <Fpy::StackSizeType>(0 ));
23122309
23132310 removeFile (" test.bin" );
23142311}
23152312
2316- TEST_F (FpySequencerTester, cmd_RUN_VALIDATED_ARGS_oversized ) {
2313+ TEST_F (FpySequencerTester, cmd_VALIDATE_ARGS_oversized ) {
23172314 allocMem ();
23182315 add_NO_OP ();
23192316 writeToFile (" test.bin" );
2320- sendCmd_VALIDATE (0 , 0 , Fw::String (" test.bin" ));
2321- dispatchUntilState (State::AWAITING_CMD_RUN_VALIDATED);
2322- this ->clearHistory ();
23232317
23242318 // Create args that exceed MAX_STACK_SIZE
23252319 Svc::SeqArgs largeArgs{0 , 0 };
23262320 largeArgs.set_size (Fpy::MAX_STACK_SIZE + 1 );
23272321
2328- sendCmd_RUN_VALIDATED_ARGS (0 , 0 , FpySequencer_BlockState::BLOCK, largeArgs);
2329- this ->tester_doDispatch ();
2330- ASSERT_CMD_RESPONSE_SIZE (0 );
2331- // should fail when trying to push args to stack
2322+ sendCmd_VALIDATE_ARGS (0 , 0 , Fw::String (" test.bin" ), largeArgs);
2323+ dispatchUntilState (State::VALIDATING);
2324+ // should fail during validation when checking args size
23322325 dispatchUntilState (State::IDLE);
23332326 ASSERT_CMD_RESPONSE_SIZE (1 );
2334- ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_RUN_VALIDATED_ARGS (), 0 , Fw::CmdResponse::EXECUTION_ERROR);
2327+ ASSERT_CMD_RESPONSE (0 , Svc::FpySequencerTester::get_OPCODE_VALIDATE_ARGS (), 0 , Fw::CmdResponse::EXECUTION_ERROR);
23352328 ASSERT_from_seqDoneOut_SIZE (1 );
23362329 ASSERT_from_seqDoneOut (0 , 0 , 0 , Fw::CmdResponse::EXECUTION_ERROR);
23372330
0 commit comments