43 #include <px4_platform_common/px4_config.h> 51 static int test_help(
int argc,
char *argv[]);
54 static int test_all(
int argc,
char *argv[]);
55 static int test_jig(
int argc,
char *argv[]);
59 int (*
fn)(
int argc,
char *argv[]);
61 #define OPT_NOHELP (1<<0) 62 #define OPT_NOALLTEST (1<<1) 63 #define OPT_NOJIGTEST (1<<2) 103 {
"mount",
test_mount, OPT_NOJIGTEST | OPT_NOALLTEST},
107 {
"ppm",
test_ppm, OPT_NOJIGTEST | OPT_NOALLTEST},
109 {
"rc",
test_rc, OPT_NOJIGTEST | OPT_NOALLTEST},
111 {
"servo",
test_servo, OPT_NOJIGTEST | OPT_NOALLTEST},
133 #define NTESTS (sizeof(tests) / sizeof(tests[0])) 140 printf(
"Available tests:\n");
142 for (i = 0;
tests[i].name; i++) {
165 char *args[2] = {
"all", NULL};
166 unsigned int failcount = 0;
167 unsigned int testcount = 0;
168 unsigned int passed[
NTESTS];
170 printf(
"\nRunning all tests...\n\n");
172 for (i = 0;
tests[i].name; i++) {
175 for (
int j = 0; j < 80; j++) {
179 printf(
"\n [%s] \t\tSTARTING TEST\n",
tests[i].
name);
183 if (
tests[i].
fn(1, args) != 0) {
184 fprintf(stderr,
" [%s] \t\tFAIL\n",
tests[i].name);
190 printf(
" [%s] \t\tPASS\n",
tests[i].name);
195 for (
int j = 0; j < 80; j++) {
207 for (
size_t j = 0; j < 80; j++) {
211 printf(
"\n\n T E S T S U M M A R Y\n\n");
213 if (failcount == 0) {
214 printf(
" ______ __ __ ______ __ __ \n");
215 printf(
" /\\ __ \\ /\\ \\ /\\ \\ /\\ __ \\ /\\ \\/ / \n");
216 printf(
" \\ \\ __ \\ \\ \\ \\____ \\ \\ \\____ \\ \\ \\/\\ \\ \\ \\ _\"-. \n");
217 printf(
" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n");
218 printf(
" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n");
220 printf(
" All tests passed (%d of %d)\n\n", testcount, testcount);
223 printf(
" ______ ______ __ __ \n");
224 printf(
" /\\ ___\\ /\\ __ \\ /\\ \\ /\\ \\ \n");
225 printf(
" \\ \\ __\\ \\ \\ __ \\ \\ \\ \\ \\ \\ \\__\n");
226 printf(
" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n");
227 printf(
" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n");
229 printf(
" Some tests failed (%d of %d)\n\n", failcount, testcount);
234 printf(
" Failed tests:\n\n");
237 for (
size_t k = 0; k < i; k++) {
239 printf(
" [%s] to obtain details, please re-run with\n\t nsh> tests %s\n\n",
tests[k].
name,
tests[k].name);
244 return (failcount > 0);
255 printf(
"tests: missing test name - 'tests help' for a list of tests\n");
259 int tone_test_index = -1;
260 char *tone_test = {
"tone"};
261 char *tone_fail[2] = {NULL,
"2"};
262 char *tone_pass[2] = {NULL,
"14"};
265 for (
size_t i = 0;
tests[i].name; i++) {
271 for (
size_t i = 0;
tests[i].name; i++) {
273 if (
tests[i].
fn(argc - 1, argv + 1) == 0) {
274 if (tone_test_index != -1) {
275 tests[tone_test_index].fn(2, tone_pass);
278 printf(
"%s PASSED\n",
tests[i].name);
282 if (tone_test_index != -1) {
283 tests[tone_test_index].fn(2, tone_fail);
286 printf(
"%s FAILED\n",
tests[i].name);
292 printf(
"tests: no test called '%s' - 'tests help' for a list of tests\n", argv[1]);
static int test_help(int argc, char *argv[])
int test_time(int argc, char *argv[])
int test_IntrusiveQueue(int argc, char *argv[])
int test_microbench_hrt(int argc, char *argv[])
int test_ppm(int argc, char *argv[])
int test_mixer(int argc, char *argv[])
int test_bezierQuad(int argc, char *argv[])
int test_tone(int argc, char *argv[])
int test_microbench_math(int argc, char *argv[])
int test_smooth_z(int argc, char *argv[])
int test_dataman(int argc, char *argv[])
int test_conv(int argc, char *argv[])
int test_autodeclination(int argc, char *argv[])
int test_uart_loopback(int argc, char *argv[])
int test_sleep(int argc, char *argv[])
__EXPORT int uorb_tests_main(int argc, char *argv[])
int test_matrix(int argc, char *argv[])
int test_ppm_loopback(int argc, char *argv[])
int test_versioning(int argc, char *argv[])
int test_rc(int argc, char *argv[])
__EXPORT int sf0x_tests_main(int argc, char *argv[])
int test_List(int argc, char *argv[])
int test_mathlib(int argc, char *argv[])
int test_mount(int argc, char *argv[])
int test_jig_voltages(int argc, char *argv[])
int test_perf(int argc, char *argv[])
static int test_all(int argc, char *argv[])
int test_uart_send(int argc, char *argv[])
int test_param(int argc, char *argv[])
const struct @146 tests[]
int test_bson(int argc, char *argv[])
int test_uart_console(int argc, char *argv[])
static int test_jig(int argc, char *argv[])
int(* fn)(int argc, char *argv[])
__EXPORT int controllib_test_main(int argc, char *argv[])
int test_float(int argc, char *argv[])
int test_file2(int argc, char *argv[])
int test_servo(int argc, char *argv[])
__EXPORT int commander_tests_main(int argc, char *argv[])
__EXPORT int rc_tests_main(int argc, char *argv[])
int test_hrt(int argc, char *argv[])
__EXPORT int mavlink_tests_main(int argc, char *argv[])
int test_microbench_uorb(int argc, char *argv[])
int test_uart_baudchange(int argc, char *argv[])
int test_hott_telemetry(int argc, char *argv[])
static int test_runner(unsigned option)
int test_led(int argc, char *argv[])
int test_microbench_matrix(int argc, char *argv[])
int test_parameters(int argc, char *argv[])
int test_uart_break(int argc, char *argv[])
int test_file(int argc, char *argv[])
int test_int(int argc, char *argv[])
__EXPORT int tests_main(int argc, char *argv[])
Executes system tests.
int test_search_min(int argc, char *argv[])
int test_adc(int argc, char *argv[])