Fixed #153 - when no microSD card is present, test used to hang, now aborts with error.

This commit is contained in:
Lorenz Meier 2013-01-13 09:35:56 +01:00
parent 2f94a7a2b7
commit ca690f6027
1 changed files with 8 additions and 0 deletions

View File

@ -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");