]> git.sur5r.net Git - u-boot/blobdiff - test/fs/fs-test.sh
Merge git://www.denx.de/git/u-boot-marvell
[u-boot] / test / fs / fs-test.sh
index a4fb0559625d07ff24bed8224f6d53da2ec29280..043e5d0c0e49f1eabe882c92c991effc82b5a580 100755 (executable)
 # Expected results are as follows:
 # EXT4 tests:
 # fs-test.sb.ext4.out: Summary: PASS: 17 FAIL: 2
-# fs-test.ext4.out: Summary: PASS: 11 FAIL: 8
-# fs-test.fs.ext4.out: Summary: PASS: 11 FAIL: 8
+# fs-test.ext4.out: Summary: PASS: 10 FAIL: 9
+# fs-test.fs.ext4.out: Summary: PASS: 10 FAIL: 9
 # FAT tests:
 # fs-test.sb.fat.out: Summary: PASS: 17 FAIL: 2
 # fs-test.fat.out: Summary: PASS: 19 FAIL: 0
 # fs-test.fs.fat.out: Summary: PASS: 19 FAIL: 0
-# Total Summary: TOTAL PASS: 94 TOTAL FAIL: 20
+# Total Summary: TOTAL PASS: 92 TOTAL FAIL: 22
 
 # pre-requisite binaries list.
 PREREQ_BINS="md5sum mkfs mount umount dd fallocate mkdir"
@@ -58,7 +58,7 @@ GB2p5="${MOUNT_DIR}/${BIG_FILE}"
 # Check if the prereq binaries exist, or exit
 function check_prereq() {
        for prereq in $PREREQ_BINS; do
-               if [ ! -x `which $prereq` ]; then
+               if [ ! -x "`which $prereq`" ]; then
                        echo "Missing $prereq binary. Exiting!"
                        exit
                fi
@@ -100,7 +100,7 @@ function compile_sandbox() {
 # We save time by not deleting and recreating the file system images
 function prepare_env() {
        rm -f ${MD5_FILE}.* ${OUT}.*
-       mkdir ${OUT_DIR}
+       mkdir -p ${OUT_DIR}
 }
 
 # 1st parameter is the name of the image file to be created
@@ -115,11 +115,23 @@ function create_image() {
        fi
        if [ ! -f "$1" ]; then
                fallocate -l 3G "$1" &> /dev/null
+               if [ $? -ne 0 ]; then
+                       echo fallocate failed - using dd instead
+                       dd if=/dev/zero of=$1 bs=1024 count=$((3 * 1024 * 1024))
+                       if [ $? -ne 0 ]; then
+                               echo Could not create empty disk image
+                               exit $?
+                       fi
+               fi
                mkfs -t "$2" $MKFS_OPTION "$1" &> /dev/null
                if [ $? -ne 0 -a "$2" = "fat" ]; then
                        # If we fail and we did fat, try vfat.
                        mkfs -t vfat $MKFS_OPTION "$1" &> /dev/null
                fi
+               if [ $? -ne 0 ]; then
+                       echo Could not create filesystem
+                       exit $?
+               fi
        fi
 }
 
@@ -465,9 +477,9 @@ function check_results() {
        check_md5 "Test Case 9b " "$1" "$2" 6 \
                "TC9: load 1MB chunk crossing 2GB boundary from $4"
 
-       # Check 2mb chunk from the last 1MB of 2.5GB file - generic failure case
-       grep -A6 "Test Case 10 " "$1" | grep -q 'Error: "filesize" not defined'
-       pass_fail "TC10: load 2MB from the last 1MB of $4 - generic fail case"
+       # Check 2mb chunk from the last 1MB of 2.5GB file loads 1MB
+       grep -A6 "Test Case 10 " "$1" | grep -q "filesize=100000"
+       pass_fail "TC10: load 2MB from the last 1MB of $4 loads 1MB"
 
        # Check 1mb chunk write
        grep -A3 "Test Case 11a " "$1" | \
@@ -485,9 +497,9 @@ function test_fs_nonfs() {
        echo "Creating files in $fs image if not already present."
        create_files $IMAGE $MD5_FILE_FS
 
-       OUT_FILE="${OUT}.fs.${fs}.out"
+       OUT_FILE="${OUT}.$1.${fs}.out"
        test_image $IMAGE $fs $SMALL_FILE $BIG_FILE $1 "" \
-               > ${OUT_FILE}
+               > ${OUT_FILE} 2>&1
        check_results $OUT_FILE $MD5_FILE_FS $SMALL_FILE $BIG_FILE \
                $WRITE_FILE
        TOTAL_FAIL=$((TOTAL_FAIL + FAIL))
@@ -535,7 +547,7 @@ for fs in ext4 fat; do
 
        OUT_FILE="${OUT}.sb.${fs}.out"
        test_image $IMAGE $fs $SMALL_FILE $BIG_FILE sb `pwd`/$MOUNT_DIR \
-               > ${OUT_FILE}
+               > ${OUT_FILE} 2>&1
        sudo umount "$MOUNT_DIR"
        rmdir "$MOUNT_DIR"