mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-30 09:40:35 +08:00
uORB: Unit test fix
The latency_test used to pass an object pointer as argv which won't work in the posix port because it expects argv to be a null terminated array of character pointers (which it makes a copy of). The test was refactored to use a singleton pattern and avoid having to pass the object pointer to the thread. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
@@ -36,6 +36,12 @@
|
||||
#include <px4_config.h>
|
||||
#include <px4_time.h>
|
||||
|
||||
uORBTest::UnitTest &uORBTest::UnitTest::instance()
|
||||
{
|
||||
static uORBTest::UnitTest t;
|
||||
return t;
|
||||
}
|
||||
|
||||
int uORBTest::UnitTest::pubsublatency_main(void)
|
||||
{
|
||||
/* poll on test topic and output latency */
|
||||
@@ -276,12 +282,8 @@ int uORBTest::UnitTest::test_note(const char *fmt, ...)
|
||||
return OK;
|
||||
}
|
||||
|
||||
int uORBTest::UnitTest::pubsubtest_threadEntry( char* const* data )
|
||||
int uORBTest::UnitTest::pubsubtest_threadEntry(char* const argv[])
|
||||
{
|
||||
uORBTest::UnitTest* t = (uORBTest::UnitTest*) data;
|
||||
if( data != nullptr )
|
||||
{
|
||||
return t->pubsublatency_main();
|
||||
}
|
||||
return uORB::ERROR;
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.pubsublatency_main();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user