]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: new function: require_openat_support_
authorJim Meyering <meyering@redhat.com>
Wed, 29 Jul 2009 12:59:27 +0000 (14:59 +0200)
committerJim Meyering <meyering@redhat.com>
Thu, 30 Jul 2009 15:47:21 +0000 (17:47 +0200)
* tests/rm/inaccessible: Factor out openat-support-detection code...
* tests/test-lib.sh (require_openat_support_): ...into this new function.

tests/rm/inaccessible
tests/test-lib.sh

index 314a3de6fe4d60f31867b47e7555cfe459089bfa..f40a342d0d32776afb0bfbe4690fa9935e8c2d1a 100755 (executable)
@@ -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`
index 9797b552e3ffb4bab92a18f3622c65662606f3a6..1174d980bc127d80cb129b3703537ae58d98d32c 100644 (file)
@@ -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