From 49b4488d8a2ff5e28404c3509d11dd48dc9b535d Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 8 May 2002 12:13:47 +0000 Subject: Added 'type' testcase for open/read/close git-svn-id: svn://svn.rockbox.org/rockbox/trunk@514 a1c6a512-1295-4272-9138-f99709370657 --- firmware/test/fat/Makefile | 2 +- firmware/test/fat/main.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'firmware/test/fat') diff --git a/firmware/test/fat/Makefile b/firmware/test/fat/Makefile index bd6869e8e9..1d69467892 100644 --- a/firmware/test/fat/Makefile +++ b/firmware/test/fat/Makefile @@ -21,7 +21,7 @@ file.o: $(FIRMWARE)/common/file.c $(CC) $(CFLAGS) -c $< -o $@ debug.o: $(FIRMWARE)/debug.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -DSIMULATOR -c $< -o $@ ata-sim.o: ata-sim.c $(DRIVERS)/ata.h diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index 0cf06bdac3..5490fa9777 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c @@ -111,15 +111,19 @@ void dbg_type(char* name) DEBUGF("Got file descriptor %d\n",fd); for (i=0;i<5;i++) { - rc = read(fd, buf, SECTOR_SIZE/3); - if( rc >= 0 ) + rc = read(fd, buf, SECTOR_SIZE*2/3); + if( rc > 0 ) { - buf[SECTOR_SIZE]=0; - DEBUGF("%d: %d\n", i, rc); + buf[rc]=0; + printf("%d: %s\n", i, buf); + } + else if ( rc == 0 ) { + DEBUGF("EOF\n"); + break; } else { - DEBUGF("Failed reading file\n"); + DEBUGF("Failed reading file: %d\n",rc); } } close(fd); @@ -218,6 +222,7 @@ int main(int argc, char *argv[]) } dbg_console(); + return 0; } -- cgit v1.2.3