diff options
author | stefanf <stefanf@FreeBSD.org> | 2010-05-21 16:01:57 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2010-05-21 16:01:57 +0000 |
commit | 2dece4408a92d13c55cc70d4c1547536a98df663 (patch) | |
tree | 51306ea74d44c28e50eac1aad75ae8cc1f52db26 /tools | |
parent | 772a455447c52f5f52abeb704aff69ca5a98db97 (diff) | |
download | FreeBSD-src-2dece4408a92d13c55cc70d4c1547536a98df663.zip FreeBSD-src-2dece4408a92d13c55cc70d4c1547536a98df663.tar.gz |
Merge r199628 and r199632: Tests for the cd command.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/regression/bin/sh/builtins/cd1.0 | 34 | ||||
-rw-r--r-- | tools/regression/bin/sh/builtins/cd2.0 | 15 |
2 files changed, 37 insertions, 12 deletions
diff --git a/tools/regression/bin/sh/builtins/cd1.0 b/tools/regression/bin/sh/builtins/cd1.0 index 5297023..b615174 100644 --- a/tools/regression/bin/sh/builtins/cd1.0 +++ b/tools/regression/bin/sh/builtins/cd1.0 @@ -1,17 +1,27 @@ # $FreeBSD$ set -e -PDIR=${TMPDIR:-/tmp} -cd ${PDIR} -TMPDIR=$(mktemp -d sh-test.XXXXXX) -chmod 0 ${TMPDIR} +P=${TMPDIR:-/tmp} +cd $P +T=$(mktemp -d sh-test.XXXXXX) -cd -L ${TMPDIR} 2>/dev/null && exit 1 -[ "${PWD}" = "${PDIR}" ] -[ "$(pwd)" = "${PDIR}" ] -cd -P ${TMPDIR} 2>/dev/null && exit 1 -[ "${PWD}" = "${PDIR}" ] -[ "$(pwd)" = "${PDIR}" ] +chmod 0 $T +cd -L $T 2>/dev/null && exit 1 +[ "$PWD" = "$P" ] +[ "$(pwd)" = "$P" ] +cd -P $T 2>/dev/null && exit 1 +[ "$PWD" = "$P" ] +[ "$(pwd)" = "$P" ] -chmod 755 ${TMPDIR} -rmdir ${TMPDIR} +chmod 755 $T +cd $T +mkdir -p 1/2/3 +ln -s 1/2 link1 +ln -s 2/3 1/link2 +(cd -L 1/../1 && [ "$(pwd -L)" = "$P/$T/1" ]) +(cd -L link1 && [ "$(pwd -L)" = "$P/$T/link1" ]) +(cd -L link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) +(cd -P link1 && [ "$(pwd -L)" = "$P/$T/1/2" ]) +(cd -P link1 && [ "$(pwd -P)" = "$P/$T/1/2" ]) + +rm -rf ${P}/${T} diff --git a/tools/regression/bin/sh/builtins/cd2.0 b/tools/regression/bin/sh/builtins/cd2.0 new file mode 100644 index 0000000..eb8caf5 --- /dev/null +++ b/tools/regression/bin/sh/builtins/cd2.0 @@ -0,0 +1,15 @@ +# $FreeBSD$ +set -e + +T=$(mktemp -d ${TMPDIR:-/tmp}/sh-test.XXXXXX) +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 +done +[ $(pwd | wc -c) -eq $((${#D} + 1)) ] # +\n +rm -rf ${T} |