Mercurial > gnulib
changeset 32203:ee3a8a3690cd
test-dup2: reduce dependencies
dup2 is fully tested if the cloexec module is in use, but it is
also used in a number of modules where dragging in cloexec is
over the top for just using dup2 to test whether an fd is valid.
* 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 <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 28 Dec 2009 06:24:04 -0700 |
parents | 65662952d861 |
children | 81a3b21cfe2e |
files | ChangeLog modules/cloexec modules/dup2-tests tests/test-dup2.c |
diffstat | 4 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Dec 26 19:58:13 2009 +0100 +++ b/ChangeLog Mon Dec 28 06:24:04 2009 -0700 @@ -1,3 +1,12 @@ +2009-12-28 Eric Blake <ebb9@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-12-26 Bruno Haible <bruno@clisp.org> Remove an unneeded dependency.
--- a/modules/cloexec Sat Dec 26 19:58:13 2009 +0100 +++ b/modules/cloexec Mon Dec 28 06:24:04 2009 -0700 @@ -13,6 +13,7 @@ configure.ac: gl_CLOEXEC +gl_MODULE_INDICATOR([cloexec]) Makefile.am:
--- a/modules/dup2-tests Sat Dec 26 19:58:13 2009 +0100 +++ b/modules/dup2-tests Mon Dec 28 06:24:04 2009 -0700 @@ -5,7 +5,6 @@ Depends-on: binary-io -cloexec open configure.ac:
--- a/tests/test-dup2.c Sat Dec 26 19:58:13 2009 +0100 +++ b/tests/test-dup2.c Mon Dec 28 06:24:04 2009 -0700 @@ -27,7 +27,10 @@ #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 @@ 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 @@ 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. */