diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-02-15 13:45:33 -0800 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-02-15 13:45:33 -0800 |
commit | 5b8ad11498826dc001eb5ce181350a3207ff8ed5 (patch) | |
tree | 7eb4541eaa99f9554fde544948d8ed672fef7c8f /apps | |
parent | 5e8efbf2e91c1365059e1f7446c9690bb3337b40 (diff) | |
parent | 7ccc57f3c0c5616347f42a41ae06fc17486ac49e (diff) | |
download | px4-firmware-5b8ad11498826dc001eb5ce181350a3207ff8ed5.tar.gz px4-firmware-5b8ad11498826dc001eb5ce181350a3207ff8ed5.tar.bz2 px4-firmware-5b8ad11498826dc001eb5ce181350a3207ff8ed5.zip |
Merge pull request #192 from PX4/tests
Fixed test outputs, decoupled tests from NuttX low-level output
Diffstat (limited to 'apps')
-rw-r--r-- | apps/px4/tests/test_adc.c | 8 | ||||
-rw-r--r-- | apps/px4/tests/tests_main.c | 12 |
2 files changed, 13 insertions, 7 deletions
diff --git a/apps/px4/tests/test_adc.c b/apps/px4/tests/test_adc.c index 4c021303f..030ac6e23 100644 --- a/apps/px4/tests/test_adc.c +++ b/apps/px4/tests/test_adc.c @@ -60,8 +60,10 @@ int test_adc(int argc, char *argv[]) { int fd = open(ADC_DEVICE_PATH, O_RDONLY); - if (fd < 0) - err(1, "can't open ADC device"); + if (fd < 0) { + warnx("ERROR: can't open ADC device"); + return 1; + } for (unsigned i = 0; i < 5; i++) { /* make space for a maximum of eight channels */ @@ -82,7 +84,7 @@ int test_adc(int argc, char *argv[]) usleep(150000); } - message("\t ADC test successful.\n"); + warnx("\t ADC test successful.\n"); errout_with_dev: diff --git a/apps/px4/tests/tests_main.c b/apps/px4/tests/tests_main.c index ad6828f20..9f8c5c9ea 100644 --- a/apps/px4/tests/tests_main.c +++ b/apps/px4/tests/tests_main.c @@ -135,6 +135,7 @@ test_all(int argc, char *argv[]) unsigned i; char *args[2] = {"all", NULL}; unsigned int failcount = 0; + unsigned int testcount = 0; bool passed[NTESTS]; printf("\nRunning all tests...\n\n"); @@ -156,6 +157,7 @@ test_all(int argc, char *argv[]) fflush(stdout); passed[i] = true; } + testcount++; } } @@ -178,7 +180,7 @@ test_all(int argc, char *argv[]) printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n"); printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n"); printf("\n"); - printf(" All tests passed (%d of %d)\n", i, i); + printf(" All tests passed (%d of %d)\n", testcount, testcount); } else { printf(" ______ ______ __ __ \n"); @@ -187,7 +189,7 @@ test_all(int argc, char *argv[]) printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n"); printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n"); printf("\n"); - printf(" Some tests failed (%d of %d)\n", failcount, i); + printf(" Some tests failed (%d of %d)\n", failcount, testcount); } printf("\n"); @@ -245,6 +247,7 @@ int test_jig(int argc, char *argv[]) unsigned i; char *args[2] = {"jig", NULL}; unsigned int failcount = 0; + unsigned int testcount = 0; bool passed[NTESTS]; printf("\nRunning all tests...\n\n"); @@ -264,6 +267,7 @@ int test_jig(int argc, char *argv[]) fflush(stdout); passed[i] = true; } + testcount++; } } @@ -284,7 +288,7 @@ int test_jig(int argc, char *argv[]) printf(" \\ \\_\\ \\_\\ \\ \\_____\\ \\ \\_____\\ \\ \\_____\\ \\ \\_\\ \\_\\ \n"); printf(" \\/_/\\/_/ \\/_____/ \\/_____/ \\/_____/ \\/_/\\/_/ \n"); printf("\n"); - printf(" All tests passed (%d of %d)\n", i, i); + printf(" All tests passed (%d of %d)\n", testcount, testcount); } else { printf(" ______ ______ __ __ \n"); printf(" /\\ ___\\ /\\ __ \\ /\\ \\ /\\ \\ \n"); @@ -292,7 +296,7 @@ int test_jig(int argc, char *argv[]) printf(" \\ \\_\\ \\ \\_\\ \\_\\ \\ \\_\\ \\ \\_____\\ \n"); printf(" \\/_/ \\/_/\\/_/ \\/_/ \\/_____/ \n"); printf("\n"); - printf(" Some tests failed (%d of %d)\n", failcount, i); + printf(" Some tests failed (%d of %d)\n", failcount, testcount); } printf("\n"); |