POSIX: ported systemcmds/tests

Most of the systemcmds tests run in the posix build. The UART tests
fail for me as I do not have a UART connected.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-07-01 07:51:24 -07:00
parent 9c7450248f
commit 1e46f44123
30 changed files with 285 additions and 238 deletions
+14 -14
View File
@@ -39,6 +39,7 @@
*/
#include <px4_config.h>
#include <px4_posix.h>
#include <sys/types.h>
@@ -47,13 +48,12 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <debug.h>
#include <math.h>
#include <systemlib/err.h>
#include <arch/board/board.h>
#include <nuttx/spi.h>
//#include <nuttx/spi.h>
#include "tests.h"
@@ -95,7 +95,7 @@ accel(int argc, char *argv[], const char *path)
struct accel_report buf;
int ret;
fd = open(path, O_RDONLY);
fd = px4_open(path, O_RDONLY);
if (fd < 0) {
printf("\tACCEL: open fail, run <mpu6000 start> or <lsm303 start> or <bma180 start> first.\n");
@@ -106,7 +106,7 @@ accel(int argc, char *argv[], const char *path)
usleep(100000);
/* read data - expect samples */
ret = read(fd, &buf, sizeof(buf));
ret = px4_read(fd, &buf, sizeof(buf));
if (ret != sizeof(buf)) {
printf("\tACCEL: read1 fail (%d)\n", ret);
@@ -130,7 +130,7 @@ accel(int argc, char *argv[], const char *path)
/* Let user know everything is ok */
printf("\tOK: ACCEL passed all tests successfully\n");
close(fd);
px4_close(fd);
return OK;
}
@@ -145,7 +145,7 @@ gyro(int argc, char *argv[], const char *path)
struct gyro_report buf;
int ret;
fd = open(path, O_RDONLY);
fd = px4_open(path, O_RDONLY);
if (fd < 0) {
printf("\tGYRO: open fail, run <l3gd20 start> or <mpu6000 start> first.\n");
@@ -156,7 +156,7 @@ gyro(int argc, char *argv[], const char *path)
usleep(5000);
/* read data - expect samples */
ret = read(fd, &buf, sizeof(buf));
ret = px4_read(fd, &buf, sizeof(buf));
if (ret != sizeof(buf)) {
printf("\tGYRO: read fail (%d)\n", ret);
@@ -175,7 +175,7 @@ gyro(int argc, char *argv[], const char *path)
/* Let user know everything is ok */
printf("\tOK: GYRO passed all tests successfully\n");
close(fd);
px4_close(fd);
return OK;
}
@@ -190,7 +190,7 @@ mag(int argc, char *argv[], const char *path)
struct mag_report buf;
int ret;
fd = open(path, O_RDONLY);
fd = px4_open(path, O_RDONLY);
if (fd < 0) {
printf("\tMAG: open fail, run <hmc5883 start> or <lsm303 start> first.\n");
@@ -201,7 +201,7 @@ mag(int argc, char *argv[], const char *path)
usleep(5000);
/* read data - expect samples */
ret = read(fd, &buf, sizeof(buf));
ret = px4_read(fd, &buf, sizeof(buf));
if (ret != sizeof(buf)) {
printf("\tMAG: read fail (%d)\n", ret);
@@ -220,7 +220,7 @@ mag(int argc, char *argv[], const char *path)
/* Let user know everything is ok */
printf("\tOK: MAG passed all tests successfully\n");
close(fd);
px4_close(fd);
return OK;
}
@@ -235,7 +235,7 @@ baro(int argc, char *argv[], const char *path)
struct baro_report buf;
int ret;
fd = open(path, O_RDONLY);
fd = px4_open(path, O_RDONLY);
if (fd < 0) {
printf("\tBARO: open fail, run <ms5611 start> or <lps331 start> first.\n");
@@ -246,7 +246,7 @@ baro(int argc, char *argv[], const char *path)
usleep(5000);
/* read data - expect samples */
ret = read(fd, &buf, sizeof(buf));
ret = px4_read(fd, &buf, sizeof(buf));
if (ret != sizeof(buf)) {
printf("\tBARO: read fail (%d)\n", ret);
@@ -259,7 +259,7 @@ baro(int argc, char *argv[], const char *path)
/* Let user know everything is ok */
printf("\tOK: BARO passed all tests successfully\n");
close(fd);
px4_close(fd);
return OK;
}