From: Fabian Frederick <fabf@skynet.be>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org
Subject: [PATCH 1/1] selftests : Adding symbolic link limits test script
Date: Wed, 25 Dec 2013 17:23:10 +0100 [thread overview]
Message-ID: <20131225172310.6eb4aa79f79a9fa5a79b3f4e@skynet.be> (raw)
This patch adds fs directory in selftests and a script to explain recursive
and consecutive symbolic linking limits who have been debated
so many times.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
tools/testing/selftests/Makefile | 1 +
tools/testing/selftests/fs/Makefile | 6 ++++
tools/testing/selftests/fs/symlinks.sh | 64 ++++++++++++++++++++++++++++++++++
3 files changed, 71 insertions(+)
create mode 100644 tools/testing/selftests/fs/Makefile
create mode 100755 tools/testing/selftests/fs/symlinks.sh
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 9f3eae2..10e2d80 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -9,6 +9,7 @@ TARGETS += ptrace
TARGETS += timers
TARGETS += vm
TARGETS += powerpc
+TARGETS += fs
all:
for TARGET in $(TARGETS); do \
diff --git a/tools/testing/selftests/fs/Makefile b/tools/testing/selftests/fs/Makefile
new file mode 100644
index 0000000..cf0fc21
--- /dev/null
+++ b/tools/testing/selftests/fs/Makefile
@@ -0,0 +1,6 @@
+all:
+
+run_tests:
+ @/bin/sh ./symlinks.sh || echo "symlinks selftests: [FAIL]"
+
+clean:
diff --git a/tools/testing/selftests/fs/symlinks.sh b/tools/testing/selftests/fs/symlinks.sh
new file mode 100755
index 0000000..5daeb05
--- /dev/null
+++ b/tools/testing/selftests/fs/symlinks.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+#
+# This script hits symbolic link limits.
+
+boldtext=`tput bold`
+normaltext=`tput sgr0`
+run_path=`pwd`
+appl_path="tmp_symlinks"
+mkdir -p $appl_path
+cd $appl_path
+
+function recursive_symbolic_links()
+{
+ path="origpath"`date +'%s'`
+ symlink=`date +'%s'`
+ echo $boldtext"Recursive symbolic link testing (vfs limit : 8)"\
+ $normaltext
+ echo "original_path/1/2/3/4 ... where 1=>original_path 2=>1 ..."
+ echo "Trying 10 steps ..."
+ mkdir $path
+
+ for i in {1..10}
+ do
+ cd $path 2>/dev/null|| break
+ echo "Creating : "$path" =>" " [OK]"
+ if [ $i = 1 ] ;then
+ path="../"$path
+ fi
+ ln -s $path $symlink"_"$i
+ path=$symlink"_"$i
+ done
+ echo $boldtext"Maximum recursive symlink level:" `expr $i - 2 `\
+ $normaltext
+}
+
+function consecutive_symbolic_links()
+{
+ origfile="orig"`date +'%s'`
+ symlink=`date +'%s'`
+ echo $boldtext"Consecutive symbolic link testing (vfs limit : 40)"\
+ $normaltext
+ echo "original_file;1;2;3 ... where 1=>original_file 2=>1 ..."
+ echo "Trying 50 steps ..."
+
+ touch $origfile
+ for i in {1..50}
+ do
+ cat $origfile 2>/dev/null || break;
+ echo -n "[OK] |"
+ ln -s $origfile $symlink"_"$i
+ origfile=$symlink"_"$i
+ echo -n $i
+ done
+ echo -e $boldtext "\nMaximum consecutive symlink level:" `expr $i - 2`\
+ $normaltext
+
+}
+
+recursive_symbolic_links
+echo "------------------------------------------------------"
+sleep 1
+consecutive_symbolic_links
+cd $run_path
+rm -rf $appl_path
--
1.8.1.4
next reply other threads:[~2013-12-25 16:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-25 16:23 Fabian Frederick [this message]
2013-12-27 22:38 ` Andrew Morton
2013-12-28 4:37 ` Fabian Frederick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131225172310.6eb4aa79f79a9fa5a79b3f4e@skynet.be \
--to=fabf@skynet.be \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®