diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-10-31 19:06:14 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-10-31 19:06:14 +0000 |
commit | 6b104a6c69e3e77f399cdd34ac35648b492b3d75 (patch) | |
tree | 3d8c6a4be325a62199e03dc92933c2339e465dfd /firmware/test/fat | |
parent | 08356fb50a70bc44e598ff49ab61bd149060a668 (diff) |
Improved tests.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2794 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/fat')
-rw-r--r-- | firmware/test/fat/ata-sim.c | 14 | ||||
-rw-r--r-- | firmware/test/fat/main.c | 13 | ||||
-rw-r--r-- | firmware/test/fat/test.sh | 28 |
3 files changed, 30 insertions, 25 deletions
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index 661cc79a1f..10bc3d9dc5 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c @@ -10,28 +10,23 @@ static FILE* file; int ata_read_sectors(unsigned long start, unsigned char count, void* buf) { - int i; - for (i=0; i<count; i++ ) - DEBUGF("[Reading block 0x%lx]\n",start+i); + DEBUGF("[Reading block 0x%lx, %d]\n", start, count); if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { perror("fseek"); return -1; } if(!fread(buf,BLOCK_SIZE,count,file)) { - printf("Failed reading %d blocks starting at block 0x%lx\n",count,start); + DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf ); perror("fread"); panicf("Disk error\n"); - return -2; } return 0; } int ata_write_sectors(unsigned long start, unsigned char count, void* buf) { - int i; - for (i=0; i<count; i++ ) - DEBUGF("[Writing block 0x%lx]\n",start+i); + DEBUGF("[Writing block 0x%lx, %d]\n", start, count); if (start == 0) panicf("Writing on sector 0!\n"); @@ -39,11 +34,10 @@ int ata_write_sectors(unsigned long start, unsigned char count, void* buf) if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { perror("fseek"); return -1; - panicf("Disk error\n"); } if(!fwrite(buf,BLOCK_SIZE,count,file)) { + DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf ); perror("fwrite"); - return -2; panicf("Disk error\n"); } return 0; diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index 0259be410b..ab71308abb 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c @@ -99,17 +99,26 @@ int dbg_mkfile(char* name, int num) } num *= 1024; while ( num ) { + int rc; int len = num > sizeof text ? sizeof text : num; for (i=0; i<len/CHUNKSIZE; i++ ) sprintf(text+i*CHUNKSIZE,"%c%06x,",name[1],x++); - if (write(fd, text, len) < 0) { + rc = write(fd, text, len); + if ( rc < 0 ) { DEBUGF("Failed writing data\n"); return -1; } + else + if ( rc == 0 ) { + DEBUGF("No space left\n"); + break; + } + else + DEBUGF("wrote %d bytes\n",rc); + num -= len; - DEBUGF("wrote %d bytes\n",len); } close(fd); diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh index 476b0e4542..2f58b3cb81 100644 --- a/firmware/test/fat/test.sh +++ b/firmware/test/fat/test.sh @@ -58,35 +58,37 @@ runtests() { try chkfile /apa.txt try chkfile /bpa.txt - echo ---Test: create 10 1k files - for i in `seq 1 10`; + LOOP=50 + + echo ---Test: create $LOOP 40k files + for i in `seq 1 $LOOP`; do - echo ---Test: $i/10 --- - try mkfile /rockbox.$i + echo ---Test: $i/$LOOP --- + try mkfile /rockbox.$i 40 check - try chkfile /bpa.txt + try chkfile /rockbox.$i done } -echo "Building test image (1 sector/cluster)" -buildimage 1 +echo "Building test image (128 sectors/cluster)" +buildimage 128 runtests -echo "Building test image (4 sector/cluster)" -buildimage 4 +echo "Building test image (32 sectors/cluster)" +buildimage 32 runtests echo "Building test image (8 sectors/cluster)" buildimage 8 runtests -echo "Building test image (32 sectors/cluster)" -buildimage 32 +echo "Building test image (4 sector/cluster)" +buildimage 4 runtests -echo "Building test image (128 sectors/cluster)" -buildimage 128 +echo "Building test image (1 sector/cluster)" +buildimage 1 runtests echo "== Test completed sucessfully ==" |