mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-26 21:50: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:
@@ -90,7 +90,7 @@ uorb_main(int argc, char *argv[])
|
||||
*/
|
||||
if (!strcmp(argv[1], "test"))
|
||||
{
|
||||
uORBTest::UnitTest t;
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.test();
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ uorb_main(int argc, char *argv[])
|
||||
*/
|
||||
if (!strcmp(argv[1], "latency_test")) {
|
||||
|
||||
uORBTest::UnitTest t;
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
if (argc > 2 && !strcmp(argv[2], "medium")) {
|
||||
return t.latency_test<struct orb_test_medium>(ORB_ID(orb_test_medium), true);
|
||||
} else if (argc > 2 && !strcmp(argv[2], "large")) {
|
||||
@@ -118,7 +118,5 @@ uorb_main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
usage();
|
||||
errx(-EINVAL, "unrecognized command, try 'start', 'test', 'latency_test' or 'status'");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user