public inbox for [email protected]
 help / color / mirror / Atom feed
From: Alviro Iskandar Setiawan <[email protected]>
To: Jens Axboe <[email protected]>
Cc: io-uring Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	Dwiky Rizky Ananditya <[email protected]>
Subject: [PATCH] test/fsnotify: Skip fsnotify test if sys/fanotify.h not available
Date: Tue, 14 Feb 2023 16:46:13 +0000	[thread overview]
Message-ID: <[email protected]> (raw)

Fix build on Termux (Android). Most android devices don't have
<sys/fanotify.h> on Termux. Skip the test if it's not available.

Reported-by: Dwiky Rizky Ananditya <[email protected]>
Tested-by: Dwiky Rizky Ananditya <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
---
 configure       | 19 +++++++++++++++++++
 test/fsnotify.c | 13 ++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index e9b7f882f0707e64..28f3eb0aee24f9ea 100755
--- a/configure
+++ b/configure
@@ -419,6 +419,22 @@ fi
 print_config "nolibc support" "$liburing_nolibc";
 #############################################################################
 
+####################################################
+# Most Android devices don't have sys/fanotify.h
+has_fanotify="no"
+cat > $TMPC << EOF
+#include <sys/fanotify.h>
+int main(void)
+{
+  return 0;
+}
+EOF
+if compile_prog "" "" "fanotify"; then
+  has_fanotify="yes"
+fi
+print_config "has_fanotify" "$has_fanotify"
+####################################################
+
 if test "$liburing_nolibc" = "yes"; then
   output_sym "CONFIG_NOLIBC"
 fi
@@ -452,6 +468,9 @@ fi
 if test "$nvme_uring_cmd" = "yes"; then
   output_sym "CONFIG_HAVE_NVME_URING"
 fi
+if test "$has_fanotify" = "yes"; then
+  output_sym "CONFIG_HAVE_FANOTIFY"
+fi
 
 echo "CC=$cc" >> $config_host_mak
 print_config "CC" "$cc"
diff --git a/test/fsnotify.c b/test/fsnotify.c
index b9b6926ced937c5f..d672f2cc2c3ff27c 100644
--- a/test/fsnotify.c
+++ b/test/fsnotify.c
@@ -2,6 +2,10 @@
 /*
  * Description: test fsnotify access off O_DIRECT read
  */
+
+#include "helpers.h"
+
+#ifdef CONFIG_HAVE_FANOTIFY
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -11,7 +15,6 @@
 #include <sys/wait.h>
 
 #include "liburing.h"
-#include "helpers.h"
 
 int main(int argc, char *argv[])
 {
@@ -99,3 +102,11 @@ out:
 		unlink(fname);
 	return err;
 }
+
+#else /* #ifdef CONFIG_HAVE_FANOTIFY */
+
+int main(void)
+{
+	return T_EXIT_SKIP;
+}
+#endif /* #ifdef CONFIG_HAVE_FANOTIFY */
-- 
Alviro Iskandar Setiawan


             reply	other threads:[~2023-02-14 16:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-14 16:46 Alviro Iskandar Setiawan [this message]
2023-02-14 16:49 ` [PATCH] test/fsnotify: Skip fsnotify test if sys/fanotify.h not available Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230214164613.2844230-1-alviro.iskandar@gnuweeb.org \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox