-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Bruno Haible on 12/26/2009 11:59 AM: > * The dependency of dup2-tests on 'cloexec' could be removed if the > relevant (small) part of the test would be enclosed in > #ifdef GNULIB_CLOEXEC > so that it is skipped if the cloexec module is not present. coreutils > does include the 'cloexec' module, therefore at least the coreutils users > will still have a 100% check of dup2.
Seems reasonable. I'll push this. > > * The dependency of dup2-tests on 'open' can safely be removed because the > file to be opened is "test-dup2.tmp", which does not trigger any of the > problems listed in doc/posix-functions/open.texi. No, the test also does 'open ("/dev/null",...)', which _does_ require the open module. - -- Don't work too hard, make some time for fun as well! Eric Blake e...@byu.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAks4skkACgkQ84KuGfSFAYA4gQCgqUoyDHPFidJeWfejKrwMibra yeoAoM9txAV0APabpmSIko2LkGdBLei/ =qWBj -----END PGP SIGNATURE-----
>From e3fe72a2748b3caaf36bfd8de6c2736e83f561b8 Mon Sep 17 00:00:00 2001 From: Eric Blake <e...@byu.net> Date: Mon, 28 Dec 2009 06:24:04 -0700 Subject: [PATCH] test-dup2: reduce dependencies dup2 is fully if the cloexec module is in use, but dragging in cloexec just to test whether an fd is valid was a bit much. * modules/cloexec (Configure.ac): Set witness. * modules/dup2-tests (Depends-on): Drop cloexec. * tests/test-dup2.c (main): Skip portion of test if cloexec module not present. Suggested by Bruno Haible. Signed-off-by: Eric Blake <e...@byu.net> --- ChangeLog | 9 +++++++++ modules/cloexec | 1 + modules/dup2-tests | 1 - tests/test-dup2.c | 7 ++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index dff3b9b..88be6c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-12-28 Eric Blake <e...@byu.net> + + test-dup2: reduce dependencies + * modules/cloexec (Configure.ac): Set witness. + * modules/dup2-tests (Depends-on): Drop cloexec. + * tests/test-dup2.c (main): Skip portion of test if cloexec module + not present. + Suggested by Bruno Haible. + 2009-11-17 Eric Blake <e...@byu.net> manywarnings: add more warnings diff --git a/modules/cloexec b/modules/cloexec index 88fb6d3..d590d1e 100644 --- a/modules/cloexec +++ b/modules/cloexec @@ -13,6 +13,7 @@ stdbool configure.ac: gl_CLOEXEC +gl_MODULE_INDICATOR([cloexec]) Makefile.am: diff --git a/modules/dup2-tests b/modules/dup2-tests index 679f4b1..a973fd7 100644 --- a/modules/dup2-tests +++ b/modules/dup2-tests @@ -5,7 +5,6 @@ tests/macros.h Depends-on: binary-io -cloexec open configure.ac: diff --git a/tests/test-dup2.c b/tests/test-dup2.c index d3751f5..b65fcad 100644 --- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -27,7 +27,10 @@ SIGNATURE_CHECK (dup2, int, (int, int)); #include <fcntl.h> #include "binary-io.h" -#include "cloexec.h" + +#if GNULIB_CLOEXEC +# include "cloexec.h" +#endif #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Get declarations of the Win32 API functions. */ @@ -156,6 +159,7 @@ main (void) ASSERT (read (fd, buffer, 1) == 1); ASSERT (*buffer == '2'); +#if GNULIB_CLOEXEC /* Any new fd created by dup2 must not be cloexec. */ ASSERT (close (fd + 2) == 0); ASSERT (dup_cloexec (fd) == fd + 1); @@ -164,6 +168,7 @@ main (void) ASSERT (!is_inheritable (fd + 1)); ASSERT (dup2 (fd + 1, fd + 2) == fd + 2); ASSERT (is_inheritable (fd + 2)); +#endif /* On systems that distinguish between text and binary mode, dup2 reuses the mode of the source. */ -- 1.6.4.2