bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mkfifoat tests on mingw


From: Bruno Haible
Subject: mkfifoat tests on mingw
Date: Thu, 22 Sep 2011 02:16:34 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi Eric,

On native Windows, mkfifoat and mknodat can only be implemented as dummies
which fail with errno = ENOSYS (since FIFOs and other devices are not present
in the file system). The test-mkfifoat test thus fails.

Here's a proposed patch. It fixes the failure for me.


2011-09-21  Bruno Haible  <address@hidden>

        mkfifoat tests: Fix a test failure on mingw.
        * tests/test-mkfifoat.c (main): Allow mkfifoat or test_mknodat to fail
        with error ENOSYS.

--- tests/test-mkfifoat.c.orig  Thu Sep 22 02:12:07 2011
+++ tests/test-mkfifoat.c       Wed Sep 21 22:42:49 2011
@@ -106,32 +106,41 @@
       }
 
       /* Create fifo while cwd is '.', then stat it from '..'.  */
-      ASSERT (func (AT_FDCWD, BASE "fifo", 0600) == 0);
-      errno = 0;
-      ASSERT (func (dfd, BASE "fifo", 0600) == -1);
-      ASSERT (errno == EEXIST);
-      ASSERT (chdir ("..") == 0);
-      errno = 0;
-      ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, 0) == -1);
-      ASSERT (errno == ENOENT);
-      memset (&st, 0, sizeof st);
-      ASSERT (fstatat (dfd, BASE "fifo", &st, 0) == 0);
-      ASSERT (S_ISFIFO (st.st_mode));
-      ASSERT (unlinkat (dfd, BASE "fifo", 0) == 0);
+      if (func (AT_FDCWD, BASE "fifo", 0600) != 0)
+        ASSERT (errno == ENOSYS); /* seen on native Windows */
+      else
+        {
+          errno = 0;
+          ASSERT (func (dfd, BASE "fifo", 0600) == -1);
+          ASSERT (errno == EEXIST);
+          ASSERT (chdir ("..") == 0);
+          errno = 0;
+          ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, 0) == -1);
+          ASSERT (errno == ENOENT);
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (dfd, BASE "fifo", &st, 0) == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          ASSERT (unlinkat (dfd, BASE "fifo", 0) == 0);
+        }
 
       /* Create fifo while cwd is '..', then stat it from '.'.  */
-      ASSERT (func (dfd, BASE "fifo", 0600) == 0);
-      ASSERT (fchdir (dfd) == 0);
-      errno = 0;
-      ASSERT (func (AT_FDCWD, BASE "fifo", 0600) == -1);
-      ASSERT (errno == EEXIST);
-      memset (&st, 0, sizeof st);
-      ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW) == 0);
-      ASSERT (S_ISFIFO (st.st_mode));
-      memset (&st, 0, sizeof st);
-      ASSERT (fstatat (dfd, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW) == 0);
-      ASSERT (S_ISFIFO (st.st_mode));
-      ASSERT (unlink (BASE "fifo") == 0);
+      if (func (dfd, BASE "fifo", 0600) != 0)
+        ASSERT (errno == ENOSYS); /* seen on native Windows */
+      else
+        {
+          ASSERT (fchdir (dfd) == 0);
+          errno = 0;
+          ASSERT (func (AT_FDCWD, BASE "fifo", 0600) == -1);
+          ASSERT (errno == EEXIST);
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (AT_FDCWD, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW)
+                  == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          memset (&st, 0, sizeof st);
+          ASSERT (fstatat (dfd, BASE "fifo", &st, AT_SYMLINK_NOFOLLOW) == 0);
+          ASSERT (S_ISFIFO (st.st_mode));
+          ASSERT (unlink (BASE "fifo") == 0);
+        }
     }
 
   ASSERT (close (dfd) == 0);
-- 
In memoriam Orlando Letelier <http://en.wikipedia.org/wiki/Orlando_Letelier>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]