Mercurial > hg > octave-lojdl > gnulib-hg
changeset 12154:70f5bc44922b
test-dup2: enhance test
AT_FDCWD is only supposed to be special in *at functions.
* tests/test-dup2.c (main): Also check AT_FDCWD.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Sat, 10 Oct 2009 07:06:22 -0600 |
parents | 4443f8be082f |
children | a12f708060ff |
files | ChangeLog tests/test-dup2.c |
diffstat | 2 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-10-10 Eric Blake <ebb9@byu.net> + test-dup2: enhance test + * tests/test-dup2.c (main): Also check AT_FDCWD. + test-stat-time: avoid more spurious failures * tests/test-stat-time.c (nap): Wait for 15ms rather than 2ms, for xfs; and avoid race if the two timestamps cross quantization edge.
--- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -80,6 +80,15 @@ ASSERT (dup2 (fd, fd) == fd); ASSERT (is_open (fd)); + /* The source must be valid. */ + errno = 0; + ASSERT (dup2 (-1, fd) == -1); + ASSERT (errno == EBADF); + errno = 0; + ASSERT (dup2 (AT_FDCWD, fd) == -1); + ASSERT (errno == EBADF); + ASSERT (is_open (fd)); + /* If the source is not open, then the destination is unaffected. */ errno = 0; ASSERT (dup2 (fd + 1, fd + 1) == -1);