>From 8c9d6d51b3d7b2fdd5cea182ee7031559d3b5e97 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 11 Jan 2023 18:15:59 +0100 Subject: [PATCH 2/2] 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. --- ChangeLog | 8 ++++++++ tests/test-link.h | 7 ++++++- tests/test-linkat.c | 5 +++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 60de99cd2e..044e8cd29b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2023-01-11 Bruno Haible + + 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 link tests: Correct indentation. diff --git a/tests/test-link.h b/tests/test-link.h index a9298c8a2d..f6aaea85b6 100644 --- a/tests/test-link.h +++ b/tests/test-link.h @@ -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", diff --git a/tests/test-linkat.c b/tests/test-linkat.c index 16378b7246..44c1bb945e 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -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); -- 2.34.1