aboutsummaryrefslogtreecommitdiff
path: root/apps/px4
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-14 21:01:58 -0800
committerpx4dev <px4@purgatory.org>2013-01-14 21:01:58 -0800
commit854c6436b4e3b292fd04843795d0369dc8856783 (patch)
tree4d5602f5c70926d2dcd01294561ddd8df4378462 /apps/px4
parent6d138a845aabad31060bd00da0d20d177d3f4be4 (diff)
parentc38ad4ded570eddadeeca3579d02dfc63dcc8a9d (diff)
downloadpx4-firmware-854c6436b4e3b292fd04843795d0369dc8856783.tar.gz
px4-firmware-854c6436b4e3b292fd04843795d0369dc8856783.tar.bz2
px4-firmware-854c6436b4e3b292fd04843795d0369dc8856783.zip
Pull NuttX up to the 6.24 release.
Merge branch 'nuttx-merge-5447'
Diffstat (limited to 'apps/px4')
-rw-r--r--apps/px4/tests/test_time.c8
-rw-r--r--apps/px4/tests/tests_main.c85
2 files changed, 42 insertions, 51 deletions
diff --git a/apps/px4/tests/test_time.c b/apps/px4/tests/test_time.c
index 25bf02c31..8a164f3fc 100644
--- a/apps/px4/tests/test_time.c
+++ b/apps/px4/tests/test_time.c
@@ -95,7 +95,7 @@ cycletime(void)
lasttime = cycles;
- return (basetime + cycles) / 168;
+ return (basetime + cycles) / 168; /* XXX magic number */
}
/****************************************************************************
@@ -133,9 +133,9 @@ int test_time(int argc, char *argv[])
lowdelta = abs(delta / 100);
/* loop checking the time */
- for (unsigned i = 0; i < 100000; i++) {
+ for (unsigned i = 0; i < 100; i++) {
- usleep(rand() * 10);
+ usleep(rand());
uint32_t flags = irqsave();
@@ -154,7 +154,7 @@ int test_time(int argc, char *argv[])
fprintf(stderr, "h %llu c %llu d %lld\n", h, c, delta - lowdelta);
}
- printf("Maximum jitter %lld\n", maxdelta);
+ printf("Maximum jitter %lldus\n", maxdelta);
return 0;
}
diff --git a/apps/px4/tests/tests_main.c b/apps/px4/tests/tests_main.c
index 9fb5ac482..5bedd257b 100644
--- a/apps/px4/tests/tests_main.c
+++ b/apps/px4/tests/tests_main.c
@@ -86,33 +86,35 @@ const struct {
#define OPT_NOALLTEST (1<<1)
#define OPT_NOJIGTEST (1<<2)
} tests[] = {
- {"led", test_led, 0, 0},
- {"int", test_int, 0, 0},
- {"float", test_float, 0, 0},
- {"sensors", test_sensors, 0, 0},
- {"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"ppm", test_ppm, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"servo", test_servo, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"adc", test_adc, OPT_NOJIGTEST, 0},
- {"jig_voltages", test_jig_voltages, OPT_NOALLTEST, 0},
- {"uart_loopback", test_uart_loopback, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_baudchange", test_uart_baudchange, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_send", test_uart_send, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"uart_console", test_uart_console, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"tone", test_tone, 0, 0},
- {"sleep", test_sleep, OPT_NOJIGTEST, 0},
- {"time", test_time, OPT_NOJIGTEST, 0},
- {"perf", test_perf, OPT_NOJIGTEST, 0},
- {"all", test_all, OPT_NOALLTEST | OPT_NOJIGTEST, 0},
- {"jig", test_jig, OPT_NOJIGTEST | OPT_NOALLTEST, 0},
- {"param", test_param, OPT_NOJIGTEST, 0},
- {"bson", test_bson, OPT_NOJIGTEST, 0},
- {"file", test_file, OPT_NOJIGTEST, 0},
- {"help", test_help, OPT_NOALLTEST | OPT_NOHELP | OPT_NOJIGTEST, 0},
- {NULL, NULL, 0, 0}
+ {"led", test_led, 0},
+ {"int", test_int, 0},
+ {"float", test_float, 0},
+ {"sensors", test_sensors, 0},
+ {"gpio", test_gpio, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"hrt", test_hrt, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"ppm", test_ppm, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"servo", test_servo, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"adc", test_adc, OPT_NOJIGTEST},
+ {"jig_voltages", test_jig_voltages, OPT_NOALLTEST},
+ {"uart_loopback", test_uart_loopback, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_baudchange", test_uart_baudchange, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_send", test_uart_send, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"uart_console", test_uart_console, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"tone", test_tone, 0},
+ {"sleep", test_sleep, OPT_NOJIGTEST},
+ {"time", test_time, OPT_NOJIGTEST},
+ {"perf", test_perf, OPT_NOJIGTEST},
+ {"all", test_all, OPT_NOALLTEST | OPT_NOJIGTEST},
+ {"jig", test_jig, OPT_NOJIGTEST | OPT_NOALLTEST},
+ {"param", test_param, 0},
+ {"bson", test_bson, 0},
+ {"file", test_file, 0},
+ {"help", test_help, OPT_NOALLTEST | OPT_NOHELP | OPT_NOJIGTEST},
+ {NULL, NULL, 0}
};
+#define NTESTS (sizeof(tests) / sizeof(tests[0]))
+
static int
test_help(int argc, char *argv[])
{
@@ -132,11 +134,7 @@ test_all(int argc, char *argv[])
unsigned i;
char *args[2] = {"all", NULL};
unsigned int failcount = 0;
- unsigned int testscount = 0;
-
- /* store test results */
- bool passed[(sizeof(tests) / sizeof(tests[0]))];
- memset(&passed, 0, sizeof(passed));
+ bool passed[NTESTS];
printf("\nRunning all tests...\n\n");
@@ -151,14 +149,12 @@ test_all(int argc, char *argv[])
fprintf(stderr, " [%s] \t\t\tFAIL\n", tests[i].name);
fflush(stderr);
failcount++;
-
+ passed[i] = false;
} else {
- passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout);
+ passed[i] = true;
}
-
- testscount++;
}
}
@@ -181,7 +177,7 @@ test_all(int argc, char *argv[])
printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n");
printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n");
printf("\n");
- printf(" All tests passed (%d of %d)\n", testscount, testscount);
+ printf(" All tests passed (%d of %d)\n", i, i);
} else {
printf(" ______ ______ __ __ \n");
@@ -190,7 +186,7 @@ test_all(int argc, char *argv[])
printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n");
printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n");
printf("\n");
- printf(" Some tests failed (%d of %d)\n", failcount, testscount);
+ printf(" Some tests failed (%d of %d)\n", failcount, i);
}
printf("\n");
@@ -248,11 +244,7 @@ int test_jig(int argc, char *argv[])
unsigned i;
char *args[2] = {"jig", NULL};
unsigned int failcount = 0;
- unsigned int testscount = 0;
-
- /* store test results */
- bool passed[(sizeof(tests) / sizeof(tests[0]))];
- memset(&passed, 0, sizeof(passed));
+ bool passed[NTESTS];
printf("\nRunning all tests...\n\n");
for (i = 0; tests[i].name; i++) {
@@ -265,13 +257,12 @@ int test_jig(int argc, char *argv[])
fprintf(stderr, " [%s] \t\t\tFAIL\n", tests[i].name);
fflush(stderr);
failcount++;
+ passed[i] = false;
} else {
- passed[i] = true;
printf(" [%s] \t\t\tPASS\n", tests[i].name);
fflush(stdout);
+ passed[i] = true;
}
-
- testscount++;
}
}
@@ -292,7 +283,7 @@ int test_jig(int argc, char *argv[])
printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n");
printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n");
printf("\n");
- printf(" All tests passed (%d of %d)\n", testscount, testscount);
+ printf(" All tests passed (%d of %d)\n", i, i);
} else {
printf(" ______ ______ __ __ \n");
printf(" /\\ ___\\ /\\ __ \\ /\\ \\ /\\ \\ \n");
@@ -300,7 +291,7 @@ int test_jig(int argc, char *argv[])
printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n");
printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n");
printf("\n");
- printf(" Some tests failed (%d of %d)\n", failcount, testscount);
+ printf(" Some tests failed (%d of %d)\n", failcount, i);
}
printf("\n");
@@ -309,7 +300,7 @@ int test_jig(int argc, char *argv[])
unsigned int k;
for (k = 0; k < i; k++)
{
- if (!passed[k] && !(tests[k].options & OPT_NOJIGTEST))
+ if (!passed[i] && !(tests[k].options & OPT_NOJIGTEST))
{
printf(" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n", tests[k].name, tests[k].name);
}