mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 07:13:35 +08:00
Merge pull request #154 from PX4/file_test_fix
Fixed #153 - when no microSD card is present, test used to hang, now abo...
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
* File write test.
|
* File write test.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -51,6 +52,13 @@
|
|||||||
int
|
int
|
||||||
test_file(int argc, char *argv[])
|
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];
|
uint8_t buf[512];
|
||||||
hrt_abstime start, end;
|
hrt_abstime start, end;
|
||||||
perf_counter_t wperf = perf_alloc(PC_ELAPSED, "SD writes");
|
perf_counter_t wperf = perf_alloc(PC_ELAPSED, "SD writes");
|
||||||
|
|||||||
Reference in New Issue
Block a user