summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@gnu.org>2015-02-02 23:12:39 +0100
committerAndreas Gruenbacher <agruen@gnu.org>2015-02-04 10:54:03 +0100
commit7297352e16bdd22c2c0842aebdf612d40271b75d (patch)
tree9729e8c404862a7c8350d785260928a9a1685cc1
parent69434de2d56ba42a5031063348e0505d1274964f (diff)
downloadpatch-7297352e16bdd22c2c0842aebdf612d40271b75d.tar.gz
Test suite portability fixes
Reported and fixed (mostly) by Christian Weisgerber <naddy@mips.inka.de>: * tests/deep-directories: Avoid the bash >& redirection operator. * tests/no-mode-change-git-diff: Instead of "stat -c", use "ls -l sed". * tests/read-only-files: A redirection failure for a special built-in causes some shells (FreeBSD sh, OpenBSD sh (pdksh), some bash --posix) to exit, and the colon command is a special built-in. Perform the redirection in a subshell.
-rwxr-xr-xtests/deep-directories2
-rw-r--r--tests/no-mode-change-git-diff4
-rw-r--r--tests/read-only-files2
3 files changed, 4 insertions, 4 deletions
diff --git a/tests/deep-directories b/tests/deep-directories
index d6a41a6..4698842 100755
--- a/tests/deep-directories
+++ b/tests/deep-directories
@@ -14,7 +14,7 @@ use_tmpdir
# Exercise the directory file descriptor cache
# Artificially limit to 8 cache entries
-ulimit -n 32 >& /dev/null || exit 77
+ulimit -n 32 > /dev/null 2>&1 || exit 77
cat > ab.diff <<EOF
--- /dev/null
diff --git a/tests/no-mode-change-git-diff b/tests/no-mode-change-git-diff
index 2f9bc36..b8f33c1 100644
--- a/tests/no-mode-change-git-diff
+++ b/tests/no-mode-change-git-diff
@@ -29,6 +29,6 @@ check 'patch -p1 < simple.diff || echo "Status: $?"' <<EOF
patching file f
EOF
-check 'stat -c "%a" f'<<EOF
-755
+check 'ls -l f | sed "s,\(..........\).*,\1,"' <<EOF
+-rwxr-xr-x
EOF
diff --git a/tests/read-only-files b/tests/read-only-files
index bcc11a4..febaeb8 100644
--- a/tests/read-only-files
+++ b/tests/read-only-files
@@ -16,7 +16,7 @@ use_tmpdir
: > read-only
chmod a-w read-only
-if : 2> /dev/null > read-only; then
+if ( : 2> /dev/null > read-only ); then
echo "Files with read-only permissions are writable" \
"(probably running as superuser)" >&2
exit 77