summaryrefslogtreecommitdiff
path: root/tests/du/long-from-unreadable
diff options
context:
space:
mode:
Diffstat (limited to 'tests/du/long-from-unreadable')
-rwxr-xr-xtests/du/long-from-unreadable36
1 files changed, 12 insertions, 24 deletions
diff --git a/tests/du/long-from-unreadable b/tests/du/long-from-unreadable
index 9718b2bd2..64c35b9a5 100755
--- a/tests/du/long-from-unreadable
+++ b/tests/du/long-from-unreadable
@@ -1,7 +1,7 @@
#!/bin/sh
# Show fts fails on old-fashioned systems.
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ if test "$VERBOSE" = yes; then
du --version
fi
-. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
proc_file=/proc/self/fd
if test ! -d $proc_file; then
@@ -44,44 +44,32 @@ EOF
(exit 77); exit 77
fi
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
dir=`printf '%200s\n' ' '|tr ' ' x`
# Construct a hierarchy containing a relative file with a name
# longer than PATH_MAX.
# for i in `seq 52`; do
-# mkdir $dir || framework_failure=1
-# cd $dir || framework_failure=1
+# mkdir $dir || framework_failure
+# cd $dir || framework_failure
# done
-# cd $tmp || framework_failure=1
+# cd $tmp || framework_failure
# Sheesh. Bash 3.1.5 can't create this hierarchy. I get
# cd: error retrieving current directory: getcwd: cannot access parent directories:
+
+cwd=`pwd`
# Use perl instead:
: ${PERL=perl}
$PERL \
-e 'my $d = '$dir'; foreach my $i (1..52)' \
-e ' { mkdir ($d, 0700) && chdir $d or die "$!" }' \
- || framework_failure=1
+ || framework_failure
-mkdir inaccessible || framework_failure=1
-cd inaccessible || framework_failure=1
-chmod 0 . || framework_failure=1
-
-if test $framework_failure = 1; then
- echo "$0: failure in testing framework" 1>&2
- (exit 1); exit 1
-fi
+mkdir inaccessible || framework_failure
+cd inaccessible || framework_failure
+chmod 0 . || framework_failure
fail=0
-du -s "$pwd/$tmp/$dir" > /dev/null || fail=1
+du -s "$cwd/$dir" > /dev/null || fail=1
(exit $fail); exit $fail