]> Savannah Git Hosting - gnulib.git/commitdiff
link, linkat tests: Fix test failures on Android/Termux.
authorBruno Haible <bruno@clisp.org>
Wed, 11 Jan 2023 17:15:59 +0000 (18:15 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 11 Jan 2023 17:15:59 +0000 (18:15 +0100)
* tests/test-link.h (test_link): On Android, treat an EACCES failure
like EPERM.
* tests/test-linkat.c (main): When test_link is marked skipped, skip the
rest of the test as well.

ChangeLog
tests/test-link.h
tests/test-linkat.c

index 60de99cd2e742cb76d3004569c844120af35fe73..044e8cd29b7db7e098d831e3c3f1d00925b2469a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-01-11  Bruno Haible  <bruno@clisp.org>
+
+       link, linkat tests: Fix test failures on Android/Termux.
+       * tests/test-link.h (test_link): On Android, treat an EACCES failure
+       like EPERM.
+       * tests/test-linkat.c (main): When test_link is marked skipped, skip the
+       rest of the test as well.
+
 2023-01-11  Bruno Haible  <bruno@clisp.org>
 
        link tests: Correct indentation.
index a9298c8a2d9f02ac5a9d99b51a57a8ab5ed328ed..f6aaea85b6f489ecbcde1144b40eb25713585b52 100644 (file)
@@ -53,11 +53,16 @@ test_link (int (*func) (char const *, char const *), bool print)
   if (ret == -1)
     {
       /* If the device does not support hard links, errno is
-         EPERM on Linux, EOPNOTSUPP on FreeBSD.  */
+         EPERM on Linux,
+         EOPNOTSUPP on FreeBSD,
+         EACCES on Android within Termux.  */
       switch (errno)
         {
         case EPERM:
         case EOPNOTSUPP:
+        #if defined __ANDROID__
+        case EACCES:
+        #endif
           if (print)
             fputs ("skipping test: "
                    "hard links not supported on this file system\n",
index 16378b72464d497147e36dd70f21a1d3ec5f3492..44c1bb945e3a73708846f520515fe0e3d1f74a3e 100644 (file)
@@ -138,6 +138,11 @@ main (void)
   dfd1 = AT_FDCWD;
   ASSERT (test_link (do_link, false) == result);
 
+  /* Skip the rest of the test if the file system does not support hard links
+     and symlinks.  */
+  if (result)
+    return result;
+
   /* Create locations to manipulate.  */
   ASSERT (mkdir (BASE "sub1", 0700) == 0);
   ASSERT (mkdir (BASE "sub2", 0700) == 0);