From ca690f60272b5330f632cd18b58ee9af89fbc9ae Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 13 Jan 2013 09:35:56 +0100 Subject: [PATCH] Fixed #153 - when no microSD card is present, test used to hang, now aborts with error. --- apps/px4/tests/tests_file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/px4/tests/tests_file.c b/apps/px4/tests/tests_file.c index 697410cee4..6f75b9812e 100644 --- a/apps/px4/tests/tests_file.c +++ b/apps/px4/tests/tests_file.c @@ -37,6 +37,7 @@ * File write test. */ +#include #include #include #include @@ -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");