summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-05-08 12:13:47 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-05-08 12:13:47 +0000
commit49b4488d8a2ff5e28404c3509d11dd48dc9b535d (patch)
tree10aee65f2ccd64ced6c226e53fb04fe5e66f4eb2
parent073ce1aab3ac73e0b434acd8b5dedee40eab79e4 (diff)
downloadrockbox-49b4488d8a2ff5e28404c3509d11dd48dc9b535d.tar.gz
rockbox-49b4488d8a2ff5e28404c3509d11dd48dc9b535d.zip
Added 'type' testcase for open/read/close
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@514 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/test/fat/Makefile2
-rw-r--r--firmware/test/fat/main.c15
2 files changed, 11 insertions, 6 deletions
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;
}