summaryrefslogtreecommitdiff
path: root/firmware/test/fat
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-10-30 16:14:32 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-10-30 16:14:32 +0000
commit56b745029b267394bd44f3f9969f0af296ec97c8 (patch)
tree5989ec7bcfd589844c19ed391123dc4abc34eca4 /firmware/test/fat
parent789faa6a59357f36cd3d61d0e62bf68f680087ef (diff)
downloadrockbox-56b745029b267394bd44f3f9969f0af296ec97c8.tar.gz
rockbox-56b745029b267394bd44f3f9969f0af296ec97c8.zip
Fat driver test script
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2781 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/fat')
-rw-r--r--firmware/test/fat/test.sh81
1 files changed, 81 insertions, 0 deletions
diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh
new file mode 100644
index 0000000000..0b00d765c2
--- /dev/null
+++ b/firmware/test/fat/test.sh
@@ -0,0 +1,81 @@
1#!/bin/sh
2
3IMAGE=disk.img
4MOUNT=/mnt/dummy
5
6fail() {
7 echo "!! Test failed. Look in result.txt for test log."
8 exit
9}
10
11check() {
12 /sbin/dosfsck -r $IMAGE | tee -a result.txt
13 [ $RETVAL -ne 0 ] && fail
14}
15
16try() {
17 ./fat $1 $2 $3 2> result.txt
18 RETVAL=$?
19 [ $RETVAL -ne 0 ] && fail
20}
21
22buildimage() {
23 umount $MOUNT
24 /sbin/mkdosfs -F 32 -s $1 disk.img >/dev/null
25 mount -o loop $IMAGE $MOUNT
26 echo "Filling it with /etc files"
27 find /etc -type f -maxdepth 1 -exec cp {} $MOUNT \;
28}
29
30runtests() {
31
32 echo ---Test: create a 10K file
33 try mkfile /apa.txt 10
34 check
35 try chkfile /apa.txt
36
37 echo ---Test: create a 1K file
38 try mkfile /bpa.txt 1
39 check
40 try chkfile /bpa.txt
41
42 echo ---Test: create a 40K file
43 try mkfile /cpa.txt 40
44 check
45 try chkfile /cpa.txt
46
47 echo ---Test: truncate previous 40K file to 20K
48 try mkfile /cpa.txt 20
49 check
50 try chkfile /cpa.txt
51
52 echo ---Test: truncate previous 20K file to 0K
53 try mkfile /cpa.txt 0
54 check
55 try chkfile /cpa.txt
56
57 echo ---Test: create 20 1k files
58 for i in `seq 1 10`;
59 do
60 echo -n $i
61 try mkfile /rockbox.$i
62 check
63 done
64
65}
66
67echo "Building test image A (2 sectors/cluster)"
68buildimage 2
69runtests
70
71echo "Building test image B (8 sectors/cluster)"
72buildimage 8
73runtests
74
75echo "Building test image B (1 sector/cluster)"
76buildimage 1
77runtests
78
79umount $MOUNT
80
81echo "-- Test complete --"