summaryrefslogtreecommitdiff
path: root/firmware/test/fat/test.sh
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test/fat/test.sh')
-rw-r--r--firmware/test/fat/test.sh77
1 files changed, 46 insertions, 31 deletions
diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh
index 7d9435b85d..6a26e7ff59 100644
--- a/firmware/test/fat/test.sh
+++ b/firmware/test/fat/test.sh
@@ -15,8 +15,9 @@ check() {
15} 15}
16 16
17try() { 17try() {
18 echo COMMAND: fat $1 $2 $3 >> $RESULT 18 echo COMMAND: fat $1 "$2" "$3"
19 ./fat $1 $2 $3 2>> $RESULT 19 echo COMMAND: fat $1 "$2" "$3" >> $RESULT
20 ./fat $1 "$2" "$3" 2>> $RESULT
20 RETVAL=$? 21 RETVAL=$?
21 [ $RETVAL -ne 0 ] && fail 22 [ $RETVAL -ne 0 ] && fail
22} 23}
@@ -26,6 +27,10 @@ buildimage() {
26 mount -o loop $IMAGE $MOUNT 27 mount -o loop $IMAGE $MOUNT
27 echo "Filling it with /etc files" 28 echo "Filling it with /etc files"
28 find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \; 29 find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \;
30 for i in `seq 1 120`;
31 do
32 echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"
33 done
29 mkdir $MOUNT/dir 34 mkdir $MOUNT/dir
30 umount $MOUNT 35 umount $MOUNT
31} 36}
@@ -34,53 +39,63 @@ runtests() {
34 rm $RESULT 39 rm $RESULT
35 40
36 echo ---Test: create a 10K file 41 echo ---Test: create a 10K file
37 try mkfile /apa.txt 10 42 try mkfile "/really long filenames rock" 10
38 try mkfile /dir/apa.txt 10 43 check
44 try mkfile /dir/apa.monkey.me.now 10
39 check 45 check
40 try chkfile /apa.txt 10 46 try chkfile "/really long filenames rock" 10
41 try chkfile /dir/apa.txt 8 47 try chkfile /dir/apa.monkey.me.now 8
42 48
43 echo ---Test: create a 1K file 49 echo ---Test: create a 1K file
44 try mkfile /bpa.txt 1 50 try mkfile /bpa.rock 1
45 check 51 check
46 try chkfile /bpa.txt 1 52 try chkfile /bpa.rock 1
47 53
48 echo ---Test: create a 40K file 54 echo ---Test: create a 40K file
49 try mkfile /cpa.txt 40 55 try mkfile /cpa.rock 40
50 check 56 check
51 try chkfile /cpa.txt 40 57 try chkfile /cpa.rock 40
52 58
53 echo ---Test: create a 400K file 59 echo ---Test: create a 400K file
54 try mkfile /dpa.txt 400 60 try mkfile /dpa.rock 400
61 check
62 try chkfile /dpa.rock 400
63
64 echo ---Test: create a 1200K file
65 try mkfile /epa.rock 1200
55 check 66 check
56 try chkfile /dpa.txt 400 67 try chkfile /epa.rock 1200
57 68
58 echo ---Test: truncate previous 40K file to 20K 69 echo ---Test: rewrite first 20K of a 40K file
59 try mkfile /cpa.txt 20 70 try mkfile /cpa.rock 20
60 check 71 check
61 try chkfile /cpa.txt 20 72 try chkfile /cpa.rock 20
62 73
63 echo ---Test: truncate previous 20K file to 0K 74 echo ---Test: rewrite first sector of 40K file
64 try mkfile /cpa.txt 0 75 try mkfile /cpa.rock 0
65 check 76 check
66 try chkfile /cpa.txt 77 try chkfile /cpa.rock
67 try chkfile /apa.txt 78 try chkfile /apa.rock
68 try chkfile /bpa.txt 79 try chkfile /bpa.rock
69 80
70 LOOP=50 81 LOOP=50
71 SIZE=70 82 SIZE=700
83
84 try del "/really long filenames rock"
72 85
73 echo ---Test: create $LOOP $SIZE k files 86 echo ---Test: create $LOOP $SIZE k files
74 for i in `seq 1 $LOOP`; 87 for i in `seq 1 $LOOP`;
75 do 88 do
76 echo ---Test: $i/$LOOP --- 89 echo ---Test: $i/$LOOP ---
77 try mkfile /rockbox.$i $SIZE 90 try mkfile "/rockbox rocks.$i" $SIZE
91 check
92 try chkfile "/rockbox rocks.$i" $SIZE
78 check 93 check
79 try chkfile /rockbox.$i $SIZE 94 try del "/rockbox rocks.$i"
80 check 95 check
81 try del /rockbox.$i 96 try mkfile "/rockbox rocks.$i" $SIZE
82 check 97 check
83 try mkfile /rockbox.$i $SIZE 98 try ren "/rockbox rocks.$i" "$i is a new long filename!"
84 check 99 check
85 done 100 done
86 101
@@ -90,20 +105,20 @@ echo "Building test image (4 sector/cluster)"
90buildimage 4 105buildimage 4
91runtests 106runtests
92 107
93echo "Building test image (128 sectors/cluster)"
94buildimage 128
95runtests
96
97echo "Building test image (32 sectors/cluster)" 108echo "Building test image (32 sectors/cluster)"
98buildimage 32 109buildimage 32
99runtests 110runtests
100 111
112echo "Building test image (1 sector/cluster)"
113buildimage 1
114runtests
115
101echo "Building test image (8 sectors/cluster)" 116echo "Building test image (8 sectors/cluster)"
102buildimage 8 117buildimage 8
103runtests 118runtests
104 119
105echo "Building test image (1 sector/cluster)" 120echo "Building test image (128 sectors/cluster)"
106buildimage 1 121buildimage 128
107runtests 122runtests
108 123
109echo "== Test completed sucessfully ==" 124echo "== Test completed sucessfully =="