summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorStefan Brüns <stefan.bruens@rwth-aachen.de>2016-09-14 01:01:30 +0200
committerTom Rini <trini@konsulko.com>2016-09-23 08:57:44 -0400
commit14678b3c6280a1a024afa0b5564deb853eca44d0 (patch)
tree0b51015a3b90b82d7c57c5d9a28cba0f177e64c5 /test
parentd9554b7f4bcbf8310e364b05b900e464d5e1ac47 (diff)
test/fs: Check ext4 behaviour if dirent is first entry in directory block
This is a regression test for a crash happening if the first dirent in the block matches. Code tried to access a predecessor entry which does not exist. The crash happened for any block, but "." is always the first entry in the first directory block and thus easy to check for. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/fs-test.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/fs/fs-test.sh b/test/fs/fs-test.sh
index b9c2306a7b..69abdabd56 100755
--- a/test/fs/fs-test.sh
+++ b/test/fs/fs-test.sh
@@ -293,6 +293,12 @@ ${PREFIX}load host${SUFFIX} $addr ${FPATH}$FILE_WRITE
md5sum $addr \$filesize
setenv filesize
#
+
+# Next test case checks writing a file whose dirent
+# is the first in the block, which is always true for "."
+# The write should fail, but the lookup should work
+# Test Case 12 - Check directory traversal
+${PREFIX}${WRITE} host${SUFFIX} $addr ${FPATH}. 0x10
reset
EOF
@@ -472,6 +478,10 @@ function check_results() {
pass_fail "TC11: 1MB write to $3.w - write succeeded"
check_md5 "Test Case 11b " "$1" "$2" 1 \
"TC11: 1MB write to $3.w - content verified"
+
+ # Check lookup of 'dot' directory
+ grep -A4 "Test Case 12 " "$1" | grep -q 'Unable to write file'
+ pass_fail "TC12: 1MB write to . - write denied"
echo "** End $1"
}