uORB separate tests

This commit is contained in:
Daniel Agar
2016-04-24 02:01:43 -04:00
committed by Lorenz Meier
parent dc8b9d1da8
commit 12165ba5a4
8 changed files with 149 additions and 47 deletions
+1 -41
View File
@@ -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.
*/