[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] test-fsync: enhance tests
From: |
Eric Blake |
Subject: |
[PATCH 1/2] test-fsync: enhance tests |
Date: |
Fri, 16 Sep 2011 11:25:44 -0600 |
This test failed to compile on mingw, which lacks ENOTSUP. Furthermore,
it wasn't testing POSIX behavior on invalid fds.
* modules/fsync-tests (Depends-on): Add errno, for mingw.
* tests/test-fsync.c (main): Enhance test.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 6 ++++++
modules/fsync-tests | 1 +
tests/test-fsync.c | 7 +++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3717d06..e1f97a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-09-16 Eric Blake <address@hidden>
+
+ test-fsync: enhance tests
+ * modules/fsync-tests (Depends-on): Add errno, for mingw.
+ * tests/test-fsync.c (main): Enhance test.
+
2011-09-15 Bruno Haible <address@hidden>
Support for MSVC compiler: Ensure ssize_t gets defined.
diff --git a/modules/fsync-tests b/modules/fsync-tests
index e3df22d..3db181b 100644
--- a/modules/fsync-tests
+++ b/modules/fsync-tests
@@ -4,6 +4,7 @@ tests/signature.h
tests/macros.h
Depends-on:
+errno
configure.ac:
diff --git a/tests/test-fsync.c b/tests/test-fsync.c
index 2627d0c..11c0478 100644
--- a/tests/test-fsync.c
+++ b/tests/test-fsync.c
@@ -32,13 +32,16 @@ main (void)
int fd;
const char *file = "test-fsync.txt";
- if (fsync (0) != 0)
+ if (fsync (STDOUT_FILENO) != 0)
{
ASSERT (errno == EINVAL /* POSIX */
|| errno == ENOTSUP /* seen on MacOS X 10.5 */
|| errno == EBADF /* seen on AIX 7.1 */
- );
+ );
}
+ errno = 0;
+ ASSERT (fsync (-1) == -1);
+ ASSERT (errno == EBADF);
fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
ASSERT (0 <= fd);
ASSERT (write (fd, "hello", 5) == 5);
--
1.7.4.4
- [PATCH 1/2] test-fsync: enhance tests,
Eric Blake <=