nasa / fprime

F´ - A flight software and embedded systems framework
https://fprime.jpl.nasa.gov
Apache License 2.0
10.08k stars 1.31k forks source link

Unit Testing Errors and Misunderstanding #2522

Closed nikkikaragi closed 9 months ago

nikkikaragi commented 9 months ago

I have a Scheduler component utilizing a libcron library that I am currently in the process unit testing. There is an async command GET_SCHEDULE_LIST defined in Scheduler.fpp. In Scheduler.cpp, the command handler is as follows:

void Scheduler ::
   GET_SCHEDULE_LIST_cmdHandler (
        const FwOpcodeType opCode,
        const U32 cmdSeq,
        const Fw::CmdStringArg& destFileName
    )
  {
    this->log_DIAGNOSTIC_DOWNLINKED_SCHEDULE(destination_file_name);
    this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
  } 

The destFileName argument corresponds with other code in this function that has currently been commented out in order to isolate the issue with unit testing. In SchedulerTester.cpp:

  void SchedulerTester ::
    test_GET_SCHEDULE_LIST_cmdHandler()
    {
       U32 cmdSeq = 10;
       this->sendCmd_GET_SCHEDULE_LIST(0, cmdSeq, "schedules.txt");
       ASSERT_EVENTS_DOWNLINKED_SCHEDULE_SIZE(1);
    }

This basic test is failing. The LastTest.log records that the expected size is 1, but the actual is 0. I am confused... am I not sending the command correctly? In SchedulerTester.cpp, I did not edit the fprime generated content, except for constructing a Scheduler object in the tester cpp & declaring it in hpp, as errors in fprime-util build --ut prompted me to.

Any help would be appreciated as I am still learning how to test the deployment.