Lines Matching +full:- +full:- +full:prefix

5 #  SPDX-License-Identifier:	GPL-2.0+
8 # Invoke this test script from U-Boot base directory as ./test/fs/fs-test.sh
12 # fs-test.sb.ext4.out: Summary: PASS: 23 FAIL: 0
13 # fs-test.ext4.out: Summary: PASS: 23 FAIL: 0
14 # fs-test.fs.ext4.out: Summary: PASS: 23 FAIL: 0
16 # fs-test.sb.fat.out: Summary: PASS: 23 FAIL: 0
17 # fs-test.fat.out: Summary: PASS: 20 FAIL: 3
18 # fs-test.fs.fat.out: Summary: PASS: 20 FAIL: 3
21 # pre-requisite binaries list.
28 # Location of generated sandbox u-boot
29 UBOOT="./sandbox/u-boot"
34 # The file system image we create will have the $IMG prefix.
47 # $OUT shall be the prefix of the test output. Their suffix will be .out
48 OUT="${OUT_DIR}/fs-test"
61 if [ ! -x "`which $prereq`" ]; then
68 if [ ! -c /dev/urandom ]; then
77 rm -rf "$OUT_DIR"
83 # Generate sandbox U-Boot - gleaned from /test/dm/test-dm.sh
86 NUM_CPUS=$(cat /proc/cpuinfo |grep -c processor)
88 make O=sandbox -s -j${NUM_CPUS}
90 # Check if U-Boot exists
91 if [ ! -x "$UBOOT" ]; then
102 rm -f ${MD5_FILE}.* ${OUT}.*
103 mkdir -p ${OUT_DIR}
107 # 2nd parameter is the filesystem - fat ext4 etc
108 # -F cant be used with fat as it means something else.
110 # Create image if not already present - saves time, while debugging
112 MKFS_OPTION="-F"
116 if [ ! -f "$1" ]; then
117 fallocate -l 3G "$1" &> /dev/null
118 if [ $? -ne 0 ]; then
119 echo fallocate failed - using dd instead
121 if [ $? -ne 0 ]; then
126 mkfs -t "$2" $MKFS_OPTION "$1" &> /dev/null
127 if [ $? -ne 0 -a "$2" = "fat" ]; then
129 mkfs -t vfat $MKFS_OPTION "$1" &> /dev/null
131 if [ $? -ne 0 ]; then
139 # 2nd parameter is file system type - fat/ext4
142 # 5th parameter is fs/nonfs/sb - to dictate generic fs commands or
154 PREFIX="fat"
161 PREFIX="ext4"
173 PREFIX=""
183 PREFIX="sb "
185 SUFFIX="fs -"
204 # In u-boot commands, <interface> stands for host or hostfs
212 # Test Case 1 - ls
213 ${PREFIX}ls host${SUFFIX} $6
215 # We want ${PREFIX}size host 0:0 $3 for host commands and
216 # sb size hostfs - $3 for hostfs commands.
218 # Test Case 2 - size of small file
219 ${PREFIX}size host${SUFFIX} ${FPATH}$FILE_SMALL
224 # Test Case 3 - size of big file
225 ${PREFIX}size host${SUFFIX} ${FPATH}$FILE_BIG
233 # Test Case 4a - Read full 1MB of small file
234 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
236 # Test Case 4b - Read full 1MB of small file
240 # Test Case 5a - First 1MB of big file
241 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x0
243 # Test Case 5b - First 1MB of big file
248 # Test Case 6a - Last 1MB of big file
249 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x9C300000
251 # Test Case 6b - Last 1MB of big file
256 # Test Case 7a - One from the last 1MB chunk of 2GB
257 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x7FF00000
259 # Test Case 7b - One from the last 1MB chunk of 2GB
264 # Test Case 8a - One from the start 1MB chunk from 2GB
265 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x80000000
267 # Test Case 8b - One from the start 1MB chunk from 2GB
272 # Test Case 9a - One 1MB chunk crossing the 2GB boundary
273 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG $length 0x7FF80000
275 # Test Case 9b - One 1MB chunk crossing the 2GB boundary
280 # Test Case 10 - 2MB chunk from the last 1MB of big file
281 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_BIG 0x00200000 0x9C300000
286 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
288 # Test Case 11a - Check that the write succeeded
289 ${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}$FILE_WRITE \$filesize
291 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_WRITE
292 # Test Case 11b - Check md5 of written to is same as the one read from
300 # Test Case 12 - Check directory traversal
301 ${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10
304 ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_SMALL
306 # Test Case 13a - Check directory traversal
307 ${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2 \$filesize
309 ${PREFIX}load host${SUFFIX} $addr ${FPATH}./${FILE_WRITE}2
310 # Test Case 13b - Check md5 of written to is same as the one read from
314 ${PREFIX}load host${SUFFIX} $addr ${FPATH}${FILE_WRITE}2
315 # Test Case 13c - Check md5 of written to is same as the one read from
333 mkdir -p "$MOUNT_DIR"
334 sudo mount -o loop,rw "$1" "$MOUNT_DIR"
340 if [ ! -f "${GB2p5}" ]; then
350 if [ ! -f "${MB1}" ]; then
357 sudo rm -f "${MB1}.w"
358 sudo rm -f "${MB1}.w2"
393 if [ $? -eq 0 ]; then
394 echo pass - "$1"
397 echo FAIL - "$1"
410 # md5sum in u-boot has output of form:
413 md5_src=`grep -A2 "$1" "$2" | grep "md5 for" | tr -d '\r'`
418 # - <md5>
420 md5_dst=`sed -n $4p $3`
442 grep -A6 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4"
446 grep -A6 "Test Case 1 " "$1" | egrep -iq "1048576 *$3"
450 egrep -A3 "Test Case 2 " "$1" | grep -q "filesize=100000"
454 egrep -A3 "Test Case 3 " "$1" | grep -q "filesize=9c400000"
458 grep -A4 "Test Case 4a " "$1" | grep -q "filesize=100000"
463 grep -A4 "Test Case 5a " "$1" | grep -q "filesize=100000"
468 grep -A4 "Test Case 6a " "$1" | grep -q "filesize=100000"
473 grep -A4 "Test Case 7a " "$1" | grep -q "filesize=100000"
479 grep -A4 "Test Case 8a " "$1" | grep -q "filesize=100000"
485 grep -A4 "Test Case 9a " "$1" | grep -q "filesize=100000"
491 grep -A5 "Test Case 10 " "$1" | grep -q "filesize=100000"
495 grep -A2 "Test Case 11a " "$1" | grep -q '1048576 bytes written'
496 pass_fail "TC11: 1MB write to $3.w - write succeeded"
498 "TC11: 1MB write to $3.w - content verified"
501 grep -A4 "Test Case 12 " "$1" | grep -q 'Unable to write file'
502 pass_fail "TC12: 1MB write to . - write denied"
505 grep -A2 "Test Case 13a " "$1" | grep -q '1048576 bytes written'
506 pass_fail "TC13: 1MB write to ./$3.w2 - write succeeded"
508 "TC13: 1MB read from ./$3.w2 - content verified"
510 "TC13: 1MB read from $3.w2 - content verified"
526 grep -v -e "File System is consistent\|update journal finished" \
527 -e "reading .*\.file\|writing .*\.file.w" \
534 echo "--------------------------------------------"
565 mkdir -p "$MOUNT_DIR"
567 uid="uid=`id -u`"
571 sudo mount -o loop,rw,$uid "$IMAGE" "$MOUNT_DIR"
584 echo "--------------------------------------------"
591 echo "--------------------------------------------"
592 if [ $TOTAL_FAIL -eq 0 ]; then