[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ls/stat-free-symlinks fails when host doesnt support stat() syscall
From: |
Jim Meyering |
Subject: |
Re: ls/stat-free-symlinks fails when host doesnt support stat() syscall |
Date: |
Mon, 14 Apr 2008 23:35:11 +0200 |
Mike Frysinger <address@hidden> wrote:
> the ls/stat-free-symlinks test does:
> strace -qe stat ....
> on some systems (like parisc/Linux), stat is not a valid system call and so
> the test just fails.
>
> it could be fixed in a few ways. have test-lib.sh check for stat like it does
> with unlink. have stat-free-symlinks fall back to stat64() if stat() fails.
> not sure which you'd want to go.
Thanks for the report!
Here's a patch that should avoid the test failure:
>From 739cf4e8325775dd6400984b3b52e67b3102e556 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 14 Apr 2008 23:33:43 +0200
Subject: [PATCH] tests: don't fail on systems without a "stat" syscall
* tests/test-lib.sh (require_strace_): Add a syscall parameter.
* tests/ls/stat-free-symlinks: Update caller.
* tests/mv/atomic: Likewise.
* tests/mv/atomic2: Likewise.
Reported by Mike Frysinger in
http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13222
---
tests/ls/stat-free-symlinks | 2 +-
tests/mv/atomic | 2 +-
tests/mv/atomic2 | 2 +-
tests/test-lib.sh | 9 ++++++---
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/ls/stat-free-symlinks b/tests/ls/stat-free-symlinks
index 07fb38e..85f363f 100755
--- a/tests/ls/stat-free-symlinks
+++ b/tests/ls/stat-free-symlinks
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../test-lib.sh
-require_strace_
+require_strace_ stat
touch x || framework_failure
chmod a+x x || framework_failure
diff --git a/tests/mv/atomic b/tests/mv/atomic
index 38e98a5..5eadb95 100755
--- a/tests/mv/atomic
+++ b/tests/mv/atomic
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../test-lib.sh
-require_strace_
+require_strace_ unlink
# Before the fix, mv would unnecessarily unlink the destination symlink:
# $ rm -rf s[12]; ln -s / s1; ln -s /tmp s2; strace -qe unlink /bin/mv -T s1
s2
diff --git a/tests/mv/atomic2 b/tests/mv/atomic2
index d1029aa..fe205b4 100755
--- a/tests/mv/atomic2
+++ b/tests/mv/atomic2
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
fi
. $srcdir/../test-lib.sh
-require_strace_
+require_strace_ unlink
# Before the fix, mv would unnecessarily unlink the destination symlink:
# $ rm -f a b b2; touch a b; ln b b2; strace -e unlink /p/bin/mv a b
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 9e04cfa..ebc6a7c 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -44,14 +44,17 @@ require_readable_root_()
test -r / || skip_test_ "/ is not readable"
}
-# Skip the current test if strace is not available or doesn't work.
+# Skip the current test if strace is not available or doesn't work
+# with the named syscall. Usage: require_strace_ unlink
require_strace_()
{
+ test $# = 1 || framework_failure
+
strace -V < /dev/null > /dev/null 2>&1 ||
skip_test_ 'no strace program'
- strace -qe unlink echo > /dev/null 2>&1 ||
- skip_test_ 'strace does not work'
+ strace -qe "$1" echo > /dev/null 2>&1 ||
+ skip_test_ 'strace -qe "'"$1"'" does not work'
}
require_built_()
--
1.5.5.50.gab781