Author: jilles
Date: Sun Nov 28 22:49:58 2010
New Revision: 216019
URL: http://svn.freebsd.org/changeset/base/216019

Log:
  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

Modified:
  head/tools/regression/bin/sh/builtins/cd2.0

Modified: head/tools/regression/bin/sh/builtins/cd2.0
==============================================================================
--- head/tools/regression/bin/sh/builtins/cd2.0 Sun Nov 28 22:07:08 2010        
(r216018)
+++ head/tools/regression/bin/sh/builtins/cd2.0 Sun Nov 28 22:49:58 2010        
(r216019)
@@ -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}
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to