diff options
author | jilles <jilles@FreeBSD.org> | 2010-11-28 22:49:58 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-11-28 22:49:58 +0000 |
commit | a3f372978c891f27e9853959cca91bb2a9c94698 (patch) | |
tree | 073c5c6d0ca195ac61c70dd04aa8032e68d5b726 | |
parent | eadf2bdaecb0bf137e81c62dcade0a0bfbc08188 (diff) | |
download | FreeBSD-src-a3f372978c891f27e9853959cca91bb2a9c94698.zip FreeBSD-src-a3f372978c891f27e9853959cca91bb2a9c94698.tar.gz |
sh: Make the test for cd/pwd with long pathnames more useful:
* Use $(getconf PATH_MAX /) to make sure we actually exercise the hard part
* Delete our test area even if the test fails
-rw-r--r-- | tools/regression/bin/sh/builtins/cd2.0 | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/regression/bin/sh/builtins/cd2.0 b/tools/regression/bin/sh/builtins/cd2.0 index eb8caf5..f2b6416 100644 --- a/tools/regression/bin/sh/builtins/cd2.0 +++ b/tools/regression/bin/sh/builtins/cd2.0 @@ -1,15 +1,16 @@ # $FreeBSD$ set -e +L=$(getconf PATH_MAX / 2>/dev/null) || L=4096 +[ "$L" -lt 100000 ] 2>/dev/null || L=4096 +L=$((L+100)) T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +trap 'rm -rf ${T}' 0 cd $T D=$T -for i in 0 1 2 3 4 5 6 7 8 9; do - for j in 0 1 2 3 4 5 6 7 8 9; do - mkdir veryverylongdirectoryname - cd veryverylongdirectoryname - D=$D/veryverylongdirectoryname - done +while [ ${#D} -lt $L ]; do + mkdir veryverylongdirectoryname + cd veryverylongdirectoryname + D=$D/veryverylongdirectoryname done [ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n -rm -rf ${T} |