mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
fs-test: Add test for a filename using '..' to go back to the root
The previous commit fixed a problem in FAT code where going back to the
root directory using '..' wouldn't work correctly on FAT12 or FAT16.
Add a test to exercise this case (which was once fixed in commit
18a10d46f2
"fat: handle paths that include ../" but reintroduced due to
the directory iterator refactoring).
This test only very barely catches the problem - without the fix the
size command still gives valid output but the additional spurious
"Invalid FAT entry" error message makes it not get caught in the
'egrep -A3 ' output. I tried to make a proper test that grows the root
directory to two clusters lots of with dummy files but that causes the
write tests to crash the sandbox totally...
Signed-off-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
8df8731474
commit
7c890f149d
1 changed files with 24 additions and 14 deletions
|
@ -9,18 +9,18 @@
|
|||
# It currently tests the fs/sb and native commands for ext4 and fat partitions
|
||||
# Expected results are as follows:
|
||||
# EXT4 tests:
|
||||
# fs-test.sb.ext4.out: Summary: PASS: 23 FAIL: 0
|
||||
# fs-test.ext4.out: Summary: PASS: 23 FAIL: 0
|
||||
# fs-test.fs.ext4.out: Summary: PASS: 23 FAIL: 0
|
||||
# fs-test.sb.ext4.out: Summary: PASS: 24 FAIL: 0
|
||||
# fs-test.ext4.out: Summary: PASS: 24 FAIL: 0
|
||||
# fs-test.fs.ext4.out: Summary: PASS: 24 FAIL: 0
|
||||
# FAT16 tests:
|
||||
# fs-test.sb.fat16.out: Summary: PASS: 23 FAIL: 0
|
||||
# fs-test.fat16.out: Summary: PASS: 20 FAIL: 3
|
||||
# fs-test.fs.fat16.out: Summary: PASS: 20 FAIL: 3
|
||||
# fs-test.sb.fat16.out: Summary: PASS: 24 FAIL: 0
|
||||
# fs-test.fat16.out: Summary: PASS: 21 FAIL: 3
|
||||
# fs-test.fs.fat16.out: Summary: PASS: 21 FAIL: 3
|
||||
# FAT32 tests:
|
||||
# fs-test.sb.fat32.out: Summary: PASS: 23 FAIL: 0
|
||||
# fs-test.fat32.out: Summary: PASS: 20 FAIL: 3
|
||||
# fs-test.fs.fat32.out: Summary: PASS: 20 FAIL: 3
|
||||
# Total Summary: TOTAL PASS: 195 TOTAL FAIL: 12
|
||||
# fs-test.sb.fat32.out: Summary: PASS: 24 FAIL: 0
|
||||
# fs-test.fat32.out: Summary: PASS: 21 FAIL: 3
|
||||
# fs-test.fs.fat32.out: Summary: PASS: 21 FAIL: 3
|
||||
# Total Summary: TOTAL PASS: 204 TOTAL FAIL: 12
|
||||
|
||||
# pre-requisite binaries list.
|
||||
PREREQ_BINS="md5sum mkfs mount umount dd fallocate mkdir"
|
||||
|
@ -229,10 +229,14 @@ ${PREFIX}ls host${SUFFIX} $6
|
|||
# We want ${PREFIX}size host 0:0 $3 for host commands and
|
||||
# sb size hostfs - $3 for hostfs commands.
|
||||
# 1MB is 0x0010 0000
|
||||
# Test Case 2 - size of small file
|
||||
# Test Case 2a - size of small file
|
||||
${PREFIX}size host${SUFFIX} ${FPATH}$FILE_SMALL
|
||||
printenv filesize
|
||||
setenv filesize
|
||||
# Test Case 2b - size of small file via a path using '..'
|
||||
${PREFIX}size host${SUFFIX} ${FPATH}SUBDIR/../$FILE_SMALL
|
||||
printenv filesize
|
||||
setenv filesize
|
||||
|
||||
# 2.5GB (1024*1024*2500) is 0x9C40 0000
|
||||
# Test Case 3 - size of big file
|
||||
|
@ -347,6 +351,9 @@ function create_files() {
|
|||
mkdir -p "$MOUNT_DIR"
|
||||
sudo mount -o loop,rw "$1" "$MOUNT_DIR"
|
||||
|
||||
# Create a subdirectory.
|
||||
sudo mkdir -p "$MOUNT_DIR/SUBDIR"
|
||||
|
||||
# Create big file in this image.
|
||||
# Note that we work only on the start 1MB, couple MBs in the 2GB range
|
||||
# and the last 1 MB of the huge 2.5GB file.
|
||||
|
@ -453,16 +460,19 @@ function check_results() {
|
|||
FAIL=0
|
||||
|
||||
# Check if the ls is showing correct results for 2.5 gb file
|
||||
grep -A6 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4"
|
||||
grep -A7 "Test Case 1 " "$1" | egrep -iq "2621440000 *$4"
|
||||
pass_fail "TC1: ls of $4"
|
||||
|
||||
# Check if the ls is showing correct results for 1 mb file
|
||||
grep -A6 "Test Case 1 " "$1" | egrep -iq "1048576 *$3"
|
||||
grep -A7 "Test Case 1 " "$1" | egrep -iq "1048576 *$3"
|
||||
pass_fail "TC1: ls of $3"
|
||||
|
||||
# Check size command on 1MB.file
|
||||
egrep -A3 "Test Case 2 " "$1" | grep -q "filesize=100000"
|
||||
egrep -A3 "Test Case 2a " "$1" | grep -q "filesize=100000"
|
||||
pass_fail "TC2: size of $3"
|
||||
# Check size command on 1MB.file via a path using '..'
|
||||
egrep -A3 "Test Case 2b " "$1" | grep -q "filesize=100000"
|
||||
pass_fail "TC2: size of $3 via a path using '..'"
|
||||
|
||||
# Check size command on 2.5GB.file
|
||||
egrep -A3 "Test Case 3 " "$1" | grep -q "filesize=9c400000"
|
||||
|
|
Loading…
Reference in a new issue