From a5e77d8f943e602c56036f0f21b60b7f442a3976 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 31 Oct 2002 16:09:28 +0000 Subject: Fat writing update. File creation now works, though still only short filenames. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2790 a1c6a512-1295-4272-9138-f99709370657 --- firmware/test/fat/ata-sim.c | 19 +++++++++++++------ firmware/test/fat/main.c | 21 ++++++++++++--------- firmware/test/fat/test.sh | 39 +++++++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 29 deletions(-) (limited to 'firmware/test') diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index a64e0a4d4d..661cc79a1f 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c @@ -2,6 +2,7 @@ #include #include #include "debug.h" +#include "panic.h" #define BLOCK_SIZE 512 @@ -9,7 +10,10 @@ static FILE* file; int ata_read_sectors(unsigned long start, unsigned char count, void* buf) { - DEBUGF("[Reading block 0x%lx]\n",start); + int i; + for (i=0; i-----------------------------------------\n", sec); - dbg_dump_buffer(buf, 512); + dbg_dump_buffer(buf, 512, 0); } -void dbg_dump_buffer(unsigned char *buf, int len) +void dbg_dump_buffer(unsigned char *buf, int len, int offset) { int i, j; unsigned char c; @@ -42,7 +42,7 @@ void dbg_dump_buffer(unsigned char *buf, int len) for(i = 0;i < len/16;i++) { - DEBUGF("%03x: ", i*16); + DEBUGF("%03x: ", i*16 + offset); for(j = 0;j < 16;j++) { c = buf[i*16+j]; @@ -102,7 +102,7 @@ int dbg_mkfile(char* name, int num) int len = num > sizeof text ? sizeof text : num; for (i=0; i result.txt + ./fat $1 $2 $3 2>> $RESULT RETVAL=$? [ $RETVAL -ne 0 ] && fail } buildimage() { - umount $MOUNT - /sbin/mkdosfs -F 32 -s $1 disk.img >/dev/null + /sbin/mkdosfs -F 32 -s $1 $IMAGE > /dev/null mount -o loop $IMAGE $MOUNT echo "Filling it with /etc files" find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \; + umount $MOUNT } runtests() { + rm $RESULT echo ---Test: create a 10K file try mkfile /apa.txt 10 @@ -53,29 +55,38 @@ runtests() { try mkfile /cpa.txt 0 check try chkfile /cpa.txt + try chkfile /apa.txt + try chkfile /bpa.txt - echo ---Test: create 20 1k files + echo ---Test: create 10 1k files for i in `seq 1 10`; do - echo -n $i + echo ---Test: $i/10 --- try mkfile /rockbox.$i check + try chkfile /bpa.txt done } -echo "Building test image A (2 sectors/cluster)" -buildimage 2 +echo "Building test image (1 sector/cluster)" +buildimage 1 runtests -echo "Building test image B (8 sectors/cluster)" +echo "Building test image (4 sector/cluster)" +buildimage 4 +runtests + +echo "Building test image (8 sectors/cluster)" buildimage 8 runtests -echo "Building test image B (1 sector/cluster)" -buildimage 1 +echo "Building test image (32 sectors/cluster)" +buildimage 32 runtests -umount $MOUNT +echo "Building test image (128 sectors/cluster)" +buildimage 128 +runtests -echo "-- Test complete --" +echo "== Test completed sucessfully ==" -- cgit v1.2.3