2 # Ensure that pwd and "readlink -e ." work even when a parent directory
3 # is unreadable. Perform this test only on systems with a usable getcwd
4 # function that has this capability.
6 # Copyright (C) 2007 Free Software Foundation, Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 if test "$VERBOSE" = yes; then
29 test $host_os != linux-gnu &&
31 echo 1>&2 "$0: vendor getcwd may be inadequate; skipping this test"
35 # Linux ia64 has the gl_FUNC_GETCWD_ABORT_BUG, so we can't use
37 test $REPLACE_GETCWD = 1 &&
39 echo 1>&2 "$0: can't use buggy system getcwd; skipping this test"
44 t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
45 trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
46 trap '(exit $?); exit $?' 1 2 13 15
49 mkdir -p $tmp || framework_failure=1
50 cd $tmp || framework_failure=1
52 mkdir -p a/b || framework_failure=1
53 cd a/b || framework_failure=1
54 chmod a=x .. || framework_failure=1
56 if test $framework_failure = 1; then
57 echo "$0: failure in testing framework" 1>&2
61 pwd_exe=$pwd/../../src/pwd
64 $pwd_exe > exp || fail=1
65 readlink -ev . > out || fail=1
68 test $fail = 1 && diff out exp 2> /dev/null
70 (exit $fail); exit $fail