aboutsummaryrefslogtreecommitdiff
path: root/apps/px4
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-01-13 09:35:56 +0100
committerLorenz Meier <lm@inf.ethz.ch>2013-01-13 09:35:56 +0100
commitca690f60272b5330f632cd18b58ee9af89fbc9ae (patch)
tree2d5a53721cedd8da8d99e0d113e7bc6d25c5d48a /apps/px4
parent2f94a7a2b71b569361bf4772638fc2c6aa7faef0 (diff)
downloadpx4-firmware-ca690f60272b5330f632cd18b58ee9af89fbc9ae.tar.gz
px4-firmware-ca690f60272b5330f632cd18b58ee9af89fbc9ae.tar.bz2
px4-firmware-ca690f60272b5330f632cd18b58ee9af89fbc9ae.zip
Fixed #153 - when no microSD card is present, test used to hang, now aborts with error.
Diffstat (limited to 'apps/px4')
-rw-r--r--apps/px4/tests/tests_file.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/px4/tests/tests_file.c b/apps/px4/tests/tests_file.c
index 697410cee..6f75b9812 100644
--- a/apps/px4/tests/tests_file.c
+++ b/apps/px4/tests/tests_file.c
@@ -37,6 +37,7 @@
* File write test.
*/
+#include <sys/stat.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
@@ -51,6 +52,13 @@
int
test_file(int argc, char *argv[])
{
+ /* check if microSD card is mounted */
+ struct stat buffer;
+ if (stat("/fs/microsd/", &buffer)) {
+ warnx("no microSD card mounted, aborting file test");
+ return 1;
+ }
+
uint8_t buf[512];
hrt_abstime start, end;
perf_counter_t wperf = perf_alloc(PC_ELAPSED, "SD writes");