summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2015-10-26 03:37:01 +0000
committerngie <ngie@FreeBSD.org>2015-10-26 03:37:01 +0000
commitbcb9cc88eae26423a11b83b3c750272f14994dae (patch)
tree9324275f18d237976aa82047c32989b4fd022141 /tests
parent0df2ba1b6928a073faca813ef2db1d1990a8f46c (diff)
downloadFreeBSD-src-bcb9cc88eae26423a11b83b3c750272f14994dae.zip
FreeBSD-src-bcb9cc88eae26423a11b83b3c750272f14994dae.tar.gz
MFC r289300:
Integrate tools/regression/vfs into the FreeBSD test suite as tests/sys/vfs Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/Makefile1
-rw-r--r--tests/sys/vfs/Makefile7
-rwxr-xr-xtests/sys/vfs/trailing_slash.sh42
3 files changed, 50 insertions, 0 deletions
diff --git a/tests/sys/Makefile b/tests/sys/Makefile
index 3f621ea..0b23448 100644
--- a/tests/sys/Makefile
+++ b/tests/sys/Makefile
@@ -11,6 +11,7 @@ TESTS_SUBDIRS+= kern
TESTS_SUBDIRS+= kqueue
TESTS_SUBDIRS+= mqueue
TESTS_SUBDIRS+= netinet
+TESTS_SUBDIRS+= vfs
TESTS_SUBDIRS+= vm
# Items not integrated into kyua runs by default
diff --git a/tests/sys/vfs/Makefile b/tests/sys/vfs/Makefile
new file mode 100644
index 0000000..48f5226
--- /dev/null
+++ b/tests/sys/vfs/Makefile
@@ -0,0 +1,7 @@
+# $FreeBSD$
+
+TESTSDIR= ${TESTSBASE}/sys/vfs
+
+PLAIN_TESTS_SH+= trailing_slash
+
+.include <bsd.test.mk>
diff --git a/tests/sys/vfs/trailing_slash.sh b/tests/sys/vfs/trailing_slash.sh
new file mode 100755
index 0000000..b1b8523
--- /dev/null
+++ b/tests/sys/vfs/trailing_slash.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# Tests vfs_lookup()'s handling of trailing slashes for symlinks that
+# point to files. See kern/21768 for details. Fixed in r193028.
+#
+
+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
OpenPOWER on IntegriCloud