Revive test_dataman.c

This commit is contained in:
David Sidrane
2016-10-18 00:23:58 +02:00
committed by Lorenz Meier
parent b2bf9e15eb
commit bb71aa5b64
4 changed files with 11 additions and 3 deletions
+1
View File
@@ -34,6 +34,7 @@
set(srcs set(srcs
test_adc.c test_adc.c
test_autodeclination.cpp test_autodeclination.cpp
test_dataman.c
test_hysteresis.cpp test_hysteresis.cpp
test_bson.c test_bson.c
test_conv.cpp test_conv.cpp
+8 -3
View File
@@ -37,6 +37,7 @@
****************************************************************************/ ****************************************************************************/
#include <px4_config.h> #include <px4_config.h>
#include <px4_posix.h>
#include <sys/types.h> #include <sys/types.h>
@@ -60,6 +61,8 @@
#include "dataman/dataman.h" #include "dataman/dataman.h"
static px4_sem_t *sems; static px4_sem_t *sems;
int test_dataman(int argc, char *argv[]);
static int static int
task_main(int argc, char *argv[]) task_main(int argc, char *argv[])
@@ -91,7 +94,7 @@ task_main(int argc, char *argv[])
memset(buffer, my_id, sizeof(buffer)); memset(buffer, my_id, sizeof(buffer));
buffer[1] = i; buffer[1] = i;
unsigned hash = i ^ my_id; unsigned hash = i ^ my_id;
unsigned len = (hash & 63) + 2; unsigned len = (hash % (DM_MAX_DATA_SIZE / 2)) + 2;
int ret = dm_write(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, DM_PERSIST_IN_FLIGHT_RESET, buffer, len); int ret = dm_write(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, DM_PERSIST_IN_FLIGHT_RESET, buffer, len);
warnx("ret: %d", ret); warnx("ret: %d", ret);
@@ -109,7 +112,9 @@ task_main(int argc, char *argv[])
for (unsigned i = 0; i < NUM_MISSIONS_SUPPORTED; i++) { for (unsigned i = 0; i < NUM_MISSIONS_SUPPORTED; i++) {
unsigned hash = i ^ my_id; unsigned hash = i ^ my_id;
unsigned len2, len = (hash & 63) + 2; unsigned len2;
unsigned len = (hash % (DM_MAX_DATA_SIZE / 2)) + 2;
;
if ((len2 = dm_read(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, buffer, sizeof(buffer))) < 2) { if ((len2 = dm_read(DM_KEY_WAYPOINTS_OFFBOARD_1, hash, buffer, sizeof(buffer))) < 2) {
warnx("%d read failed length test, index %d", my_id, hash); warnx("%d read failed length test, index %d", my_id, hash);
@@ -168,7 +173,7 @@ int test_dataman(int argc, char *argv[])
px4_sem_init(sems + i, 1, 0); px4_sem_init(sems + i, 1, 0);
/* start the task */ /* start the task */
if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, av)) <= 0) { if ((task = px4_task_spawn_cmd("dataman", SCHED_DEFAULT, SCHED_PRIORITY_MAX - 5, 2048, task_main, (void *)av)) <= 0) {
warn("task start failed"); warn("task start failed");
} }
} }
+1
View File
@@ -101,6 +101,7 @@ const struct {
{"autodeclination", test_autodeclination, 0}, {"autodeclination", test_autodeclination, 0},
{"bson", test_bson, 0}, {"bson", test_bson, 0},
{"conv", test_conv, 0}, {"conv", test_conv, 0},
{"dataman", test_dataman, 0},
{"file", test_file, OPT_NOJIGTEST | OPT_NOALLTEST}, {"file", test_file, OPT_NOJIGTEST | OPT_NOALLTEST},
{"file2", test_file2, OPT_NOJIGTEST}, {"file2", test_file2, OPT_NOJIGTEST},
{"float", test_float, 0}, {"float", test_float, 0},
+1
View File
@@ -57,6 +57,7 @@ extern int test_autodeclination(int argc, char *argv[]);
extern int test_hysteresis(int argc, char *argv[]); extern int test_hysteresis(int argc, char *argv[]);
extern int test_bson(int argc, char *argv[]); extern int test_bson(int argc, char *argv[]);
extern int test_conv(int argc, char *argv[]); extern int test_conv(int argc, char *argv[]);
extern int test_dataman(int argc, char *argv[]);
extern int test_file(int argc, char *argv[]); extern int test_file(int argc, char *argv[]);
extern int test_file2(int argc, char *argv[]); extern int test_file2(int argc, char *argv[]);
extern int test_float(int argc, char *argv[]); extern int test_float(int argc, char *argv[]);