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 <eblake@redhat.com>
+2011-09-16 Eric Blake <eblake@redhat.com>
+
+ 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 <bruno@clisp.org>
Support for MSVC compiler: Ensure ssize_t gets defined.
tests/macros.h
Depends-on:
+errno
configure.ac:
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);