skin engine: Relax the AA load width/height checks
[maemo-rb.git] / firmware / test / fat / test.sh
blobca0a1db0677dbe8b8aa8aa1bdaf01354e4f6da1f
1 #!/bin/sh
3 IMAGE=disk.img
4 MOUNT=/mnt/dummy
5 RESULT=result.txt
7 fail() {
8 echo "!! Test failed. Look in $RESULT for test logs."
9 chmod a+rw $RESULT
10 exit
13 check() {
14 /sbin/dosfsck -r $IMAGE | tee -a $RESULT
15 [ $RETVAL -ne 0 ] && fail
18 try() {
19 echo COMMAND: fat $1 "$2" "$3"
20 echo COMMAND: fat $1 "$2" "$3" >> $RESULT
21 ./fat $1 "$2" "$3" 2>> $RESULT
22 RETVAL=$?
23 [ $RETVAL -ne 0 ] && fail
26 buildimage() {
27 /sbin/mkdosfs -F 32 -s $1 $IMAGE > /dev/null
28 #mount -o loop $IMAGE $MOUNT
29 mount $MOUNT
30 echo "Filling it with /etc files"
31 find /etc -maxdepth 1 -type f -readable -exec cp {} $MOUNT \;
32 for i in `seq 1 120`;
34 echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"
35 done
36 umount $MOUNT
39 runtests() {
40 rm $RESULT
42 echo ---Test: create a long name directory in the root
43 try mkdir "/very long subdir name"
44 check
45 try mkdir "/very long subdir name/apa.monkey.me.now"
46 check
48 echo ---Test: create a directory called "dir"
49 try mkdir "/dir"
50 check
52 echo ---Test: create a 10K file
53 try mkfile "/really long filenames rock" 10
54 check
56 try mkfile /dir/apa.monkey.me.now 10
57 check
58 try chkfile "/really long filenames rock" 10
59 try chkfile /dir/apa.monkey.me.now 8
61 echo ---Test: create a 1K file
62 try mkfile /bpa.rock 1
63 check
64 try chkfile /bpa.rock 1
66 echo ---Test: create a 40K file
67 try mkfile /cpa.rock 40
68 check
69 try chkfile /cpa.rock 40
71 echo ---Test: create a 400K file
72 try mkfile /dpa.rock 400
73 check
74 try chkfile /dpa.rock 400
76 echo ---Test: create a 1200K file
77 try mkfile /epa.rock 1200
78 check
79 try chkfile /epa.rock 1200
81 echo ---Test: rewrite first 20K of a 40K file
82 try mkfile /cpa.rock 20
83 check
84 try chkfile /cpa.rock 20
86 echo ---Test: rewrite first sector of 40K file
87 try mkfile /cpa.rock 0
88 check
89 try chkfile /cpa.rock
90 try chkfile /bpa.rock
92 LOOP=50
93 SIZE=700
95 try del "/really long filenames rock"
97 echo ---Test: create $LOOP $SIZE k files
98 for i in `seq 1 $LOOP`;
100 echo ---Test: $i/$LOOP ---
101 try mkfile "/rockbox rocks.$i" $SIZE
102 check
103 try chkfile "/rockbox rocks.$i" $SIZE
104 check
105 try del "/rockbox rocks.$i"
106 check
107 try mkfile "/rockbox rocks.$i" $SIZE
108 check
109 try ren "/rockbox rocks.$i" "/$i is a new long filename!"
110 check
111 done
115 echo "--------------------------------------"
116 echo "Building test image (4 sector/cluster)"
117 echo "--------------------------------------"
118 buildimage 4
119 runtests
121 echo "---------------------------------------"
122 echo "Building test image (32 sectors/cluster)"
123 echo "---------------------------------------"
124 buildimage 32
125 runtests
127 echo "--------------------------------------"
128 echo "Building test image (1 sector/cluster)"
129 echo "--------------------------------------"
130 buildimage 1
131 runtests
133 echo "--------------------------------------"
134 echo "Building test image (8 sectors/cluster)"
135 echo "--------------------------------------"
136 buildimage 8
137 runtests
139 echo "----------------------------------------"
140 echo "Building test image (128 sectors/cluster)"
141 echo "----------------------------------------"
142 buildimage 128
143 runtests
145 echo "== Test completed successfully =="
146 chmod a+rw $RESULT