forked from Archive/PX4-Autopilot
uORB: fix segfault in unit test
The unit test was not passing a null pointer terminated argv. The posix port depends on argv being null terminated to determine how may args were passed since PX4 API doesn't pass argc when spawning a new task. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
e33a164ddb
commit
f2af8b08ed
|
@ -35,6 +35,7 @@
|
||||||
#define _uORBTest_UnitTest_hpp_
|
#define _uORBTest_UnitTest_hpp_
|
||||||
#include "uORBCommon.hpp"
|
#include "uORBCommon.hpp"
|
||||||
#include "uORB.h"
|
#include "uORB.h"
|
||||||
|
#include <px4_time.h>
|
||||||
|
|
||||||
struct orb_test {
|
struct orb_test {
|
||||||
int val;
|
int val;
|
||||||
|
@ -92,6 +93,8 @@ int uORBTest::UnitTest::latency_test(orb_id_t T, bool print)
|
||||||
|
|
||||||
int pfd0 = orb_advertise(T, &t);
|
int pfd0 = orb_advertise(T, &t);
|
||||||
|
|
||||||
|
char * const args[2] = { (char* const) this, 0 };
|
||||||
|
|
||||||
pubsubtest_print = print;
|
pubsubtest_print = print;
|
||||||
|
|
||||||
pubsubtest_passed = false;
|
pubsubtest_passed = false;
|
||||||
|
@ -103,7 +106,7 @@ int uORBTest::UnitTest::latency_test(orb_id_t T, bool print)
|
||||||
SCHED_PRIORITY_MAX - 5,
|
SCHED_PRIORITY_MAX - 5,
|
||||||
1500,
|
1500,
|
||||||
(px4_main_t)&uORBTest::UnitTest::pubsubtest_threadEntry,
|
(px4_main_t)&uORBTest::UnitTest::pubsubtest_threadEntry,
|
||||||
(char* const*) this);
|
args);
|
||||||
|
|
||||||
/* give the test task some data */
|
/* give the test task some data */
|
||||||
while (!pubsubtest_passed) {
|
while (!pubsubtest_passed) {
|
||||||
|
|
Loading…
Reference in New Issue