Add unit test for dynamically loading modules on posix.

This commit is contained in:
Mara Bos
2018-11-24 01:58:09 +01:00
committed by Lorenz Meier
parent d13836eb1e
commit 3c660acca8
6 changed files with 54 additions and 1 deletions
@@ -0,0 +1,8 @@
px4_add_module(
MODULE platforms__posix__tests__dyn_hello
MAIN hello
SRCS
hello.cpp
DEPENDS
DYNAMIC
)
@@ -0,0 +1,16 @@
#include <px4_log.h>
#include <px4_app.h>
extern "C" __EXPORT int hello_main(int argc, char *argv[]);
int hello_main(int argc, char *argv[])
{
PX4_INFO("Hello, I am a dynamically loaded module.");
PX4_INFO("Argv:");
for (int i = 0; i < argc; ++i) {
PX4_INFO(" %d: %s", i, argv[i]);
}
return 0;
}