public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Ulf Hermann <ulf.hermann@qt.io>
To: <elfutils-devel@sourceware.org>
Subject: [PATCH] Skip deleted test if fork(2) is unavailable
Date: Thu, 04 May 2017 10:43:00 -0000	[thread overview]
Message-ID: <77bcdc4b-f103-2020-7b85-35c53ee851d4@qt.io> (raw)

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

                 reply	other threads:[~2017-05-04 10:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=77bcdc4b-f103-2020-7b85-35c53ee851d4@qt.io \
    --to=ulf.hermann@qt.io \
    --cc=elfutils-devel@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).