[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: new function: require_openat_support_
From: |
Jim Meyering |
Subject: |
[PATCH] tests: new function: require_openat_support_ |
Date: |
Thu, 30 Jul 2009 17:52:51 +0200 |
I'm about to use this function in a new test, so...
>From c06547cadeed50e85b1de661634a39f7321e562c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 29 Jul 2009 14:59:27 +0200
Subject: [PATCH] tests: new function: require_openat_support_
* tests/rm/inaccessible: Factor out openat-support-detection code...
* tests/test-lib.sh (require_openat_support_): ...into this new function.
---
tests/rm/inaccessible | 8 +-------
tests/test-lib.sh | 15 +++++++++++++++
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/tests/rm/inaccessible b/tests/rm/inaccessible
index 314a3de..f40a342 100755
--- a/tests/rm/inaccessible
+++ b/tests/rm/inaccessible
@@ -26,13 +26,7 @@ fi
# Skip this test if your system has neither the openat-style functions
# nor /proc/self/fd support with which to emulate them.
-skip=yes
-grep '^#define HAVE_OPENAT' $CONFIG_HEADER > /dev/null && skip=no
-test -d /proc/self/fd && skip=no
-if test $skip = yes; then
- skip_test_ 'this system lacks openat support'
-fi
-
+require_openat_support_
skip_if_root_
p=`pwd`
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 9797b55..1174d98 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -47,6 +47,21 @@ require_acl_()
|| skip_test_ "This test requires a local user named bin."
}
+require_openat_support_()
+{
+ # Skip this test if your system has neither the openat-style functions
+ # nor /proc/self/fd support with which to emulate them.
+ test -z "$CONFIG_HEADER" \
+ && skip_test_ 'internal error: CONFIG_HEADER not defined'
+
+ _skip=yes
+ grep '^#define HAVE_OPENAT' "$CONFIG_HEADER" > /dev/null && _skip=no
+ test -d /proc/self/fd && _skip=no
+ if test $_skip = yes; then
+ skip_test_ 'this system lacks openat support'
+ fi
+}
+
require_ulimit_()
{
ulimit_works=yes
--
1.6.4.212.g4719
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: new function: require_openat_support_,
Jim Meyering <=