mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-01 12:10:35 +08:00
uORB separate tests
This commit is contained in:
committed by
Lorenz Meier
parent
dc8b9d1da8
commit
12165ba5a4
@@ -37,19 +37,14 @@
|
||||
#include "uORB.h"
|
||||
#include "uORBCommon.hpp"
|
||||
|
||||
#ifndef __PX4_QURT
|
||||
#include "uORBTest_UnitTest.hpp"
|
||||
#endif
|
||||
|
||||
extern "C" { __EXPORT int uorb_main(int argc, char *argv[]); }
|
||||
|
||||
static uORB::DeviceMaster *g_dev = nullptr;
|
||||
static void usage()
|
||||
{
|
||||
PX4_INFO("Usage: uorb 'start', 'test', 'latency_test' or 'status'");
|
||||
PX4_INFO("Usage: uorb 'start', 'status'");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
uorb_main(int argc, char *argv[])
|
||||
{
|
||||
@@ -94,41 +89,6 @@ uorb_main(int argc, char *argv[])
|
||||
return OK;
|
||||
}
|
||||
|
||||
#ifndef __PX4_QURT
|
||||
|
||||
/*
|
||||
* Test the driver/device.
|
||||
*/
|
||||
if (!strcmp(argv[1], "test")) {
|
||||
if (!g_dev) {
|
||||
PX4_WARN("orb is not running! start it first");
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
uORBTest::UnitTest &t = uORBTest::UnitTest::instance();
|
||||
return t.test();
|
||||
}
|
||||
|
||||
/*
|
||||
* Test the latency.
|
||||
*/
|
||||
if (!strcmp(argv[1], "latency_test")) {
|
||||
|
||||
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")) {
|
||||
return t.latency_test<struct orb_test_large>(ORB_ID(orb_test_large), true);
|
||||
|
||||
} else {
|
||||
return t.latency_test<struct orb_test>(ORB_ID(orb_test), true);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Print driver information.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user