diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-05-08 12:13:47 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-05-08 12:13:47 +0000 |
commit | 49b4488d8a2ff5e28404c3509d11dd48dc9b535d (patch) | |
tree | 10aee65f2ccd64ced6c226e53fb04fe5e66f4eb2 /firmware/test/fat | |
parent | 073ce1aab3ac73e0b434acd8b5dedee40eab79e4 (diff) | |
download | rockbox-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
Diffstat (limited to 'firmware/test/fat')
-rw-r--r-- | firmware/test/fat/Makefile | 2 | ||||
-rw-r--r-- | firmware/test/fat/main.c | 15 |
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 | |||
21 | $(CC) $(CFLAGS) -c $< -o $@ | 21 | $(CC) $(CFLAGS) -c $< -o $@ |
22 | 22 | ||
23 | debug.o: $(FIRMWARE)/debug.c | 23 | debug.o: $(FIRMWARE)/debug.c |
24 | $(CC) $(CFLAGS) -c $< -o $@ | 24 | $(CC) $(CFLAGS) -DSIMULATOR -c $< -o $@ |
25 | 25 | ||
26 | ata-sim.o: ata-sim.c $(DRIVERS)/ata.h | 26 | ata-sim.o: ata-sim.c $(DRIVERS)/ata.h |
27 | 27 | ||
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) | |||
111 | DEBUGF("Got file descriptor %d\n",fd); | 111 | DEBUGF("Got file descriptor %d\n",fd); |
112 | 112 | ||
113 | for (i=0;i<5;i++) { | 113 | for (i=0;i<5;i++) { |
114 | rc = read(fd, buf, SECTOR_SIZE/3); | 114 | rc = read(fd, buf, SECTOR_SIZE*2/3); |
115 | if( rc >= 0 ) | 115 | if( rc > 0 ) |
116 | { | 116 | { |
117 | buf[SECTOR_SIZE]=0; | 117 | buf[rc]=0; |
118 | DEBUGF("%d: %d\n", i, rc); | 118 | printf("%d: %s\n", i, buf); |
119 | } | ||
120 | else if ( rc == 0 ) { | ||
121 | DEBUGF("EOF\n"); | ||
122 | break; | ||
119 | } | 123 | } |
120 | else | 124 | else |
121 | { | 125 | { |
122 | DEBUGF("Failed reading file\n"); | 126 | DEBUGF("Failed reading file: %d\n",rc); |
123 | } | 127 | } |
124 | } | 128 | } |
125 | close(fd); | 129 | close(fd); |
@@ -218,6 +222,7 @@ int main(int argc, char *argv[]) | |||
218 | } | 222 | } |
219 | 223 | ||
220 | dbg_console(); | 224 | dbg_console(); |
225 | |||
221 | return 0; | 226 | return 0; |
222 | } | 227 | } |
223 | 228 | ||