summaryrefslogtreecommitdiff
path: root/tests/du
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-08-02 18:52:40 +0200
committerJim Meyering <jim@meyering.net>2007-08-02 18:52:40 +0200
commitdf03463679a32c5f7cde99e6dea0acc8579a0cf6 (patch)
tree59f04d986ab589d3e889e72d6c1c26af55b7f017 /tests/du
parentfd9a6e860b7f196728a975599947a09a316be260 (diff)
downloadcoreutils-df03463679a32c5f7cde99e6dea0acc8579a0cf6.tar.xz
Adapt du's no-x test not to fail on older Linux systems.
* tests/du/no-x: Accept a third variant of the diagnostic.
Diffstat (limited to 'tests/du')
-rwxr-xr-xtests/du/no-x29
1 files changed, 13 insertions, 16 deletions
diff --git a/tests/du/no-x b/tests/du/no-x
index 00aea6a34..f6b59974a 100755
--- a/tests/du/no-x
+++ b/tests/du/no-x
@@ -2,7 +2,7 @@
# Make sure du gives the right diagnostic for a readable,
# but inaccessible directory.
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -46,25 +46,22 @@ fail=0
# This must exit nonzero.
du d >/dev/null 2>out && fail=1
+# Depending on whether du/fts is using native fdopendir, we see one
+# of the following diagnostics (note also the /y suffix in one case):
+# du: `d/no-x': Permission denied
+# du: cannot access `d/no-x/y': Permission denied
+# du: cannot read directory `d/no-x': Permission denied
+# Convert either of the latter two to the first one.
+
+sed 's/^du: cannot access /du: /' out > t && mv t out
+sed 's/^du: cannot read directory /du: /' out > t && mv t out
+sed 's,d/no-x/y,d/no-x,' out > t && mv t out
+
cat <<\EOF > exp
du: `d/no-x': Permission denied
EOF
-# With native fdopendir, du uses a different code path.
-cat <<\EOF > exp-native-fdopendir
-du: cannot access `d/no-x/y': Permission denied
-EOF
-
-if cmp out exp >/dev/null 2>&1; then
- :
-else
- if cmp out exp-native-fdopendir; then
- :
- else
- fail=1
- fi
-fi
-
+cmp out exp || fail=1
test $fail = 1 && diff out exp 2> /dev/null
(exit $fail); exit $fail