]> git.ipfire.org Git - people/ms/u-boot.git/blame - test/fs/fs-test.sh
fs-test: Add FAT16 support
[people/ms/u-boot.git] / test / fs / fs-test.sh
CommitLineData
6c016485
SR
1#!/bin/bash
2#
3# (C) Copyright 2014 Suriyan Ramasami
4#
5# SPDX-License-Identifier: GPL-2.0+
6#
7
8# Invoke this test script from U-Boot base directory as ./test/fs/fs-test.sh
9# It currently tests the fs/sb and native commands for ext4 and fat partitions
10# Expected results are as follows:
11# EXT4 tests:
df9e4cda 12# fs-test.sb.ext4.out: Summary: PASS: 23 FAIL: 0
b1849152
SB
13# fs-test.ext4.out: Summary: PASS: 23 FAIL: 0
14# fs-test.fs.ext4.out: Summary: PASS: 23 FAIL: 0
edce588a
TT
15# FAT16 tests:
16# fs-test.sb.fat16.out: Summary: PASS: 23 FAIL: 0
17# fs-test.fat16.out: Summary: PASS: 20 FAIL: 3
18# fs-test.fs.fat16.out: Summary: PASS: 20 FAIL: 3
19# FAT32 tests:
20# fs-test.sb.fat32.out: Summary: PASS: 23 FAIL: 0
21# fs-test.fat32.out: Summary: PASS: 20 FAIL: 3
22# fs-test.fs.fat32.out: Summary: PASS: 20 FAIL: 3
23# Total Summary: TOTAL PASS: 195 TOTAL FAIL: 12
6c016485
SR
24
25# pre-requisite binaries list.
26PREREQ_BINS="md5sum mkfs mount umount dd fallocate mkdir"
27
28# All generated output files from this test will be in $OUT_DIR
29# Hence everything is sandboxed.
30OUT_DIR="sandbox/test/fs"
31
32# Location of generated sandbox u-boot
33UBOOT="./sandbox/u-boot"
34
35# Our mount directory will be in the sandbox
36MOUNT_DIR="${OUT_DIR}/mnt"
37
38# The file system image we create will have the $IMG prefix.
39IMG="${OUT_DIR}/3GB"
40
41# $SMALL_FILE is the name of the 1MB file in the file system image
42SMALL_FILE="1MB.file"
43
44# $BIG_FILE is the name of the 2.5GB file in the file system image
45BIG_FILE="2.5GB.file"
46
47# $MD5_FILE will have the expected md5s when we do the test
edce588a 48# They shall have a suffix which represents their file system (ext4/fat16/...)
6c016485
SR
49MD5_FILE="${OUT_DIR}/md5s.list"
50
51# $OUT shall be the prefix of the test output. Their suffix will be .out
52OUT="${OUT_DIR}/fs-test"
53
54# Full Path of the 1 MB file that shall be created in the fs image.
55MB1="${MOUNT_DIR}/${SMALL_FILE}"
56GB2p5="${MOUNT_DIR}/${BIG_FILE}"
57
58# ************************
59# * Functions start here *
60# ************************
61
62# Check if the prereq binaries exist, or exit
63function check_prereq() {
64 for prereq in $PREREQ_BINS; do
47b71644 65 if [ ! -x "`which $prereq`" ]; then
6c016485
SR
66 echo "Missing $prereq binary. Exiting!"
67 exit
68 fi
69 done
70
71 # We use /dev/urandom to create files. Check if it exists.
72 if [ ! -c /dev/urandom ]; then
73 echo "Missing character special /dev/urandom. Exiting!"
74 exit
75 fi
76}
77
78# If 1st param is "clean", then clean out the generated files and exit
79function check_clean() {
80 if [ "$1" = "clean" ]; then
81 rm -rf "$OUT_DIR"
82 echo "Cleaned up generated files. Exiting"
83 exit
84 fi
85}
86
87# Generate sandbox U-Boot - gleaned from /test/dm/test-dm.sh
88function compile_sandbox() {
89 unset CROSS_COMPILE
90 NUM_CPUS=$(cat /proc/cpuinfo |grep -c processor)
91 make O=sandbox sandbox_config
92 make O=sandbox -s -j${NUM_CPUS}
93
94 # Check if U-Boot exists
95 if [ ! -x "$UBOOT" ]; then
96 echo "$UBOOT does not exist or is not executable"
97 echo "Build error?"
98 echo "Please run this script as ./test/fs/`basename $0`"
99 exit
100 fi
101}
102
103# Clean out all generated files other than the file system images
104# We save time by not deleting and recreating the file system images
105function prepare_env() {
106 rm -f ${MD5_FILE}.* ${OUT}.*
08eee271 107 mkdir -p ${OUT_DIR}
6c016485
SR
108}
109
110# 1st parameter is the name of the image file to be created
edce588a 111# 2nd parameter is the filesystem - fat16 ext4 etc
6c016485
SR
112# -F cant be used with fat as it means something else.
113function create_image() {
114 # Create image if not already present - saves time, while debugging
edce588a
TT
115 case "$2" in
116 fat16)
117 MKFS_OPTION="-F 16"
118 FS_TYPE="fat"
119 ;;
120 fat32)
121 MKFS_OPTION="-F 32"
122 FS_TYPE="fat"
123 ;;
124 ext4)
6c016485 125 MKFS_OPTION="-F"
edce588a
TT
126 FS_TYPE="ext4"
127 ;;
128 esac
129
6c016485
SR
130 if [ ! -f "$1" ]; then
131 fallocate -l 3G "$1" &> /dev/null
08eee271
SW
132 if [ $? -ne 0 ]; then
133 echo fallocate failed - using dd instead
134 dd if=/dev/zero of=$1 bs=1024 count=$((3 * 1024 * 1024))
135 if [ $? -ne 0 ]; then
136 echo Could not create empty disk image
137 exit $?
138 fi
139 fi
edce588a
TT
140 mkfs -t "$FS_TYPE" $MKFS_OPTION "$1" &> /dev/null
141 if [ $? -ne 0 -a "$FS_TYPE" = "fat" ]; then
6c016485
SR
142 # If we fail and we did fat, try vfat.
143 mkfs -t vfat $MKFS_OPTION "$1" &> /dev/null
144 fi
08eee271
SW
145 if [ $? -ne 0 ]; then
146 echo Could not create filesystem
147 exit $?
148 fi
6c016485
SR
149 fi
150}
151
6c016485 152# 1st parameter is image file
edce588a 153# 2nd parameter is file system type - fat16/ext4/...
6c016485
SR
154# 3rd parameter is name of small file
155# 4th parameter is name of big file
156# 5th parameter is fs/nonfs/sb - to dictate generic fs commands or
157# otherwise or sb hostfs
158# 6th parameter is the directory path for the files. Its "" for generic
159# fs and ext4/fat and full patch for sb hostfs
160# UBOOT is set in env
161function test_image() {
162 addr="0x01000008"
163 length="0x00100000"
164
165 case "$2" in
edce588a 166 fat*)
86853568 167 FPATH=""
6c016485
SR
168 PREFIX="fat"
169 WRITE="write"
170 ;;
171
172 ext4)
86853568
SB
173 # ext4 needs absolute path
174 FPATH="/"
6c016485
SR
175 PREFIX="ext4"
176 WRITE="write"
177 ;;
178
179 *)
180 echo "Unhandled filesystem $2. Exiting!"
181 exit
182 ;;
183 esac
184
185 case "$5" in
186 fs)
187 PREFIX=""
188 WRITE="save"
189 SUFFIX=" 0:0"
190 ;;
191
192 nonfs)
193 SUFFIX=" 0:0"
194 ;;
195
196 sb)
197 PREFIX="sb "
198 WRITE="save"
199 SUFFIX="fs -"
200 ;;
201
202 *)
203 echo "Unhandled mode $5. Exiting!"
204 exit
205 ;;
206
207 esac
208
86853568
SB
209 # sb always uses full path to mointpoint, irrespective of filesystem
210 if [ "$5" = "sb" ]; then
211 FPATH=${6}/
6c016485
SR
212 fi
213
86853568
SB
214 FILE_WRITE=${3}.w
215 FILE_SMALL=$3
216 FILE_BIG=$4
217
6c016485
SR
218 # In u-boot commands, <interface> stands for host or hostfs
219 # hostfs maps to the host fs.
220 # host maps to the "sb bind" that we do
221
222 $UBOOT << EOF
223sb=$5
224setenv bind 'if test "\$sb" != sb; then sb bind 0 "$1"; fi'
225run bind
226# Test Case 1 - ls
227${PREFIX}ls host${SUFFIX} $6
228#
229# We want ${PREFIX}size host 0:0 $3 for host commands and
230# sb size hostfs - $3 for hostfs commands.
231# 1MB is 0x0010 0000
232# Test Case 2 - size of small file
86853568 233${PREFIX}size host${SUFFIX} ${FPATH}$FILE_SMALL
6c016485
SR
234printenv filesize
235setenv filesize
236
237# 2.5GB (1024*1024*2500) is 0x9C40 0000
238# Test Case 3 - size of big file
86853568 239${PREFIX}size host${SUFFIX} ${FPATH}$FILE_BIG
6c016485
SR
240printenv filesize
241setenv filesize
242
243# Notes about load operation
244# If I use 0x01000000 I get DMA misaligned error message
245# Last two parameters are size and offset.
246
247# Test Case 4a - Read full 1MB of small file
86853568 248${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
6c016485
SR
249printenv filesize
250# Test Case 4b - Read full 1MB of small file
251md5sum $addr \$filesize
252setenv filesize
253
254# Test Case 5a - First 1MB of big file
86853568 255${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x0
6c016485
SR
256printenv filesize
257# Test Case 5b - First 1MB of big file
258md5sum $addr \$filesize
259setenv filesize
260
261# fails for ext as no offset support
262# Test Case 6a - Last 1MB of big file
86853568 263${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x9C300000
6c016485
SR
264printenv filesize
265# Test Case 6b - Last 1MB of big file
266md5sum $addr \$filesize
267setenv filesize
268
269# fails for ext as no offset support
270# Test Case 7a - One from the last 1MB chunk of 2GB
86853568 271${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x7FF00000
6c016485
SR
272printenv filesize
273# Test Case 7b - One from the last 1MB chunk of 2GB
274md5sum $addr \$filesize
275setenv filesize
276
277# fails for ext as no offset support
278# Test Case 8a - One from the start 1MB chunk from 2GB
86853568 279${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x80000000
6c016485
SR
280printenv filesize
281# Test Case 8b - One from the start 1MB chunk from 2GB
282md5sum $addr \$filesize
283setenv filesize
284
285# fails for ext as no offset support
286# Test Case 9a - One 1MB chunk crossing the 2GB boundary
86853568 287${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x7FF80000
6c016485
SR
288printenv filesize
289# Test Case 9b - One 1MB chunk crossing the 2GB boundary
290md5sum $addr \$filesize
291setenv filesize
292
293# Generic failure case
294# Test Case 10 - 2MB chunk from the last 1MB of big file
86853568 295${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG 0x00200000 0x9C300000
6c016485
SR
296printenv filesize
297#
298
299# Read 1MB from small file
86853568 300${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
6c016485
SR
301# Write it back to test the writes
302# Test Case 11a - Check that the write succeeded
86853568 303${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}$FILE_WRITE \$filesize
6c016485 304mw.b $addr 00 100
86853568 305${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_WRITE
6c016485
SR
306# Test Case 11b - Check md5 of written to is same as the one read from
307md5sum $addr \$filesize
308setenv filesize
309#
14678b3c
SB
310
311# Next test case checks writing a file whose dirent
312# is the first in the block, which is always true for "."
313# The write should fail, but the lookup should work
314# Test Case 12 - Check directory traversal
315${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10
2365a4b8
SB
316
317# Read 1MB from small file
318${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
319# Write it via "same directory", i.e. "." dirent
320# Test Case 13a - Check directory traversal
321${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2 \$filesize
322mw.b $addr 00 100
323${PREFIX}load host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2
324# Test Case 13b - Check md5 of written to is same as the one read from
325md5sum $addr \$filesize
326setenv filesize
327mw.b $addr 00 100
328${PREFIX}load host${SUFFIX} $addr ${FPATH}${FILE_WRITE}2
329# Test Case 13c - Check md5 of written to is same as the one read from
330md5sum $addr \$filesize
331setenv filesize
332#
6c016485
SR
333reset
334
335EOF
336}
337
338# 1st argument is the name of the image file.
339# 2nd argument is the file where we generate the md5s of the files
340# generated with the appropriate start and length that we use to test.
341# It creates the necessary files in the image to test.
342# $GB2p5 is the path of the big file (2.5 GB)
343# $MB1 is the path of the small file (1 MB)
344# $MOUNT_DIR is the path we can use to mount the image file.
345function create_files() {
346 # Mount the image so we can populate it.
347 mkdir -p "$MOUNT_DIR"
348 sudo mount -o loop,rw "$1" "$MOUNT_DIR"
349
350 # Create big file in this image.
351 # Note that we work only on the start 1MB, couple MBs in the 2GB range
352 # and the last 1 MB of the huge 2.5GB file.
353 # So, just put random values only in those areas.
354 if [ ! -f "${GB2p5}" ]; then
355 sudo dd if=/dev/urandom of="${GB2p5}" bs=1M count=1 \
356 &> /dev/null
357 sudo dd if=/dev/urandom of="${GB2p5}" bs=1M count=2 seek=2047 \
358 &> /dev/null
359 sudo dd if=/dev/urandom of="${GB2p5}" bs=1M count=1 seek=2499 \
360 &> /dev/null
361 fi
362
363 # Create a small file in this image.
364 if [ ! -f "${MB1}" ]; then
365 sudo dd if=/dev/urandom of="${MB1}" bs=1M count=1 \
366 &> /dev/null
367 fi
368
2365a4b8 369 # Delete the small file copies which possibly are written as part of a
6c016485
SR
370 # previous test.
371 sudo rm -f "${MB1}.w"
2365a4b8 372 sudo rm -f "${MB1}.w2"
6c016485
SR
373
374 # Generate the md5sums of reads that we will test against small file
375 dd if="${MB1}" bs=1M skip=0 count=1 2> /dev/null | md5sum > "$2"
376
377 # Generate the md5sums of reads that we will test against big file
378 # One from beginning of file.
379 dd if="${GB2p5}" bs=1M skip=0 count=1 \
380 2> /dev/null | md5sum >> "$2"
381
382 # One from end of file.
383 dd if="${GB2p5}" bs=1M skip=2499 count=1 \
384 2> /dev/null | md5sum >> "$2"
385
386 # One from the last 1MB chunk of 2GB
387 dd if="${GB2p5}" bs=1M skip=2047 count=1 \
388 2> /dev/null | md5sum >> "$2"
389
390 # One from the start 1MB chunk from 2GB
391 dd if="${GB2p5}" bs=1M skip=2048 count=1 \
392 2> /dev/null | md5sum >> "$2"
393
394 # One 1MB chunk crossing the 2GB boundary
395 dd if="${GB2p5}" bs=512K skip=4095 count=2 \
396 2> /dev/null | md5sum >> "$2"
397
398 sync
399 sudo umount "$MOUNT_DIR"
400 rmdir "$MOUNT_DIR"
401}
402
403# 1st parameter is the text to print
404# if $? is 0 its a pass, else a fail
405# As a side effect it shall update env variable PASS and FAIL
406function pass_fail() {
407 if [ $? -eq 0 ]; then
408 echo pass - "$1"
409 PASS=$((PASS + 1))
410 else
411 echo FAIL - "$1"
412 FAIL=$((FAIL + 1))
413 fi
414}
415
416# 1st parameter is the string which leads to an md5 generation
417# 2nd parameter is the file we grep, for that string
418# 3rd parameter is the name of the file which has md5s in it
419# 4th parameter is the line # in the md5 file that we match it against
420# This function checks if the md5 of the file in the sandbox matches
421# that calculated while generating the file
422# 5th parameter is the string to print with the result
423check_md5() {
424 # md5sum in u-boot has output of form:
425 # md5 for 01000008 ... 01100007 ==> <md5>
426 # the 7th field is the actual md5
d9554b7f 427 md5_src=`grep -A2 "$1" "$2" | grep "md5 for" | tr -d '\r'`
6c016485
SR
428 md5_src=($md5_src)
429 md5_src=${md5_src[6]}
430
431 # The md5 list, each line is of the form:
432 # - <md5>
433 # the 2nd field is the actual md5
434 md5_dst=`sed -n $4p $3`
435 md5_dst=($md5_dst)
436 md5_dst=${md5_dst[0]}
437
438 # For a pass they should match.
439 [ "$md5_src" = "$md5_dst" ]
440 pass_fail "$5"
441}
442
443# 1st parameter is the name of the output file to check
444# 2nd parameter is the name of the file containing the md5 expected
445# 3rd parameter is the name of the small file
446# 4th parameter is the name of the big file
447# 5th paramter is the name of the written file
448# This function checks the output file for correct results.
449function check_results() {
450 echo "** Start $1"
451
452 PASS=0
453 FAIL=0
454
455 # Check if the ls is showing correct results for 2.5 gb file
456 grep -A6 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4"
457 pass_fail "TC1: ls of $4"
458
459 # Check if the ls is showing correct results for 1 mb file
460 grep -A6 "Test Case 1 " "$1" | egrep -iq "1048576 *$3"
461 pass_fail "TC1: ls of $3"
462
463 # Check size command on 1MB.file
464 egrep -A3 "Test Case 2 " "$1" | grep -q "filesize=100000"
465 pass_fail "TC2: size of $3"
466
467 # Check size command on 2.5GB.file
468 egrep -A3 "Test Case 3 " "$1" | grep -q "filesize=9c400000"
469 pass_fail "TC3: size of $4"
470
471 # Check read full mb of 1MB.file
d9554b7f 472 grep -A4 "Test Case 4a " "$1" | grep -q "filesize=100000"
6c016485
SR
473 pass_fail "TC4: load of $3 size"
474 check_md5 "Test Case 4b " "$1" "$2" 1 "TC4: load from $3"
475
476 # Check first mb of 2.5GB.file
d9554b7f 477 grep -A4 "Test Case 5a " "$1" | grep -q "filesize=100000"
6c016485
SR
478 pass_fail "TC5: load of 1st MB from $4 size"
479 check_md5 "Test Case 5b " "$1" "$2" 2 "TC5: load of 1st MB from $4"
480
481 # Check last mb of 2.5GB.file
d9554b7f 482 grep -A4 "Test Case 6a " "$1" | grep -q "filesize=100000"
6c016485
SR
483 pass_fail "TC6: load of last MB from $4 size"
484 check_md5 "Test Case 6b " "$1" "$2" 3 "TC6: load of last MB from $4"
485
486 # Check last 1mb chunk of 2gb from 2.5GB file
d9554b7f 487 grep -A4 "Test Case 7a " "$1" | grep -q "filesize=100000"
6c016485
SR
488 pass_fail "TC7: load of last 1mb chunk of 2GB from $4 size"
489 check_md5 "Test Case 7b " "$1" "$2" 4 \
490 "TC7: load of last 1mb chunk of 2GB from $4"
491
492 # Check first 1mb chunk after 2gb from 2.5GB file
d9554b7f 493 grep -A4 "Test Case 8a " "$1" | grep -q "filesize=100000"
6c016485
SR
494 pass_fail "TC8: load 1st MB chunk after 2GB from $4 size"
495 check_md5 "Test Case 8b " "$1" "$2" 5 \
496 "TC8: load 1st MB chunk after 2GB from $4"
497
498 # Check 1mb chunk crossing the 2gb boundary from 2.5GB file
d9554b7f 499 grep -A4 "Test Case 9a " "$1" | grep -q "filesize=100000"
6c016485
SR
500 pass_fail "TC9: load 1MB chunk crossing 2GB boundary from $4 size"
501 check_md5 "Test Case 9b " "$1" "$2" 6 \
502 "TC9: load 1MB chunk crossing 2GB boundary from $4"
503
e8de6d7b 504 # Check 2mb chunk from the last 1MB of 2.5GB file loads 1MB
d9554b7f 505 grep -A5 "Test Case 10 " "$1" | grep -q "filesize=100000"
e8de6d7b 506 pass_fail "TC10: load 2MB from the last 1MB of $4 loads 1MB"
6c016485
SR
507
508 # Check 1mb chunk write
d9554b7f 509 grep -A2 "Test Case 11a " "$1" | grep -q '1048576 bytes written'
06806e38 510 pass_fail "TC11: 1MB write to $3.w - write succeeded"
6c016485 511 check_md5 "Test Case 11b " "$1" "$2" 1 \
06806e38 512 "TC11: 1MB write to $3.w - content verified"
14678b3c
SB
513
514 # Check lookup of 'dot' directory
515 grep -A4 "Test Case 12 " "$1" | grep -q 'Unable to write file'
516 pass_fail "TC12: 1MB write to . - write denied"
2365a4b8
SB
517
518 # Check directory traversal
519 grep -A2 "Test Case 13a " "$1" | grep -q '1048576 bytes written'
520 pass_fail "TC13: 1MB write to ./$3.w2 - write succeeded"
521 check_md5 "Test Case 13b " "$1" "$2" 1 \
522 "TC13: 1MB read from ./$3.w2 - content verified"
523 check_md5 "Test Case 13c " "$1" "$2" 1 \
524 "TC13: 1MB read from $3.w2 - content verified"
525
6c016485
SR
526 echo "** End $1"
527}
528
529# Takes in one parameter which is "fs" or "nonfs", which then dictates
530# if a fs test (size/load/save) or a nonfs test (fatread/extread) needs to
531# be performed.
532function test_fs_nonfs() {
533 echo "Creating files in $fs image if not already present."
534 create_files $IMAGE $MD5_FILE_FS
535
04812605 536 OUT_FILE="${OUT}.$1.${fs}.out"
6c016485 537 test_image $IMAGE $fs $SMALL_FILE $BIG_FILE $1 "" \
04812605 538 > ${OUT_FILE} 2>&1
d9554b7f
SB
539 # strip out noise from fs code
540 grep -v -e "File System is consistent\|update journal finished" \
541 -e "reading .*\.file\|writing .*\.file.w" \
542 < ${OUT_FILE} > ${OUT_FILE}_clean
543 check_results ${OUT_FILE}_clean $MD5_FILE_FS $SMALL_FILE \
544 $BIG_FILE
6c016485
SR
545 TOTAL_FAIL=$((TOTAL_FAIL + FAIL))
546 TOTAL_PASS=$((TOTAL_PASS + PASS))
547 echo "Summary: PASS: $PASS FAIL: $FAIL"
548 echo "--------------------------------------------"
549}
550
551# ********************
552# * End of functions *
553# ********************
554
555check_clean "$1"
556check_prereq
557compile_sandbox
558prepare_env
559
560# Track TOTAL_FAIL and TOTAL_PASS
561TOTAL_FAIL=0
562TOTAL_PASS=0
563
564# In each loop, for a given file system image, we test both the
565# fs command, like load/size/write, the file system specific command
566# like: ext4load/ext4size/ext4write and the sb load/ls/save commands.
edce588a 567for fs in ext4 fat16 fat32; do
6c016485
SR
568
569 echo "Creating $fs image if not already present."
570 IMAGE=${IMG}.${fs}.img
571 MD5_FILE_FS="${MD5_FILE}.${fs}"
572 create_image $IMAGE $fs
573
574 # sb commands test
575 echo "Creating files in $fs image if not already present."
576 create_files $IMAGE $MD5_FILE_FS
577
578 # Lets mount the image and test sb hostfs commands
579 mkdir -p "$MOUNT_DIR"
edce588a
TT
580 case "$fs" in
581 fat*)
6c016485 582 uid="uid=`id -u`"
edce588a
TT
583 ;;
584 *)
6c016485 585 uid=""
edce588a
TT
586 ;;
587 esac
6c016485
SR
588 sudo mount -o loop,rw,$uid "$IMAGE" "$MOUNT_DIR"
589 sudo chmod 777 "$MOUNT_DIR"
590
591 OUT_FILE="${OUT}.sb.${fs}.out"
592 test_image $IMAGE $fs $SMALL_FILE $BIG_FILE sb `pwd`/$MOUNT_DIR \
04812605 593 > ${OUT_FILE} 2>&1
6c016485
SR
594 sudo umount "$MOUNT_DIR"
595 rmdir "$MOUNT_DIR"
596
06806e38 597 check_results $OUT_FILE $MD5_FILE_FS $SMALL_FILE $BIG_FILE
6c016485
SR
598 TOTAL_FAIL=$((TOTAL_FAIL + FAIL))
599 TOTAL_PASS=$((TOTAL_PASS + PASS))
600 echo "Summary: PASS: $PASS FAIL: $FAIL"
601 echo "--------------------------------------------"
602
603 test_fs_nonfs nonfs
604 test_fs_nonfs fs
605done
606
607echo "Total Summary: TOTAL PASS: $TOTAL_PASS TOTAL FAIL: $TOTAL_FAIL"
608echo "--------------------------------------------"
609if [ $TOTAL_FAIL -eq 0 ]; then
610 echo "PASSED"
611 exit 0
612else
613 echo "FAILED"
614 exit 1
615fi