From: Keith Packard Date: Sun, 31 Mar 2013 19:39:32 +0000 (-0700) Subject: altos: Unmount file system after each testing pass in ao_fat_test X-Git-Tag: altosdroid_v1.2-1~52 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=144b44e13ce3361ff59cbb555e84d542455a4e17 altos: Unmount file system after each testing pass in ao_fat_test Otherwise, we use stale data and 'bad things' happen. Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_fat.c b/src/drivers/ao_fat.c index bb0aa7a2..9cd3d34b 100644 --- a/src/drivers/ao_fat.c +++ b/src/drivers/ao_fat.c @@ -608,6 +608,12 @@ ao_fat_setup(void) return ao_filesystem_status; } +void +ao_fat_unmount(void) +{ + ao_filesystem_setup = 0; +} + /* * Basic file operations */ diff --git a/src/drivers/ao_fat.h b/src/drivers/ao_fat.h index 40786990..36aec7df 100644 --- a/src/drivers/ao_fat.h +++ b/src/drivers/ao_fat.h @@ -63,6 +63,9 @@ ao_fat_init(void); void ao_fat_sync(void); +void +ao_fat_unmount(void); + int8_t ao_fat_full(void); diff --git a/src/test/ao_fat_test.c b/src/test/ao_fat_test.c index 48d5d8a4..eb55d9c8 100644 --- a/src/test/ao_fat_test.c +++ b/src/test/ao_fat_test.c @@ -226,14 +226,15 @@ fatal(char *msg, ...) void check_fat(void) { - int e; - int f; + cluster_t e; + int f; for (e = 0; e < number_cluster; e++) { cluster_t v = ao_fat_entry_raw_read(e, 0); for (f = 1; f < number_fat; f++) { - if (ao_fat_entry_raw_read(e, f) != v) - fatal ("fats differ at %d\n", e); + cluster_t o = ao_fat_entry_raw_read(e, f); + if (o != v) + fatal ("fats differ at %08x (0 %08x %d %08x)\n", e, v, f, o); } } } @@ -490,6 +491,7 @@ main(int argc, char **argv) #else long_test_fs(); #endif + ao_fat_unmount(); } return 0;