This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Skip deleted test if fork(2) is unavailable


Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
---
 ChangeLog       |  4 ++++
 configure.ac    |  1 +
 tests/ChangeLog |  4 ++++
 tests/deleted.c | 14 ++++++++++++++
 4 files changed, 23 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 662c633..2cf7bd6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* configure.ac: Check for fork().
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* configure.ac: Check for posix_fallocate, posix_fadvise, fchown,
 	fchmod.
 
diff --git a/configure.ac b/configure.ac
index 6cbd70d..5fa20c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -608,6 +608,7 @@ AM_CONDITIONAL(HAVE_FEATURES_H, [test "x$ac_cv_header_features_h" = "xyes"])
 AC_CHECK_HEADERS(stdio_ext.h)
 AM_CONDITIONAL(HAVE_STDIO_EXT_H, [test "x$ac_cv_header_stdio_ext_h" = "xyes"])
 
+AC_CHECK_DECLS([fork], [], [], [[#include <unistd.h>]])
 AC_CHECK_DECLS([feof_unlocked, ferror_unlocked, fputc_unlocked, fputs_unlocked,
 		fwrite_unlocked, putc_unlocked, putchar_unlocked],
 		[], [], [[#include <stdio.h>]])
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c2619d0..611b88a 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,9 @@
 2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
 
+	* deleted.c: If fork() is unavailable, skip the test.
+
+2017-05-04  Ulf Hermann  <ulf.hermann@qt.io>
+
 	* allfcts.c: Use fprintf and exit rather than err and errx.
 	* buildid.c: Likewise.
 	* debugaltlink.c: Likewise.
diff --git a/tests/deleted.c b/tests/deleted.c
index 6be35bc..f11cb1b 100644
--- a/tests/deleted.c
+++ b/tests/deleted.c
@@ -29,6 +29,18 @@
 
 extern void libfunc (void);
 
+#if !HAVE_DECL_FORK
+
+int
+main (int argc __attribute__ ((unused)), char **argv)
+{
+  fprintf (stderr, "%s: fork() not supported for this architecture\n",
+          argv[0]);
+  return 77;
+}
+
+#else
+
 int
 main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
 {
@@ -56,3 +68,5 @@ main (int argc __attribute__ ((unused)), char **argv __attribute__ ((unused)))
   printf ("%d\n", pid);
   return EXIT_SUCCESS;
 }
+
+#endif
-- 
2.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]