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.sh146
1 files changed, 0 insertions, 146 deletions
diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh
deleted file mode 100644
index ca0a1db067..0000000000
--- a/firmware/test/fat/test.sh
+++ /dev/null
@@ -1,146 +0,0 @@
1#!/bin/sh
2
3IMAGE=disk.img
4MOUNT=/mnt/dummy
5RESULT=result.txt
6
7fail() {
8 echo "!! Test failed. Look in $RESULT for test logs."
9 chmod a+rw $RESULT
10 exit
11}
12
13check() {
14 /sbin/dosfsck -r $IMAGE | tee -a $RESULT
15 [ $RETVAL -ne 0 ] && fail
16}
17
18try() {
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
24}
25
26buildimage() {
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`;
33 do
34 echo apa > "$MOUNT/very $i long test filename so we can make sure they.work"
35 done
36 umount $MOUNT
37}
38
39runtests() {
40 rm $RESULT
41
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
47
48 echo ---Test: create a directory called "dir"
49 try mkdir "/dir"
50 check
51
52 echo ---Test: create a 10K file
53 try mkfile "/really long filenames rock" 10
54 check
55
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
60
61 echo ---Test: create a 1K file
62 try mkfile /bpa.rock 1
63 check
64 try chkfile /bpa.rock 1
65
66 echo ---Test: create a 40K file
67 try mkfile /cpa.rock 40
68 check
69 try chkfile /cpa.rock 40
70
71 echo ---Test: create a 400K file
72 try mkfile /dpa.rock 400
73 check
74 try chkfile /dpa.rock 400
75
76 echo ---Test: create a 1200K file
77 try mkfile /epa.rock 1200
78 check
79 try chkfile /epa.rock 1200
80
81 echo ---Test: rewrite first 20K of a 40K file
82 try mkfile /cpa.rock 20
83 check
84 try chkfile /cpa.rock 20
85
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
91
92 LOOP=50
93 SIZE=700
94
95 try del "/really long filenames rock"
96
97 echo ---Test: create $LOOP $SIZE k files
98 for i in `seq 1 $LOOP`;
99 do
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
112
113}
114
115echo "--------------------------------------"
116echo "Building test image (4 sector/cluster)"
117echo "--------------------------------------"
118buildimage 4
119runtests
120
121echo "---------------------------------------"
122echo "Building test image (32 sectors/cluster)"
123echo "---------------------------------------"
124buildimage 32
125runtests
126
127echo "--------------------------------------"
128echo "Building test image (1 sector/cluster)"
129echo "--------------------------------------"
130buildimage 1
131runtests
132
133echo "--------------------------------------"
134echo "Building test image (8 sectors/cluster)"
135echo "--------------------------------------"
136buildimage 8
137runtests
138
139echo "----------------------------------------"
140echo "Building test image (128 sectors/cluster)"
141echo "----------------------------------------"
142buildimage 128
143runtests
144
145echo "== Test completed successfully =="
146chmod a+rw $RESULT