From: Nathaniel Clark Date: Thu, 29 Nov 2012 14:14:37 +0000 (-0500) Subject: LU-2405 tests: verify off-by-one symlink length fix X-Git-Tag: 2.1.4-RC1~14 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=1745d49b1b0c90926ae79c5b0eb81a589ddf0668;p=fs%2Flustre-release.git LU-2405 tests: verify off-by-one symlink length fix Add regression test for off-by-one bug in symlink code. Ensures boundary condition of 60 character symlinks are readable after creation. original commit 6c3606b79a4c25946255a680f79ff2d58df66bbc Whamcloud-bug-id: LU-2241 Signed-off-by: Nathaniel Clark Change-Id: I4264558a5b638e73e7631b988b05b92405d13288 Reviewed-on: http://review.whamcloud.com/4711 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 6aa83f0..d393e5e 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -457,13 +457,29 @@ test_17f() { } run_test 17f "symlinks: long and very long symlink name ========================" +# str_repeat(S, N) generate a string that is string S repeated N times +str_repeat() { + local s=$1 + local n=$2 + local ret='' + while [ $((n -= 1)) -ge 0 ]; do + ret=$ret$s + done + echo $ret +} + +# Long symlinks and LU-2241 test_17g() { - mkdir -p $DIR/$tdir - LONGSYMLINK="$(dd if=/dev/zero bs=4095 count=1 | tr '\0' 'x')" - ln -s $LONGSYMLINK $DIR/$tdir/$tfile - ls -l $DIR/$tdir + mkdir -p $DIR/$tdir + local TESTS="59 60 61 4094 4095" + + for i in $TESTS; do + local SYMNAME=$(str_repeat 'x' $i) + ln -s $SYMNAME $DIR/$tdir/f$i || error "failed $i-char symlink" + readlink $DIR/$tdir/f$i || error "failed $i-char readlink" + done } -run_test 17g "symlinks: really long symlink name ===============================" +run_test 17g "symlinks: really long symlink name and inode boundaries" test_17h() { #bug 17378 mkdir -p $DIR/$tdir