diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-11-01 15:26:06 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-11-01 15:26:06 +0000 |
commit | 307f5d846e1513ef609b76e2d6cea035c8465b33 (patch) | |
tree | d93d38a60d136e41cd1f6894594f55618ece316e /firmware/test/fat | |
parent | 54d5e2cb2734d1520d234db878fa75cca68784a1 (diff) | |
download | rockbox-307f5d846e1513ef609b76e2d6cea035c8465b33.tar.gz rockbox-307f5d846e1513ef609b76e2d6cea035c8465b33.zip |
Added remove()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2801 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/fat')
-rw-r--r-- | firmware/test/fat/ata-sim.c | 2 | ||||
-rw-r--r-- | firmware/test/fat/main.c | 12 | ||||
-rw-r--r-- | firmware/test/fat/test.sh | 19 |
3 files changed, 27 insertions, 6 deletions
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index 04cdadb6ce..63abc58084 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c | |||
@@ -14,7 +14,7 @@ int ata_read_sectors(unsigned long start, unsigned char count, void* buf) | |||
14 | DEBUGF("[Reading %d blocks: 0x%lx to 0x%lx]\n", | 14 | DEBUGF("[Reading %d blocks: 0x%lx to 0x%lx]\n", |
15 | count, start, start+count-1); | 15 | count, start, start+count-1); |
16 | else | 16 | else |
17 | DEBUGF("[Reading block 0x%lx, %d]\n", start, count); | 17 | DEBUGF("[Reading block 0x%lx]\n", start); |
18 | 18 | ||
19 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { | 19 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { |
20 | perror("fseek"); | 20 | perror("fseek"); |
diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index 68cef1f08c..58f83f45dc 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c | |||
@@ -267,6 +267,11 @@ void dbg_head(char* name) | |||
267 | close(fd); | 267 | close(fd); |
268 | } | 268 | } |
269 | 269 | ||
270 | int dbg_del(char* name) | ||
271 | { | ||
272 | return remove(name); | ||
273 | } | ||
274 | |||
270 | char current_directory[256] = "\\"; | 275 | char current_directory[256] = "\\"; |
271 | int last_secnum = 0; | 276 | int last_secnum = 0; |
272 | 277 | ||
@@ -300,6 +305,7 @@ int dbg_cmd(int argc, char *argv[]) | |||
300 | " tail <file>\n" | 305 | " tail <file>\n" |
301 | " mkfile <file> <size (KB)>\n" | 306 | " mkfile <file> <size (KB)>\n" |
302 | " chkfile <file>\n" | 307 | " chkfile <file>\n" |
308 | " del <file>\n" | ||
303 | ); | 309 | ); |
304 | return -1; | 310 | return -1; |
305 | } | 311 | } |
@@ -358,6 +364,12 @@ int dbg_cmd(int argc, char *argv[]) | |||
358 | } | 364 | } |
359 | } | 365 | } |
360 | 366 | ||
367 | if (!strcasecmp(cmd, "del")) | ||
368 | { | ||
369 | if (arg1) | ||
370 | return dbg_del(arg1); | ||
371 | } | ||
372 | |||
361 | return 0; | 373 | return 0; |
362 | } | 374 | } |
363 | 375 | ||
diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh index f723f69ec3..7d9435b85d 100644 --- a/firmware/test/fat/test.sh +++ b/firmware/test/fat/test.sh | |||
@@ -15,6 +15,7 @@ check() { | |||
15 | } | 15 | } |
16 | 16 | ||
17 | try() { | 17 | try() { |
18 | echo COMMAND: fat $1 $2 $3 >> $RESULT | ||
18 | ./fat $1 $2 $3 2>> $RESULT | 19 | ./fat $1 $2 $3 2>> $RESULT |
19 | RETVAL=$? | 20 | RETVAL=$? |
20 | [ $RETVAL -ne 0 ] && fail | 21 | [ $RETVAL -ne 0 ] && fail |
@@ -25,6 +26,7 @@ buildimage() { | |||
25 | mount -o loop $IMAGE $MOUNT | 26 | mount -o loop $IMAGE $MOUNT |
26 | echo "Filling it with /etc files" | 27 | echo "Filling it with /etc files" |
27 | find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \; | 28 | find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \; |
29 | mkdir $MOUNT/dir | ||
28 | umount $MOUNT | 30 | umount $MOUNT |
29 | } | 31 | } |
30 | 32 | ||
@@ -33,8 +35,10 @@ runtests() { | |||
33 | 35 | ||
34 | echo ---Test: create a 10K file | 36 | echo ---Test: create a 10K file |
35 | try mkfile /apa.txt 10 | 37 | try mkfile /apa.txt 10 |
38 | try mkfile /dir/apa.txt 10 | ||
36 | check | 39 | check |
37 | try chkfile /apa.txt 10 | 40 | try chkfile /apa.txt 10 |
41 | try chkfile /dir/apa.txt 8 | ||
38 | 42 | ||
39 | echo ---Test: create a 1K file | 43 | echo ---Test: create a 1K file |
40 | try mkfile /bpa.txt 1 | 44 | try mkfile /bpa.txt 1 |
@@ -64,7 +68,7 @@ runtests() { | |||
64 | try chkfile /bpa.txt | 68 | try chkfile /bpa.txt |
65 | 69 | ||
66 | LOOP=50 | 70 | LOOP=50 |
67 | SIZE=50 | 71 | SIZE=70 |
68 | 72 | ||
69 | echo ---Test: create $LOOP $SIZE k files | 73 | echo ---Test: create $LOOP $SIZE k files |
70 | for i in `seq 1 $LOOP`; | 74 | for i in `seq 1 $LOOP`; |
@@ -73,10 +77,19 @@ runtests() { | |||
73 | try mkfile /rockbox.$i $SIZE | 77 | try mkfile /rockbox.$i $SIZE |
74 | check | 78 | check |
75 | try chkfile /rockbox.$i $SIZE | 79 | try chkfile /rockbox.$i $SIZE |
80 | check | ||
81 | try del /rockbox.$i | ||
82 | check | ||
83 | try mkfile /rockbox.$i $SIZE | ||
84 | check | ||
76 | done | 85 | done |
77 | 86 | ||
78 | } | 87 | } |
79 | 88 | ||
89 | echo "Building test image (4 sector/cluster)" | ||
90 | buildimage 4 | ||
91 | runtests | ||
92 | |||
80 | echo "Building test image (128 sectors/cluster)" | 93 | echo "Building test image (128 sectors/cluster)" |
81 | buildimage 128 | 94 | buildimage 128 |
82 | runtests | 95 | runtests |
@@ -89,10 +102,6 @@ echo "Building test image (8 sectors/cluster)" | |||
89 | buildimage 8 | 102 | buildimage 8 |
90 | runtests | 103 | runtests |
91 | 104 | ||
92 | echo "Building test image (4 sector/cluster)" | ||
93 | buildimage 4 | ||
94 | runtests | ||
95 | |||
96 | echo "Building test image (1 sector/cluster)" | 105 | echo "Building test image (1 sector/cluster)" |
97 | buildimage 1 | 106 | buildimage 1 |
98 | runtests | 107 | runtests |