MathComponent/Tutorial.md, 5.5.3 Write and Run Tests. #1316
Replies: 1 comment 2 replies
-
By default in the tutorial code snippet, the two parameters passed to the #define CMD_SEQ 0
#define INSTANCE 0
void Tester ::
testThrottle()
{
// send the number of commands required to throttle the event
// Use the autocoded value so the unit test passes if the
// throttle value is changed
const F32 factor = pickF32Value();
for (
U16 cycle = 0;
cycle < MathReceiverComponentBase::EVENTID_FACTOR_UPDATED_THROTTLE;
cycle++
) {
this->setFactor(factor, ThrottleState::NOT_THROTTLED);
}
// Event should now be throttled
this->setFactor(factor, ThrottleState::THROTTLED);
// send the command to clear the throttle
this->sendCmd_CLEAR_EVENT_THROTTLE(INSTANCE, CMD_SEQ);
// invoke scheduler port to dispatch message
const U32 context = STest::Pick::any();
this->invoke_to_schedIn(0, context);
// verify clear event was sent
ASSERT_EVENTS_SIZE(1);
ASSERT_EVENTS_THROTTLE_CLEARED_SIZE(1);
// Throttling should be cleared
this->setFactor(factor, ThrottleState::NOT_THROTTLED);
} But I noticed that the macro So there would be a defect in the tutorial or in the autogenerator of the Tester.cpp file. I will try to open the associated problem ticket if I have time. Has anyone else noticed this symptom and can they validate my statement? From what I see of your output, you would have customized the According to the error message, the function doesn't know these two variables, so you have to define them. Either you give them as parameters of the function |
Beta Was this translation helpful? Give feedback.
-
When I write a throttle test and run the command "fprime-util check",it appears some errors:
[WARNING] Failed to find settings file: /home/zxx/Program/fprime/fprime-devel/Ref/settings.ini
[ 0%] Built target Fw_Cfg
[ 10%] Built target codegen
[ 20%] Built target Fw_Types
[ 30%] Built target Fw_Logger
[ 30%] Built target Fw_Obj
[ 30%] Built target Fw_Port
[ 40%] Built target Fw_Time
[ 40%] Built target Fw_Com
[ 40%] Built target Fw_Tlm
[ 40%] Built target Fw_Log
[ 50%] Built target Fw_Cmd
[ 60%] Built target Fw_Prm
[ 60%] Built target Ref_MathTypes
[ 70%] Built target Ref_MathPorts
[ 70%] Built target Fw_Comp
[ 70%] Built target Utils_Hash
[ 80%] Built target Os
[ 80%] Built target Fw_CompQueued
[ 80%] Built target Svc_Sched
[ 80%] Built target Ref_MathReceiver
[ 80%] Built target gtest
[ 80%] Built target gtest_main
[ 90%] Built target STest
[100%] Building CXX object Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/test/ut/Tester.cpp.o
/home/zxx/Program/fprime/fprime-devel/Ref/MathReceiver/test/ut/Tester.cpp: In member function ‘void Ref::Tester::testThrottle()’:
/home/zxx/Program/fprime/fprime-devel/Ref/MathReceiver/test/ut/Tester.cpp:113:40: error: ‘instance’ was not declared in this scope
this->sendCmd_CLEAR_EVENT_THROTTLE(instance, cmdSeq);
^
/home/zxx/Program/fprime/fprime-devel/Ref/MathReceiver/test/ut/Tester.cpp:113:50: error: ‘cmdSeq’ was not declared in this scope
this->sendCmd_CLEAR_EVENT_THROTTLE(instance, cmdSeq);
^
Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/build.make:120: recipe for target 'Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/test/ut/Tester.cpp.o' failed
make[3]: *** [Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/test/ut/Tester.cpp.o] Error 1
CMakeFiles/Makefile2:32087: recipe for target 'Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/all' failed
make[2]: *** [Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_ut_exe.dir/all] Error 2
make[1]: *** [Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_check.dir/rule] Error 2
CMakeFiles/Makefile2:32146: recipe for target 'Ref/MathReceiver/CMakeFiles/Ref_MathReceiver_check.dir/rule' failed
make: *** [Ref_MathReceiver_check] Error 2
Makefile:12022: recipe for target 'Ref_MathReceiver_check' failed
[ERROR] CMake erred with return code 2
Beta Was this translation helpful? Give feedback.
All reactions