diff options
author | des <des@FreeBSD.org> | 2009-05-26 20:13:06 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-05-26 20:13:06 +0000 |
commit | 6cf142b7b439d69ca0ee2ce20e9551f628a65110 (patch) | |
tree | a17895e876361a34c79fc7b024db853638607bd2 /tools | |
parent | 1c5e5de302cdbb97f2f6077d93e96dbb7a68eaf9 (diff) | |
download | FreeBSD-src-6cf142b7b439d69ca0ee2ce20e9551f628a65110.zip FreeBSD-src-6cf142b7b439d69ca0ee2ce20e9551f628a65110.tar.gz |
Add a regression test for kern/21768.
MFC after: 1 week
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/regression/vfs/trailing_slash.t | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tools/regression/vfs/trailing_slash.t b/tools/regression/vfs/trailing_slash.t new file mode 100755 index 0000000..fe6d799 --- /dev/null +++ b/tools/regression/vfs/trailing_slash.t @@ -0,0 +1,42 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# Tests vfs_lookup()'s handling of trailing slashes for symlinks that +# point to files. See kern/21768 +# + +testfile="/tmp/testfile-$$" +testlink="/tmp/testlink-$$" + +tests=" +$testfile:$testlink:$testfile:0 +$testfile:$testlink:$testfile/:1 +$testfile:$testlink:$testlink:0 +$testfile:$testlink:$testlink/:1 +$testfile/:$testlink:$testlink:1 +$testfile/:$testlink:$testlink/:1 +" + +touch $testfile || exit 1 +trap "rm $testfile $testlink" EXIT + +set $tests +echo "1..$#" +n=1 +for testspec ; do + ( + IFS=: + set $testspec + unset IFS + ln -fs "$1" "$2" || exit 1 + cat "$3" >/dev/null 2>&1 + ret=$? + if [ "$ret" -eq "$4" ] ; then + echo "ok $n" + else + echo "fail $n - expected $4, got $ret" + fi + n=$((n+1)) + ) +done |